aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2010-10-29 12:59:05 +0000
committerlloyd <lloyd@randombit.net>2010-10-29 12:59:05 +0000
commita8de7de2c8e3fc559d050bc3887d9fd12bac58ab (patch)
treeead7cfb9be4c8f5e453473eabf8c9f3d61c67f82
parentd678296cd1a2c1ff8efa8cedaad719bc9c444d40 (diff)
Remove use of lookups
-rw-r--r--doc/examples/decrypt.cpp8
-rw-r--r--doc/examples/encrypt.cpp8
2 files changed, 10 insertions, 6 deletions
diff --git a/doc/examples/decrypt.cpp b/doc/examples/decrypt.cpp
index 2e913d2d3..ea510c5e9 100644
--- a/doc/examples/decrypt.cpp
+++ b/doc/examples/decrypt.cpp
@@ -96,14 +96,16 @@ int main(int argc, char* argv[])
return 1;
}
- if(!have_block_cipher(algo))
+ const BlockCipher* cipher_proto = global_state().algorithm_factory().prototype_block_cipher(algo);
+
+ if(!cipher_proto)
{
std::cout << "Don't know about the block cipher \"" << algo << "\"\n";
return 1;
}
- const u32bit key_len = max_keylength_of(algo);
- const u32bit iv_len = block_size_of(algo);
+ const u32bit key_len = cipher_proto->maximum_keylength();
+ const u32bit iv_len = cipher_proto->block_size();
std::auto_ptr<PBKDF> pbkdf(get_pbkdf("PBKDF2(SHA-1)"));
diff --git a/doc/examples/encrypt.cpp b/doc/examples/encrypt.cpp
index 8f53c85e3..28017d875 100644
--- a/doc/examples/encrypt.cpp
+++ b/doc/examples/encrypt.cpp
@@ -113,14 +113,16 @@ int main(int argc, char* argv[])
try
{
- if(!have_block_cipher(algo))
+ const BlockCipher* cipher_proto = global_state().algorithm_factory().prototype_block_cipher(algo);
+
+ if(!cipher_proto)
{
std::cout << "Don't know about the block cipher \"" << algo << "\"\n";
return 1;
}
- const u32bit key_len = max_keylength_of(algo);
- const u32bit iv_len = block_size_of(algo);
+ const u32bit key_len = cipher_proto->maximum_keylength();
+ const u32bit iv_len = cipher_proto->block_size();
AutoSeeded_RNG rng;