Botan  2.4.0
Crypto and TLS for C++11
bcrypt.h
Go to the documentation of this file.
1 /*
2 * Bcrypt Password Hashing
3 * (C) 2011 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_BCRYPT_H_
9 #define BOTAN_BCRYPT_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 Bcrypt
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 *
24 * @see https://www.usenix.org/events/usenix99/provos/provos_html/
25 */
26 std::string BOTAN_PUBLIC_API(2,0) generate_bcrypt(const std::string& password,
27  RandomNumberGenerator& rng,
28  uint16_t work_factor = 10);
29 
30 /**
31 * Check a previously created password hash
32 * @param password the password to check against
33 * @param hash the stored hash to check against
34 */
35 bool BOTAN_PUBLIC_API(2,0) check_bcrypt(const std::string& password,
36  const std::string& hash);
37 
38 }
39 
40 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:635
std::string generate_bcrypt(const std::string &pass, RandomNumberGenerator &rng, uint16_t work_factor)
Definition: bcrypt.cpp:126
Definition: alg_id.cpp:13
bool check_bcrypt(const std::string &pass, const std::string &hash)
Definition: bcrypt.cpp:133
MechanismType hash