Botan 2.19.5 Crypto and TLS for C&

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*
21* @warning The password is truncated at at most 72 characters; characters after
22* that do not have any effect on the resulting hash. To support longer
23* passwords, consider pre-hashing the password, for example by using
24* the hex encoding of SHA-256 of the password as the input to bcrypt.
25*
26* @param password the password.
27* @param rng a random number generator
28* @param work_factor how much work to do to slow down guessing attacks
29* @param version which version to emit (may be 'a', 'b', or 'y' all of which
30* have identical behavior in this implementation).
31*
32* @see https://www.usenix.org/events/usenix99/provos/provos_html/
33*/
34std::string BOTAN_PUBLIC_API(2,0) generate_bcrypt(const std::string& password,
35 RandomNumberGenerator& rng,
36 uint16_t work_factor = 12,
37 char version = 'a');
38
39/**
40* Check a previously created password hash
41* @param password the password to check against
42* @param hash the stored hash to check against
43*/
44 bool BOTAN_PUBLIC_API(2,0) check_bcrypt(const std::string& password,
45 const std::string& hash);
46
47}
48
49#endif
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan
Definition: alg_id.cpp:13
Botan::generate_bcrypt
std::string generate_bcrypt(const std::string &pass, RandomNumberGenerator &rng, uint16_t work_factor, char version)
Definition: bcrypt.cpp:137
Botan::check_bcrypt
bool check_bcrypt(const std::string &pass, const std::string &hash)
Definition: bcrypt.cpp:155
std
Definition: bigint.h:1155
hash
MechanismType hash
Definition: p11_mechanism.cpp:64