Benchmark a random equihash input.
This commit is contained in:
parent
36b1269bc3
commit
722b0117d0
|
@ -8,6 +8,8 @@
|
||||||
#include "crypto/equihash.h"
|
#include "crypto/equihash.h"
|
||||||
#include "chainparams.h"
|
#include "chainparams.h"
|
||||||
#include "pow.h"
|
#include "pow.h"
|
||||||
|
#include "sodium.h"
|
||||||
|
#include "streams.h"
|
||||||
|
|
||||||
#include "zcbenchmarks.h"
|
#include "zcbenchmarks.h"
|
||||||
|
|
||||||
|
@ -101,11 +103,22 @@ double benchmark_verify_joinsplit(const CPourTx &joinsplit)
|
||||||
|
|
||||||
double benchmark_solve_equihash()
|
double benchmark_solve_equihash()
|
||||||
{
|
{
|
||||||
const char *testing = "testing";
|
CBlock pblock;
|
||||||
|
CEquihashInput I{pblock};
|
||||||
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
|
ss << I;
|
||||||
|
|
||||||
Equihash eh {Params(CBaseChainParams::MAIN).EquihashN(), Params(CBaseChainParams::MAIN).EquihashK()};
|
Equihash eh {Params(CBaseChainParams::MAIN).EquihashN(), Params(CBaseChainParams::MAIN).EquihashK()};
|
||||||
crypto_generichash_blake2b_state eh_state;
|
crypto_generichash_blake2b_state eh_state;
|
||||||
eh.InitialiseState(eh_state);
|
eh.InitialiseState(eh_state);
|
||||||
crypto_generichash_blake2b_update(&eh_state, (const unsigned char*)testing, strlen(testing));
|
crypto_generichash_blake2b_update(&eh_state, (unsigned char*)&ss[0], ss.size());
|
||||||
|
|
||||||
|
uint256 nonce;
|
||||||
|
randombytes_buf(nonce.begin(), 32);
|
||||||
|
crypto_generichash_blake2b_update(&eh_state,
|
||||||
|
nonce.begin(),
|
||||||
|
nonce.size());
|
||||||
|
|
||||||
timer_start();
|
timer_start();
|
||||||
eh.BasicSolve(eh_state);
|
eh.BasicSolve(eh_state);
|
||||||
return timer_stop();
|
return timer_stop();
|
||||||
|
|
Loading…
Reference in New Issue