Add SHA3 benchmark

This commit is contained in:
Pieter Wuille 2020-08-30 15:50:55 -07:00
parent 2ac8bf9583
commit 3f01ddb01b

View file

@ -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);