51 std::vector<uint8_t> in(32, 0);
57 std::vector<uint8_t> in(64 * 1024, 0);
59 [&] {
SHA256D64(in.data(), in.data(), 1024); });
74 std::memcpy(x.
begin(), &hash64,
sizeof(hash64));
90 uint8_t key[32] = {0};
103 bench.
run([&] { acc *= muhash; });
111 bench.
run([&] { acc /= muhash; });
117 std::vector<uint8_t> key{rng.
randbytes(32)};
static const uint8_t k1[32]
A hasher class for RIPEMD-160.
CRIPEMD160 & Write(const uint8_t *data, size_t len)
void Finalize(uint8_t hash[OUTPUT_SIZE])
static const size_t OUTPUT_SIZE
void Finalize(uint8_t hash[OUTPUT_SIZE])
CSHA1 & Write(const uint8_t *data, size_t len)
static const size_t OUTPUT_SIZE
A hasher class for SHA-256.
CSHA256 & Write(const uint8_t *data, size_t len)
static const size_t OUTPUT_SIZE
void Finalize(uint8_t hash[OUTPUT_SIZE])
A hasher class for SHA-512.
CSHA512 & Write(const uint8_t *data, size_t len)
static constexpr size_t OUTPUT_SIZE
void Finalize(uint8_t hash[OUTPUT_SIZE])
uint32_t rand32() noexcept
Generate a random 32-bit integer.
std::vector< uint8_t > randbytes(size_t len)
Generate random bytes.
bool randbool() noexcept
Generate a random boolean.
A class representing MuHash sets.
SHA3_256 & Finalize(Span< uint8_t > output)
SHA3_256 & Write(Span< const uint8_t > data)
static constexpr size_t OUTPUT_SIZE
Main entry point to nanobench's benchmarking facility.
ANKERL_NANOBENCH(NODISCARD) std Bench & batch(T b) noexcept
Sets the batch size.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Bench & unit(char const *unit)
Sets the operation unit.
static void RIPEMD160(benchmark::Bench &bench)
static void SipHash_32b(benchmark::Bench &bench)
static void FastRandom_1bit(benchmark::Bench &bench)
static void MuHashPrecompute(benchmark::Bench &bench)
static const uint64_t BUFFER_SIZE
static void SHA256_32b(benchmark::Bench &bench)
static void FastRandom_32bit(benchmark::Bench &bench)
static void MuHashMul(benchmark::Bench &bench)
static void SHA256D64_1024(benchmark::Bench &bench)
static void SHA3_256_1M(benchmark::Bench &bench)
static void SHA1(benchmark::Bench &bench)
static void SHA512(benchmark::Bench &bench)
static void SHA256(benchmark::Bench &bench)
static void MuHashDiv(benchmark::Bench &bench)
static void MuHash(benchmark::Bench &bench)
void SHA256D64(uint8_t *out, const uint8_t *in, size_t blocks)
Compute multiple double-SHA256's of 64-byte blobs.
uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256 &val)
Optimized SipHash-2-4 implementation for uint256.