9#ifndef CPPSECURITY_PASSWORD_HASHING_PBKDF2_H
10#define CPPSECURITY_PASSWORD_HASHING_PBKDF2_H
30template <
class TOutputStream>
68 size_t iterations() const noexcept {
return _iterations; }
71 const std::string&
name()
const override {
return _name; }
72 std::string
GenerateHash(std::string_view password, std::string_view salt)
const override;
73 bool Validate(std::string_view password, std::string_view hash, std::string_view salt)
const override;
76 static std::string _name;
'PBKDF2' password hashing algorithm
PBKDF2PasswordHashing(PBKDF2PasswordHashing &&)=default
PBKDF2PasswordHashing & operator=(PBKDF2PasswordHashing &&)=default
~PBKDF2PasswordHashing()=default
size_t iterations() const noexcept
Get the count of 'PBKDF2' iterations.
const std::string & name() const override
Get the password hashing algorithm name.
PBKDF2 algorithm() const noexcept
Get the 'PBKDF2' algorithm.
PBKDF2PasswordHashing(const PBKDF2PasswordHashing &)=default
std::string GenerateHash(std::string_view password, std::string_view salt) const override
Generate the strong password hash for the given user password and unique salt.
PBKDF2PasswordHashing & operator=(const PBKDF2PasswordHashing &)=default
bool Validate(std::string_view password, std::string_view hash, std::string_view salt) const override
Validate the user password over the given strong password hash and unique salt.
Password hashing interface.
size_t salt_length() const noexcept
Get the unique password salt length.
size_t hash_length() const noexcept
Get the strong password hash length.
TOutputStream & operator<<(TOutputStream &stream, CipherAlgorithm algorithm)
@ HMAC_SHA256
HMAC-SHA256.
@ HMAC_SHA512
HMAC-SHA512.
Password hashing interface definition.
'PBKDF2' password hashing algorithm inline implementation