Changeset View
Changeset View
Standalone View
Standalone View
src/bench/crypto_hash.cpp
// Copyright (c) 2016 The Bitcoin Core developers | // Copyright (c) 2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <iostream> | #include <iostream> | ||||
#include "bench.h" | #include <bench/bench.h> | ||||
#include "bloom.h" | #include <bloom.h> | ||||
#include "crypto/ripemd160.h" | #include <crypto/ripemd160.h> | ||||
#include "crypto/sha1.h" | #include <crypto/sha1.h> | ||||
#include "crypto/sha256.h" | #include <crypto/sha256.h> | ||||
#include "crypto/sha512.h" | #include <crypto/sha512.h> | ||||
#include "hash.h" | #include <hash.h> | ||||
#include "random.h" | #include <random.h> | ||||
#include "uint256.h" | #include <uint256.h> | ||||
#include "utiltime.h" | #include <utiltime.h> | ||||
/* Number of bytes to hash per iteration */ | /* Number of bytes to hash per iteration */ | ||||
static const uint64_t BUFFER_SIZE = 1000 * 1000; | static const uint64_t BUFFER_SIZE = 1000 * 1000; | ||||
static void RIPEMD160(benchmark::State &state) { | static void RIPEMD160(benchmark::State &state) { | ||||
uint8_t hash[CRIPEMD160::OUTPUT_SIZE]; | uint8_t hash[CRIPEMD160::OUTPUT_SIZE]; | ||||
std::vector<uint8_t> in(BUFFER_SIZE, 0); | std::vector<uint8_t> in(BUFFER_SIZE, 0); | ||||
while (state.KeepRunning()) | while (state.KeepRunning()) | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |