aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-12-24 22:10:07 +0000
committerlloyd <[email protected]>2009-12-24 22:10:07 +0000
commit6e4e7b38b837c5a5141b9dbc3aa4e5450f57865a (patch)
tree6609c32c54daa36cf137ad3efae1daab1bbb4118 /doc/examples
parent986ca995a1a8705cf4231345b44fc4617322e971 (diff)
Make fpe example output more clear as to what is going on
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/fpe.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/doc/examples/fpe.cpp b/doc/examples/fpe.cpp
index cc9ee8093..7108b3ece 100644
--- a/doc/examples/fpe.cpp
+++ b/doc/examples/fpe.cpp
@@ -117,18 +117,25 @@ int main(int argc, char* argv[])
std::string acct_name = argv[2];
std::string passwd = argv[3];
- std::cout << cc_number << ' ' << luhn_check(cc_number) << '\n';
+ std::cout << "Input was: " << cc_number << ' '
+ << luhn_check(cc_number) << '\n';
+ /**
+ * In practice something like PBKDF2 with a salt and high iteration
+ * count would be a good idea.
+ */
SymmetricKey key = sha1(passwd);
u64bit enc_cc = encrypt_cc_number(cc_number, key, acct_name);
- std::cout << enc_cc << ' ' << luhn_check(enc_cc) << '\n';
+ std::cout << "Encrypted: " << enc_cc
+ << ' ' << luhn_check(enc_cc) << '\n';
u64bit dec_cc = decrypt_cc_number(enc_cc, key, acct_name);
- std::cout << dec_cc << ' ' << luhn_check(dec_cc) << '\n';
+ std::cout << "Decrypted: " << dec_cc
+ << ' ' << luhn_check(dec_cc) << '\n';
if(dec_cc != cc_number)
- std::cout << "Something went wrong :(\n";
+ std::cout << "Something went wrong :( Bad CC checksum?\n";
}