aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-01-30 14:18:15 -0500
committerJack Lloyd <[email protected]>2018-01-30 14:18:15 -0500
commit04694e1da112c213f294ed4ad0e1e21dd231a06e (patch)
tree158d45d0b49d92f6889b8d157a6702ac830de789 /src
parentdffb5e7f8b5736e3c1c84a4b2bb656a70b26630e (diff)
For hash/mac speed tests finalize the computation under the timer
Otherwise this misses the perf difference between SHAKE-128(512) and SHAKE-128(5120000) all the extra computation happens in the final function.
Diffstat (limited to 'src')
-rw-r--r--src/cli/speed.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index 73b4b6a06..04b8cc3ff 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -1054,12 +1054,14 @@ class Speed final : public Command
const std::chrono::milliseconds runtime,
const std::vector<size_t>& buf_sizes)
{
+ std::vector<uint8_t> output(hash.output_length());
+
for(auto buf_size : buf_sizes)
{
Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size);
Timer timer(hash.name(), buffer.size(), "hash", provider, buf_size);
- timer.run_until_elapsed(runtime, [&]() { hash.update(buffer); });
+ timer.run_until_elapsed(runtime, [&]() { hash.update(buffer); hash.final(output.data()); });
record_result(timer);
}
}
@@ -1072,6 +1074,8 @@ class Speed final : public Command
const std::chrono::milliseconds runtime,
const std::vector<size_t>& buf_sizes)
{
+ std::vector<uint8_t> output(mac.output_length());
+
for(auto buf_size : buf_sizes)
{
Botan::secure_vector<uint8_t> buffer = rng().random_vec(buf_size);
@@ -1082,6 +1086,7 @@ class Speed final : public Command
Timer timer(mac.name(), buffer.size(), "mac", provider, buf_size);
timer.run_until_elapsed(runtime, [&]() { mac.update(buffer); });
+ timer.run([&]() { mac.final(output.data()); });
record_result(timer);
}
}