Botan
3.9.0
Crypto and TLS for C&
src
lib
passhash
argon2fmt
argon2fmt.h
Go to the documentation of this file.
1
/**
2
* (C) 2018,2019,2021 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#ifndef BOTAN_ARGON2_FMT_H_
8
#define BOTAN_ARGON2_FMT_H_
9
10
#include <botan/types.h>
11
#include <string>
12
13
namespace
Botan
{
14
15
class
RandomNumberGenerator
;
16
17
/**
18
* Generate an Argon2 hash of the specified @p password. The @p y parameter
19
* specifies the variant: 0 for Argon2d, 1 for Argon2i, and 2 for Argon2id.
20
*/
21
std::string
BOTAN_PUBLIC_API
(2, 11)
argon2_generate_pwhash
(const
char
* password,
22
size_t
password_len,
23
RandomNumberGenerator
& rng,
24
size_t
p,
25
size_t
M,
26
size_t
t,
27
uint8_t y = 2,
28
size_t
salt_len = 16,
29
size_t
output_len = 32);
30
31
/**
32
* Check a previously created password hash
33
*
34
* Verify an Argon2 password @p hash against the provided @p password. Returns
35
* false if the input hash seems malformed or if the computed hash does not
36
* match.
37
*
38
* @param password the password to check against
39
* @param password_len the length of password
40
* @param hash the stored hash to check against
41
*/
42
bool
BOTAN_PUBLIC_API
(2, 11)
argon2_check_pwhash
(const
char
* password,
size_t
password_len, std::string_view hash);
43
44
}
// namespace Botan
45
46
#endif
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition
api.h:21
Botan::RandomNumberGenerator
Definition
rng.h:30
Botan
Definition
alg_id.cpp:13
Botan::argon2_check_pwhash
bool argon2_check_pwhash(const char *password, size_t password_len, std::string_view input_hash)
Definition
argon2fmt.cpp:77
Botan::argon2_generate_pwhash
std::string argon2_generate_pwhash(const char *password, size_t password_len, RandomNumberGenerator &rng, size_t p, size_t M, size_t t, uint8_t y, size_t salt_len, size_t output_len)
Definition
argon2fmt.cpp:42
Generated by
1.14.0