Botan 3.6.1
Crypto and TLS for C&
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
13namespace Botan {
14
15class 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*/
21std::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*/
42bool 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
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
bool argon2_check_pwhash(const char *password, size_t password_len, std::string_view input_hash)
Definition argon2fmt.cpp:77
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