aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/passhash.cpp
diff options
context:
space:
mode:
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);