aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-11-13 14:10:35 +0000
committerlloyd <[email protected]>2009-11-13 14:10:35 +0000
commite0f6da3b507cfb4004e9e31b529e09795741a620 (patch)
treeccc9921bcb13a8ce3dd33a28c5f6712b128f2103 /doc
parente7dae73354be4da502f1d5fc22984fbbf6766769 (diff)
parentb2c5645c05b04056b2b3516dd01d608d49163999 (diff)
propagate from branch 'net.randombit.botan' (head 586495311cff277e7a24b4116c987b79036d94e6)
to branch 'net.randombit.botan.fpe' (head c6e8324b12e509ac1303078d5e716f08c53acff5)
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';
+ }