aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/fpe.cpp
blob: 9384a0d2da2ed463d3165a57b96d6365d46a538e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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';
   }