aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/bench.cpp2
-rw-r--r--doc/examples/benchmark.cpp2
-rw-r--r--doc/examples/hash_quickly.cpp2
-rw-r--r--doc/examples/rng_test.cpp39
-rw-r--r--doc/examples/rsa_enc.cpp3
5 files changed, 13 insertions, 35 deletions
diff --git a/doc/examples/bench.cpp b/doc/examples/bench.cpp
index e20c8eea5..20e6ec40b 100644
--- a/doc/examples/bench.cpp
+++ b/doc/examples/bench.cpp
@@ -74,7 +74,7 @@ void benchmark_algo(const std::string& algo,
Algorithm_Factory& af = global_state().algorithm_factory();
std::map<std::string, double> speeds =
- algorithm_benchmark(algo, milliseconds, rng, af);
+ algorithm_benchmark(algo, af, rng, milliseconds, 16*1024);
std::cout << algo << ":";
diff --git a/doc/examples/benchmark.cpp b/doc/examples/benchmark.cpp
index 006450314..7ad1775e2 100644
--- a/doc/examples/benchmark.cpp
+++ b/doc/examples/benchmark.cpp
@@ -33,7 +33,7 @@ int main(int argc, char* argv[])
std::string algo = argv[i];
std::map<std::string, double> results =
- Botan::algorithm_benchmark(algo, ms, rng, af);
+ algorithm_benchmark(algo, af, rng, ms, 16*1024);
std::cout << algo << ":\n";
for(std::map<std::string, double>::iterator r = results.begin();
diff --git a/doc/examples/hash_quickly.cpp b/doc/examples/hash_quickly.cpp
index 1af0e8f45..bf6fe1d82 100644
--- a/doc/examples/hash_quickly.cpp
+++ b/doc/examples/hash_quickly.cpp
@@ -34,7 +34,7 @@ void set_fastest_implementation(const std::string& algo,
Botan::Algorithm_Factory& af = Botan::global_state().algorithm_factory();
std::map<std::string, double> results =
- Botan::algorithm_benchmark(algo, ms, rng, af);
+ Botan::algorithm_benchmark(algo, af, rng, ms, 16*1024);
std::string fastest_provider = "";
double best_res = 0;
diff --git a/doc/examples/rng_test.cpp b/doc/examples/rng_test.cpp
index f630d1c5a..c0d24fd80 100644
--- a/doc/examples/rng_test.cpp
+++ b/doc/examples/rng_test.cpp
@@ -6,7 +6,7 @@
#include <botan/botan.h>
#include <botan/x931_rng.h>
-#include <botan/filters.h>
+#include <botan/hex.h>
#include <botan/lookup.h>
#include <iostream>
@@ -18,29 +18,6 @@ using namespace Botan;
namespace {
-SecureVector<byte> decode_hex(const std::string& in)
- {
- SecureVector<byte> result;
-
- try {
- Botan::Pipe pipe(new Botan::Hex_Decoder);
- pipe.process_msg(in);
- result = pipe.read_all();
- }
- catch(std::exception& e)
- {
- result.clear();
- }
- return result;
- }
-
-std::string hex_encode(const byte in[], u32bit len)
- {
- Botan::Pipe pipe(new Botan::Hex_Encoder);
- pipe.process_msg(in, len);
- return pipe.read_all_as_string();
- }
-
class Fixed_Output_RNG : public RandomNumberGenerator
{
public:
@@ -56,19 +33,19 @@ class Fixed_Output_RNG : public RandomNumberGenerator
return out;
}
- void randomize(byte out[], u32bit len) throw()
+ void randomize(byte out[], size_t len) throw()
{
- for(u32bit j = 0; j != len; j++)
+ for(size_t j = 0; j != len; j++)
out[j] = random();
}
std::string name() const { return "Fixed_Output_RNG"; }
- void reseed(u32bit) {}
+ void reseed(size_t) {}
void clear() throw() {}
- void add_entropy(const byte in[], u32bit len)
+ void add_entropy(const byte in[], size_t len)
{
buf.insert(buf.end(), in, in + len);
}
@@ -91,19 +68,19 @@ void x931_tests(std::vector<std::pair<std::string, std::string> > vecs,
ANSI_X931_RNG prng(get_block_cipher(cipher),
new Fixed_Output_RNG);
- SecureVector<byte> x = decode_hex(input);
+ SecureVector<byte> x = hex_decode(input);
prng.add_entropy(x.begin(), x.size());
SecureVector<byte> output(result.size() / 2);
prng.randomize(output, output.size());
- if(decode_hex(result) != output)
+ if(hex_decode(result) != output)
std::cout << "FAIL";
else
std::cout << "PASS";
std::cout << " Seed " << input << " "
- << "Got " << hex_encode(output, output.size()) << " "
+ << "Got " << hex_encode(output) << " "
<< "Exp " << result << "\n";
}
diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp
index b21b60a5d..ac609c4b3 100644
--- a/doc/examples/rsa_enc.cpp
+++ b/doc/examples/rsa_enc.cpp
@@ -91,7 +91,8 @@ int main(int argc, char* argv[])
a problem.
*/
SymmetricKey masterkey(rng,
- std::min(32U, encryptor.maximum_input_size()));
+ std::min<size_t>(32,
+ encryptor.maximum_input_size()));
SymmetricKey cast_key = derive_key("CAST", masterkey, 16);
SymmetricKey mac_key = derive_key("MAC", masterkey, 16);