Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::Argon2 Class Referencefinal

`#include <argon2.h>`

Inheritance diagram for Botan::Argon2:

## Public Member Functions
| Argon2 (uint8_t family, size_t M, size_t t, size_t p)
| Argon2 (const Argon2 &other)=default
void | derive_key (uint8_t out[], size_t out_len, const char *password, size_t password_len, const uint8_t salt[], size_t salt_len) const override
size_t | iterations () const override
size_t | M () const
size_t | memory_param () const override
Argon2 & | operator= (const Argon2 &)=default
size_t | p () const
size_t | parallelism () const override
size_t | t () const
std::string | to_string () const override
size_t | total_memory_usage () const override

## Detailed Description

Argon2 key derivation function

Definition at line 21 of file argon2.h.

## Constructor & Destructor Documentation

Botan::Argon2::Argon2 | ( | uint8_t | family,
|  | size_t | M,
|  | size_t | t,
|  | size_t | p
| ) |  |

Definition at line 14 of file argon2pwhash.cpp.

14 :
15 m_family(family),
16 m_M(M),
17 m_t(t),
18 m_p(p)
19 {}
Botan::Argon2::t
size_t t() const
Definition: argon2.h:39
Botan::Argon2::M
size_t M() const
Definition: argon2.h:38
Botan::Argon2::p
size_t p() const
Definition: argon2.h:40

Botan::Argon2::Argon2 | ( | const Argon2 & | other | ) |
| default

## Member Function Documentation

void Botan::Argon2::derive_key | ( | uint8_t | out[],
|  | size_t | out_len,
|  | const char * | password,
|  | size_t | password_len,
|  | const uint8_t | salt[],
|  | size_t | salt_len
| ) |  | const
| override virtual

Derive a new key under the current Argon2 parameter set

Implements Botan::PasswordHash.

Definition at line 21 of file argon2pwhash.cpp.

References Botan::argon2().

24 {
25 argon2(output, output_len,
26 password, password_len,
27 salt, salt_len,
28 nullptr, 0,
29 nullptr, 0,
30 m_family, m_p, m_M, m_t);
31 }
salt_len
size_t salt_len
Definition: x509_obj.cpp:25
Botan::argon2
void argon2(uint8_t output[], size_t output_len, const char *password, size_t password_len, const uint8_t salt[], size_t salt_len, const uint8_t key[], size_t key_len, const uint8_t ad[], size_t ad_len, uint8_t mode, size_t threads, size_t M, size_t t)
Definition: argon2.cpp:410

size_t Botan::Argon2::iterations | ( |  | ) | const
| inline override virtual

Most password hashes have some notion of iterations.

Implements Botan::PasswordHash.

Definition at line 42 of file argon2.h.

42 { return t(); }
Botan::Argon2::t
size_t t() const
Definition: argon2.h:39

size_t Botan::Argon2::M | ( |  | ) | const
| inline

Definition at line 38 of file argon2.h.

38 { return m_M; }

size_t Botan::Argon2::memory_param | ( |  | ) | const
| inline override virtual

Some password hashing algorithms have a parameter which controls how much memory is used. If not supported by some algorithm, returns 0.

Reimplemented from Botan::PasswordHash.

Definition at line 46 of file argon2.h.

46 { return M(); }
Botan::Argon2::M
size_t M() const
Definition: argon2.h:38

Argon2& Botan::Argon2::operator= | ( | const Argon2 & |  | ) |
| default

size_t Botan::Argon2::p | ( |  | ) | const
| inline

Definition at line 40 of file argon2.h.

References m_p.

40 { return m_p; }

size_t Botan::Argon2::parallelism | ( |  | ) | const
| inline override virtual

Some password hashing algorithms have a parallelism parameter. If the algorithm does not support this notion, then the function returns zero. This allows distinguishing between a password hash which just does not support parallel operation, vs one that does support parallel operation but which has been configured to use a single lane.

Reimplemented from Botan::PasswordHash.

Definition at line 44 of file argon2.h.

44 { return p(); }
Botan::Argon2::p
size_t p() const
Definition: argon2.h:40

size_t Botan::Argon2::t | ( |  | ) | const
| inline

Definition at line 39 of file argon2.h.

39 { return m_t; }

std::string Botan::Argon2::to_string | ( |  | ) | const
| override virtual

Implements Botan::PasswordHash.

Definition at line 52 of file argon2pwhash.cpp.

References Botan::ASN1::to_string().

53 {
54 return argon2_family_name(m_family) + "(" +
55 std::to_string(m_M) + "," +
56 std::to_string(m_t) + "," +
57 std::to_string(m_p) + ")";
58 }
Botan::ASN1::to_string
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213

size_t Botan::Argon2::total_memory_usage | ( |  | ) | const
| inline override virtual

Returns an estimate of the total memory usage required to perform this key derivation.

If this algorithm uses a small and constant amount of memory, with no effort made towards being memory hard, this function returns 0.

Reimplemented from Botan::PasswordHash.

Definition at line 48 of file argon2.h.

48 { return M() * 1024; }
Botan::Argon2::M
size_t M() const
Definition: argon2.h:38

The documentation for this class was generated from the following files:

- src/lib/pbkdf/argon2/argon2.h
- src/lib/pbkdf/argon2/argon2pwhash.cpp