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::PasswordHash Class Referenceabstract

`#include <pwdhash.h>`

Inheritance diagram for Botan::PasswordHash:

## Public Member Functions
virtual 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 =0
virtual size_t | iterations () const =0
virtual size_t | memory_param () const
virtual size_t | parallelism () const
virtual std::string | to_string () const =0
virtual size_t | total_memory_usage () const
virtual | ~PasswordHash ()=default

## Detailed Description

Base class for password based key derivation functions.

Converts a password into a key using a salt and iterated hashing to make brute force attacks harder.

Definition at line 24 of file pwdhash.h.

## Constructor & Destructor Documentation

virtual Botan::PasswordHash::~PasswordHash | ( |  | ) |
| virtual default

## Member Function Documentation

virtual void Botan::PasswordHash::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
| pure virtual

Derive a key from a password

Parameters

  out | buffer to store the derived key, must be of out_len bytes
  out_len | the desired length of the key to produce
  password | the password to derive the key from
  password_len | the length of password in bytes
  salt | a randomly chosen salt
  salt_len | length of salt in bytes

This function is const, but is not thread safe. Different threads should either use unique objects, or serialize all access.

Implemented in Botan::RFC4880_S2K, Botan::PBKDF2, Botan::Argon2, Botan::Scrypt, and Botan::Bcrypt_PBKDF.

virtual size_t Botan::PasswordHash::iterations | ( |  | ) | const
| pure virtual

Most password hashes have some notion of iterations.

Implemented in Botan::RFC4880_S2K, Botan::PBKDF2, Botan::Argon2, Botan::Scrypt, and Botan::Bcrypt_PBKDF.

virtual size_t Botan::PasswordHash::memory_param | ( |  | ) | const
| inline virtual

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

Reimplemented in Botan::Argon2, Botan::Scrypt, and Botan::Bcrypt_PBKDF.

Definition at line 40 of file pwdhash.h.

40 { return 0; }

virtual size_t Botan::PasswordHash::parallelism | ( |  | ) | const
| inline 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 in Botan::Argon2, Botan::Scrypt, and Botan::Bcrypt_PBKDF.

Definition at line 50 of file pwdhash.h.

50 { return 0; }

virtual std::string Botan::PasswordHash::to_string | ( |  | ) | const
| pure virtual

Implemented in Botan::RFC4880_S2K, Botan::PBKDF2, Botan::Argon2, Botan::Scrypt, and Botan::Bcrypt_PBKDF.

virtual size_t Botan::PasswordHash::total_memory_usage | ( |  | ) | const
| inline 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 in Botan::Argon2, Botan::Scrypt, and Botan::Bcrypt_PBKDF.

Definition at line 59 of file pwdhash.h.

59 { return 0; }

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

- src/lib/pbkdf/pwdhash.h