Botan 3.3.0
Crypto and TLS for C&
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
14namespace Botan {
15
16class 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*/
31std::string BOTAN_PUBLIC_API(2, 0) generate_passhash9(std::string_view password,
32 RandomNumberGenerator& rng,
33 uint16_t work_factor = 15,
34 uint8_t alg_id = 4);
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*/
41bool BOTAN_PUBLIC_API(2, 0) check_passhash9(std::string_view password, std::string_view hash);
42
43/**
44* Check if the PRF used with PBKDF2 is supported
45* @param alg_id alg_id used in generate_passhash9()
46*/
47bool BOTAN_PUBLIC_API(2, 3) is_passhash9_alg_supported(uint8_t alg_id);
48
49} // namespace Botan
50
51#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
std::string generate_passhash9(std::string_view pass, RandomNumberGenerator &rng, uint16_t work_factor, uint8_t alg_id)
Definition passhash9.cpp:46
bool check_passhash9(std::string_view pass, std::string_view hash)
Definition passhash9.cpp:75
bool is_passhash9_alg_supported(uint8_t alg_id)