diff options
Diffstat (limited to 'src/cli/speed.cpp')
-rw-r--r-- | src/cli/speed.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index ffe10844e..c767b2a55 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -597,13 +597,14 @@ class Speed final : public Command for(auto src : srcs.enabled_sources()) { - size_t entropy_bits = 0, samples = 0; + double entropy_bits = 0.0; + size_t samples = 0; std::vector<size_t> entropy; Botan::Entropy_Accumulator accum( - [&](const uint8_t buf[], size_t buf_len, size_t buf_entropy) -> bool { - entropy.insert(entropy.end(), buf, buf + buf_len); - entropy_bits += buf_entropy; + [&](const uint8_t buf[], size_t buf_len, double buf_entropy) -> bool { + entropy.insert(entropy.end(), buf, buf + buf_len); + entropy_bits += buf_entropy; samples += 1; return (samples > 1024 || entropy_bits > 1024 || clock::now() > deadline); }); @@ -623,8 +624,9 @@ class Speed final : public Command } #endif - output() << "Entropy source " << src << " output " << entropy.size() - << " bytes in " << timer.milliseconds() << " ms"; + output() << "Entropy source " << src << " output " << entropy.size() << " bytes" + << " estimated entropy " << entropy_bits + << " in " << timer.milliseconds() << " ms"; #if defined(BOTAN_HAS_COMPRESSION) if(compressed.size() > 0) |