aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
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';
+ }