aboutsummaryrefslogtreecommitdiffstats
path: root/src/benchmark/benchmark.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-13 16:01:57 +0000
committerlloyd <[email protected]>2009-10-13 16:01:57 +0000
commit9268a0455a07d31a66364aa5b7594bd75250b466 (patch)
tree63b683ca95448ce083981d002d870a569c2c98a1 /src/benchmark/benchmark.cpp
parent3bc2bb0461b1b40466821daf0061eab769621eab (diff)
parent5318b944acc2a5fa6d445784c710f37c793ff90b (diff)
propagate from branch 'net.randombit.botan.1_8' (head c5ae189464f6ef16e3ce73ea7c563412460d76a3)
to branch 'net.randombit.botan' (head e2b95b6ad31c7539cf9ac0ebddb1d80bf63b5b21)
Diffstat (limited to 'src/benchmark/benchmark.cpp')
-rw-r--r--src/benchmark/benchmark.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp
index 01e3b94f3..6e61baa59 100644
--- a/src/benchmark/benchmark.cpp
+++ b/src/benchmark/benchmark.cpp
@@ -11,7 +11,6 @@
#include <botan/stream_cipher.h>
#include <botan/hash.h>
#include <botan/mac.h>
-#include <botan/util.h>
#include <memory>
namespace Botan {
@@ -55,10 +54,11 @@ bench_block_cipher(BlockCipher* block_cipher,
const u32bit in_blocks = buf_len / block_cipher->BLOCK_SIZE;
+ block_cipher->set_key(buf, block_cipher->MAXIMUM_KEYLENGTH);
+
while(nanoseconds_used < nanoseconds_max)
{
- for(u32bit i = 0; i != in_blocks; ++i)
- block_cipher->encrypt(buf + block_cipher->BLOCK_SIZE * i);
+ block_cipher->encrypt_n(buf, buf, in_blocks);
++reps;
nanoseconds_used = timer.clock() - start;
@@ -81,6 +81,8 @@ bench_stream_cipher(StreamCipher* stream_cipher,
u64bit nanoseconds_used = 0;
u64bit reps = 0;
+ stream_cipher->set_key(buf, stream_cipher->MAXIMUM_KEYLENGTH);
+
while(nanoseconds_used < nanoseconds_max)
{
stream_cipher->encrypt(buf, buf_len);