Botan  2.4.0
Crypto and TLS for C++11
passhash9.h
Go to the documentation of this file.
1 /*
2 * Passhash9 Password Hashing
3 * (C) 2010 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_PASSHASH9_H_
9 #define BOTAN_PASSHASH9_H_
10 
11 #include <botan/types.h>
12 #include <string>
13 
14 namespace Botan {
15 
16 class RandomNumberGenerator;
17 
18 /**
19 * Create a password hash using PBKDF2
20 * @param password the password
21 * @param rng a random number generator
22 * @param work_factor how much work to do to slow down guessing attacks
23 * @param alg_id specifies which PRF to use with PBKDF2
24 * 0 is HMAC(SHA-1)
25 * 1 is HMAC(SHA-256)
26 * 2 is CMAC(Blowfish)
27 * 3 is HMAC(SHA-384)
28 * 4 is HMAC(SHA-512)
29 * all other values are currently undefined
30 */
31 std::string BOTAN_PUBLIC_API(2,0) generate_passhash9(const std::string& password,
32  RandomNumberGenerator& rng,
33  uint16_t work_factor = 10,
34  uint8_t alg_id = 1);
35 
36 /**
37 * Check a previously created password hash
38 * @param password the password to check against
39 * @param hash the stored hash to check against
40 */
41 bool BOTAN_PUBLIC_API(2,0) check_passhash9(const std::string& password,
42  const std::string& hash);
43 
44 /**
45 * Check if the PRF used with PBKDF2 is supported
46 * @param alg_id alg_id used in generate_passhash9()
47 */
48 bool BOTAN_PUBLIC_API(2,3) is_passhash9_alg_supported(uint8_t alg_id);
49 
50 }
51 
52 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:635
std::string generate_passhash9(const std::string &pass, RandomNumberGenerator &rng, uint16_t work_factor, uint8_t alg_id)
Definition: passhash9.cpp:44
bool check_passhash9(const std::string &pass, const std::string &hash)
Definition: passhash9.cpp:76
Definition: alg_id.cpp:13
bool is_passhash9_alg_supported(uint8_t alg_id)
Definition: passhash9.cpp:131
MechanismType hash