CppSecurity 1.1.2.0
C++ Security Library
Loading...
Searching...
No Matches
password_hashing_pbkdf2.h
Go to the documentation of this file.
1
9#ifndef CPPSECURITY_PASSWORD_HASHING_PBKDF2_H
10#define CPPSECURITY_PASSWORD_HASHING_PBKDF2_H
11
12#include "password_hashing.h"
13
14namespace CppSecurity {
15
17enum class PBKDF2
18{
19 HMAC_SHA1,
22};
23
25
30template <class TOutputStream>
31TOutputStream& operator<<(TOutputStream& stream, PBKDF2 algorithm);
32
34
48{
49public:
51
61
64
66 PBKDF2 algorithm() const noexcept { return _algorithm; }
68 size_t iterations() const noexcept { return _iterations; }
69
70 // Implementation of PasswordHashing
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;
74
75private:
76 static std::string _name;
77 PBKDF2 _algorithm;
78 size_t _iterations;
79};
80
83} // namespace CppSecurity
84
86
87#endif // CPPSECURITY_PASSWORD_HASHING_PBKDF2_H
'PBKDF2' password hashing algorithm
PBKDF2PasswordHashing(PBKDF2PasswordHashing &&)=default
PBKDF2PasswordHashing & operator=(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)
Definition cipher.inl:12
PBKDF2
'PBKDF2' algorithm
@ HMAC_SHA1
HMAC-SHA1.
@ HMAC_SHA256
HMAC-SHA256.
@ HMAC_SHA512
HMAC-SHA512.
Password hashing interface definition.
'PBKDF2' password hashing algorithm inline implementation