aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/passhash.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-08 03:15:34 +0000
committerlloyd <[email protected]>2008-10-08 03:15:34 +0000
commit8343194ea16297eb3e51627eb3f35c529850c6f8 (patch)
tree22aeac286d2cbbdbe8790b08e4187d369f3c4efb /doc/examples/passhash.cpp
parentbe5e48619a63559ad777396d69cc8cc95ef0af15 (diff)
Update examples for recent API changes
Diffstat (limited to 'doc/examples/passhash.cpp')
-rw-r--r--doc/examples/passhash.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/examples/passhash.cpp b/doc/examples/passhash.cpp
index 6df4a4e1d..78ced1c66 100644
--- a/doc/examples/passhash.cpp
+++ b/doc/examples/passhash.cpp
@@ -1,5 +1,7 @@
#include <botan/botan.h>
-#include <botan/pkcs5.h>
+#include <botan/pbkdf2.h>
+#include <botan/hmac.h>
+#include <botan/sha160.h>
#include <iostream>
#include <memory>
@@ -49,7 +51,7 @@ int main(int argc, char* argv[])
std::string password_hash(const std::string& pass,
RandomNumberGenerator& rng)
{
- PKCS5_PBKDF2 kdf("SHA-1");
+ PKCS5_PBKDF2 kdf(new HMAC(new SHA_160));
kdf.set_iterations(10000);
kdf.new_random_salt(rng, 6); // 48 bits
@@ -72,7 +74,7 @@ bool password_hash_ok(const std::string& pass, const std::string& hash)
SecureVector<byte> hash_bin = pipe.read_all();
- PKCS5_PBKDF2 kdf("SHA-1");
+ PKCS5_PBKDF2 kdf(new HMAC(new SHA_160));
kdf.set_iterations(10000);
kdf.change_salt(hash_bin, 6);