File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
6
6
#include < bench/bench.h>
7
+ #include < crypto/muhash.h>
7
8
#include < crypto/ripemd160.h>
8
9
#include < crypto/sha1.h>
9
10
#include < crypto/sha256.h>
@@ -105,6 +106,54 @@ static void FastRandom_1bit(benchmark::Bench& bench)
105
106
});
106
107
}
107
108
109
+ static void MuHash (benchmark::Bench& bench)
110
+ {
111
+ MuHash3072 acc;
112
+ unsigned char key[32 ] = {0 };
113
+ int i = 0 ;
114
+ bench.run ([&] {
115
+ key[0 ] = ++i;
116
+ acc *= MuHash3072 (key);
117
+ });
118
+ }
119
+
120
+ static void MuHashMul (benchmark::Bench& bench)
121
+ {
122
+ MuHash3072 acc;
123
+ FastRandomContext rng (true );
124
+ MuHash3072 muhash{rng.randbytes (32 )};
125
+
126
+ bench.run ([&] {
127
+ acc *= muhash;
128
+ });
129
+ }
130
+
131
+ static void MuHashDiv (benchmark::Bench& bench)
132
+ {
133
+ MuHash3072 acc;
134
+ FastRandomContext rng (true );
135
+ MuHash3072 muhash{rng.randbytes (32 )};
136
+
137
+ for (size_t i = 0 ; i < bench.epochIterations (); ++i) {
138
+ acc *= muhash;
139
+ }
140
+
141
+ bench.run ([&] {
142
+ acc /= muhash;
143
+ });
144
+ }
145
+
146
+ static void MuHashPrecompute (benchmark::Bench& bench)
147
+ {
148
+ MuHash3072 acc;
149
+ FastRandomContext rng (true );
150
+ std::vector<unsigned char > key{rng.randbytes (32 )};
151
+
152
+ bench.run ([&] {
153
+ MuHash3072{key};
154
+ });
155
+ }
156
+
108
157
BENCHMARK (RIPEMD160);
109
158
BENCHMARK (SHA1);
110
159
BENCHMARK (SHA256);
@@ -116,3 +165,8 @@ BENCHMARK(SipHash_32b);
116
165
BENCHMARK (SHA256D64_1024);
117
166
BENCHMARK (FastRandom_32bit);
118
167
BENCHMARK (FastRandom_1bit);
168
+
169
+ BENCHMARK (MuHash);
170
+ BENCHMARK (MuHashMul);
171
+ BENCHMARK (MuHashDiv);
172
+ BENCHMARK (MuHashPrecompute);
You can’t perform that action at this time.
0 commit comments