diff options
author | Jack Lloyd <jack@randombit.net> | 2018-05-22 22:43:58 -0400 |
---|---|---|
committer | Jack Lloyd <jack@randombit.net> | 2018-05-22 22:43:58 -0400 |
commit | c97b3406f544ba98ae9b579d711b887b247032a7 (patch) | |
tree | f91a9062c4e3d91aad34111a5498595c03acadad /src/cli | |
parent | b57839c5a303f4c1ba9b49f489dbdd12d26023a5 (diff) |
Test speed of different scrypt params
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/speed.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 9a7a13794..d586e68ee 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -2150,20 +2150,34 @@ class Speed final : public Command void bench_scrypt(const std::string& /*provider*/, std::chrono::milliseconds msec) { - std::unique_ptr<Timer> scrypt_timer = make_timer("scrypt"); - uint8_t out[64]; - uint8_t salt[8] = { 0 }; - - while(scrypt_timer->under(msec)) + for(size_t N : { 8192, 16384, 32768 }) { - scrypt_timer->run([&] { - Botan::scrypt(out, sizeof(out), "password", - salt, sizeof(salt), 16384, 8, 1); - }); + for(size_t r : { 1, 8 }) + { + for(size_t p : { 1, 2, 4 }) + { + std::unique_ptr<Timer> scrypt_timer = make_timer( + "scrypt-" + std::to_string(N) + "-" + + std::to_string(r) + "-" + std::to_string(p)); + + uint8_t out[64]; + uint8_t salt[8]; + rng().randomize(salt, sizeof(salt)); + + while(scrypt_timer->under(msec)) + { + scrypt_timer->run([&] { + Botan::scrypt(out, sizeof(out), "password", + salt, sizeof(salt), N, r, p); + }); + } + + record_result(scrypt_timer); + } + } } - record_result(scrypt_timer); } #endif |