aboutsummaryrefslogtreecommitdiffstats
path: root/src/benchmark/benchmark.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-28 22:55:12 +0000
committerlloyd <[email protected]>2009-10-28 22:55:12 +0000
commit3623be3fd05d890309cc3da4b3a1e319e357df65 (patch)
tree34ca43fcf8a7007cc01a3919f63e9ab6763cb673 /src/benchmark/benchmark.cpp
parentfc1e61500e77fcabe67e6d2607810c1ba071bbdd (diff)
parent9462f875b13a321f42a127166d49670ca04afcde (diff)
propagate from branch 'net.randombit.botan.1_8' (head 3158f8272a3582dd44dfb771665eb71f7d005339)
to branch 'net.randombit.botan' (head bf629b13dd132b263e76a72b7eca0f7e4ab19aac)
Diffstat (limited to 'src/benchmark/benchmark.cpp')
-rw-r--r--src/benchmark/benchmark.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp
index 01e3b94f3..41c9cd10c 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,9 +81,11 @@ 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);
+ stream_cipher->cipher1(buf, buf_len);
++reps;
nanoseconds_used = timer.clock() - start;
}