File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#include " bench.h"
8
8
#include " bloom.h"
9
+ #include " hash.h"
10
+ #include " uint256.h"
9
11
#include " utiltime.h"
10
12
#include " crypto/ripemd160.h"
11
13
#include " crypto/sha1.h"
@@ -39,6 +41,16 @@ static void SHA256(benchmark::State& state)
39
41
CSHA256 ().Write (begin_ptr (in), in.size ()).Finalize (hash);
40
42
}
41
43
44
+ static void SHA256_32b (benchmark::State& state)
45
+ {
46
+ std::vector<uint8_t > in (32 ,0 );
47
+ while (state.KeepRunning ()) {
48
+ for (int i = 0 ; i < 1000000 ; i++) {
49
+ CSHA256 ().Write (begin_ptr (in), in.size ()).Finalize (&in[0 ]);
50
+ }
51
+ }
52
+ }
53
+
42
54
static void SHA512 (benchmark::State& state)
43
55
{
44
56
uint8_t hash[CSHA512::OUTPUT_SIZE];
@@ -47,7 +59,20 @@ static void SHA512(benchmark::State& state)
47
59
CSHA512 ().Write (begin_ptr (in), in.size ()).Finalize (hash);
48
60
}
49
61
62
+ static void SipHash_32b (benchmark::State& state)
63
+ {
64
+ uint256 x;
65
+ while (state.KeepRunning ()) {
66
+ for (int i = 0 ; i < 1000000 ; i++) {
67
+ *((uint64_t *)x.begin ()) = SipHashUint256 (0 , i, x);
68
+ }
69
+ }
70
+ }
71
+
50
72
BENCHMARK (RIPEMD160);
51
73
BENCHMARK (SHA1);
52
74
BENCHMARK (SHA256);
53
75
BENCHMARK (SHA512);
76
+
77
+ BENCHMARK (SHA256_32b);
78
+ BENCHMARK (SipHash_32b);
You can’t perform that action at this time.
0 commit comments