aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-11-06 20:39:55 +0000
committerlloyd <[email protected]>2009-11-06 20:39:55 +0000
commitb2c5645c05b04056b2b3516dd01d608d49163999 (patch)
treed500b5283b7e9b4884a599c3175f257515a6c7a4 /doc
parentb5d4cf01a893718c8796652f3cf0f68b867bab94 (diff)
parenta6177d3af54437375c752b8046230b7fb98c8563 (diff)
propagate from branch 'net.randombit.botan' (head 0cb3295ee48403828c652064fbf72ddb6edbe13c)
to branch 'net.randombit.botan.fpe' (head 954d50f368db4be7d98c5c32c474bc54ec5ea7f3)
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/fpe.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/examples/fpe.cpp b/doc/examples/fpe.cpp
new file mode 100644
index 000000000..9384a0d2d
--- /dev/null
+++ b/doc/examples/fpe.cpp
@@ -0,0 +1,22 @@
+#include <botan/fpe.h>
+#include <botan/init.h>
+
+using namespace Botan;
+
+#include <iostream>
+
+int main()
+ {
+ LibraryInitializer init;
+
+ BigInt n = 100000000;
+ BigInt x = 49604394;
+
+ SymmetricKey key("AAAAAAAAAAAAAAAA");
+ MemoryVector<byte> tweak(4);
+
+ BigInt c = fpe_encrypt(n, x, key, tweak);
+ BigInt p = fpe_decrypt(n, c, key, tweak);
+
+ std::cout << c << ' ' << p << ' ' << x << '\n';
+ }