aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/fpe.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-18 20:32:36 +0000
committerlloyd <[email protected]>2012-05-18 20:32:36 +0000
commitc691561f3198f481c13457433efbccc1c9fcd898 (patch)
treea45ea2c5a30e0cb009fbcb68a61ef39332ff790c /doc/examples/fpe.cpp
parentd76700f01c7ecac5633edf75f8d7408b46c5dbac (diff)
Fairly huge update that replaces the old secmem types with std::vector
using a custom allocator. Currently our allocator just does new/delete with a memset before deletion, and the mmap and mlock allocators have been removed.
Diffstat (limited to 'doc/examples/fpe.cpp')
-rw-r--r--doc/examples/fpe.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/examples/fpe.cpp b/doc/examples/fpe.cpp
index 029a761e7..8f5eaca9f 100644
--- a/doc/examples/fpe.cpp
+++ b/doc/examples/fpe.cpp
@@ -55,11 +55,11 @@ u64bit cc_derank(u64bit cc_number)
/*
* Use the SHA-1 hash of the account name or ID as a tweak
*/
-SecureVector<byte> sha1(const std::string& acct_name)
+std::vector<byte> sha1(const std::string& acct_name)
{
SHA_160 hash;
hash.update(acct_name);
- return hash.final();
+ return unlock(hash.final());
}
u64bit encrypt_cc_number(u64bit cc_number,
@@ -123,7 +123,7 @@ int main(int argc, char* argv[])
* In practice something like PBKDF2 with a salt and high iteration
* count would be a good idea.
*/
- SymmetricKey key = sha1(passwd);
+ SymmetricKey key(sha1(passwd));
u64bit enc_cc = encrypt_cc_number(cc_number, key, acct_name);