Botan  2.11.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::Bcrypt_PBKDF Class Referencefinal

#include <bcrypt_pbkdf.h>

Inheritance diagram for Botan::Bcrypt_PBKDF:
Botan::PasswordHash

Public Member Functions

 Bcrypt_PBKDF (size_t iterations)
 
 Bcrypt_PBKDF (const Bcrypt_PBKDF &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 memory_param () const override
 
Bcrypt_PBKDFoperator= (const Bcrypt_PBKDF &)=default
 
size_t parallelism () const override
 
std::string to_string () const override
 
size_t total_memory_usage () const override
 

Detailed Description

Bcrypt-PBKDF key derivation function

Definition at line 17 of file bcrypt_pbkdf.h.

Constructor & Destructor Documentation

◆ Bcrypt_PBKDF() [1/2]

Botan::Bcrypt_PBKDF::Bcrypt_PBKDF ( size_t  iterations)
inline

Definition at line 20 of file bcrypt_pbkdf.h.

20 : m_iterations(iterations) {}
size_t iterations() const override
Definition: bcrypt_pbkdf.h:34

◆ Bcrypt_PBKDF() [2/2]

Botan::Bcrypt_PBKDF::Bcrypt_PBKDF ( const Bcrypt_PBKDF other)
default

Member Function Documentation

◆ derive_key()

void Botan::Bcrypt_PBKDF::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
overridevirtual

Derive a new key under the current Bcrypt-PBKDF parameter set

Implements Botan::PasswordHash.

Definition at line 14 of file bcrypt_pbkdf.cpp.

References Botan::bcrypt_pbkdf(), and salt_len.

17  {
18  bcrypt_pbkdf(output, output_len,
19  password, password_len,
20  salt, salt_len,
21  m_iterations);
22  }
void bcrypt_pbkdf(uint8_t output[], size_t output_len, const char *pass, size_t pass_len, const uint8_t salt[], size_t salt_len, size_t rounds)
size_t salt_len
Definition: x509_obj.cpp:26

◆ iterations()

size_t Botan::Bcrypt_PBKDF::iterations ( ) const
inlineoverridevirtual

Most password hashes have some notion of iterations.

Implements Botan::PasswordHash.

Definition at line 34 of file bcrypt_pbkdf.h.

34 { return m_iterations; }

◆ memory_param()

size_t Botan::Bcrypt_PBKDF::memory_param ( ) const
inlineoverridevirtual

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 38 of file bcrypt_pbkdf.h.

38 { return 0; }

◆ operator=()

Bcrypt_PBKDF& Botan::Bcrypt_PBKDF::operator= ( const Bcrypt_PBKDF )
default

◆ parallelism()

size_t Botan::Bcrypt_PBKDF::parallelism ( ) const
inlineoverridevirtual

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 36 of file bcrypt_pbkdf.h.

36 { return 0; }

◆ to_string()

std::string Botan::Bcrypt_PBKDF::to_string ( ) const
overridevirtual

Implements Botan::PasswordHash.

Definition at line 24 of file bcrypt_pbkdf.cpp.

References Botan::ASN1::to_string().

25  {
26  return "Bcrypt-PBKDF(" + std::to_string(m_iterations) + ")";
27  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213

◆ total_memory_usage()

size_t Botan::Bcrypt_PBKDF::total_memory_usage ( ) const
inlineoverridevirtual

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 40 of file bcrypt_pbkdf.h.

40 { return 4096; }

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