aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2020-08-30 15:50:55 -0700
committerPieter Wuille <pieter@wuille.net>2020-09-06 18:35:23 -0700
commit3f01ddb01bfffd49dfa131898d1c674ac5d0ac99 (patch)
tree71f6fe164a241064b72252bf46187a69e711cf32 /src/bench
parent2ac8bf95834c8a43ebf365f09fb610829733134b (diff)
downloadbitcoin-3f01ddb01bfffd49dfa131898d1c674ac5d0ac99.tar.xz
Add SHA3 benchmark
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/crypto_hash.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bench/crypto_hash.cpp b/src/bench/crypto_hash.cpp
index 36be86bcc8..65d16d47d8 100644
--- a/src/bench/crypto_hash.cpp
+++ b/src/bench/crypto_hash.cpp
@@ -7,6 +7,7 @@
#include <crypto/ripemd160.h>
#include <crypto/sha1.h>
#include <crypto/sha256.h>
+#include <crypto/sha3.h>
#include <crypto/sha512.h>
#include <crypto/siphash.h>
#include <hash.h>
@@ -43,6 +44,15 @@ static void SHA256(benchmark::Bench& bench)
});
}
+static void SHA3_256_1M(benchmark::Bench& bench)
+{
+ uint8_t hash[SHA3_256::OUTPUT_SIZE];
+ std::vector<uint8_t> in(BUFFER_SIZE,0);
+ bench.batch(in.size()).unit("byte").run([&] {
+ SHA3_256().Write(in).Finalize(hash);
+ });
+}
+
static void SHA256_32b(benchmark::Bench& bench)
{
std::vector<uint8_t> in(32,0);
@@ -99,6 +109,7 @@ BENCHMARK(RIPEMD160);
BENCHMARK(SHA1);
BENCHMARK(SHA256);
BENCHMARK(SHA512);
+BENCHMARK(SHA3_256_1M);
BENCHMARK(SHA256_32b);
BENCHMARK(SipHash_32b);