aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/bench.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-09-15 14:14:32 +0000
committerlloyd <[email protected]>2009-09-15 14:14:32 +0000
commit7f6a017a61fc6ef97d9d7b37236df52d6170e7d6 (patch)
tree79873bd67321ba54207a964de94ceeda54c568b7 /doc/examples/bench.cpp
parent467cfb8b8a31eecfaf63c30cfa13b69bef4cd566 (diff)
Add an implementation of Blue Midnight Wish (512 bit version only)
Diffstat (limited to 'doc/examples/bench.cpp')
-rw-r--r--doc/examples/bench.cpp43
1 files changed, 20 insertions, 23 deletions
diff --git a/doc/examples/bench.cpp b/doc/examples/bench.cpp
index 37ef1104d..5bb8e27bf 100644
--- a/doc/examples/bench.cpp
+++ b/doc/examples/bench.cpp
@@ -7,26 +7,6 @@ using namespace Botan;
#include <iostream>
-double best_speed(const std::string& algorithm,
- u32bit milliseconds,
- RandomNumberGenerator& rng,
- Timer& timer)
- {
- std::map<std::string, double> speeds =
- algorithm_benchmark(algorithm, milliseconds,
- timer, rng,
- global_state().algorithm_factory());
-
- double best_time = 0;
-
- for(std::map<std::string, double>::const_iterator i = speeds.begin();
- i != speeds.end(); ++i)
- if(i->second > best_time)
- best_time = i->second;
-
- return best_time;
- }
-
const std::string algos[] = {
"AES-128",
"AES-192",
@@ -62,7 +42,6 @@ const std::string algos[] = {
"FORK-256",
"GOST-34.11",
"HAS-160",
- "HAS-V",
"MD2",
"MD4",
"MD5",
@@ -89,10 +68,28 @@ int main()
AutoSeeded_RNG rng;
Default_Benchmark_Timer timer;
+ Algorithm_Factory& af = global_state().algorithm_factory();
+
+ std::vector<std::string> providers = af.providers_of("Serpent");
+ for(size_t i = 0; i != providers.size(); ++i)
+ std::cout << providers[i].c_str() << "\n";
+
+
+
for(u32bit i = 0; algos[i] != ""; ++i)
{
std::string algo = algos[i];
- std::cout << algo << ' '
- << best_speed(algo, milliseconds, rng, timer) << "\n";
+
+ std::map<std::string, double> speeds =
+ algorithm_benchmark(algos[i], milliseconds, timer, rng, af);
+
+ std::cout << algo << ":";
+
+ for(std::map<std::string, double>::const_iterator i = speeds.begin();
+ i != speeds.end(); ++i)
+ {
+ std::cout << " " << i->second << " [" << i->first << "]";
+ }
+ std::cout << "\n";
}
}