9 #ifndef CPPSECURITY_PASSWORD_HASHING_ARGON2_H
10 #define CPPSECURITY_PASSWORD_HASHING_ARGON2_H
50 uint32_t
t() const noexcept {
return _t; }
52 uint32_t
m() const noexcept {
return _m; }
54 uint32_t
p() const noexcept {
return _p; }
57 const std::string&
name()
const override {
return _name; }
58 std::string
GenerateHash(std::string_view password, std::string_view salt)
const override;
59 bool Validate(std::string_view password, std::string_view hash, std::string_view salt)
const override;
62 static std::string _name;
88 const std::string&
name()
const override {
return _name; }
89 std::string
GenerateHash(std::string_view password, std::string_view salt)
const override;
90 bool Validate(std::string_view password, std::string_view hash, std::string_view salt)
const override;
93 static std::string _name;
117 const std::string&
name()
const override {
return _name; }
118 std::string
GenerateHash(std::string_view password, std::string_view salt)
const override;
119 bool Validate(std::string_view password, std::string_view hash, std::string_view salt)
const override;
122 static std::string _name;
'Argon2d' password hashing algorithm
~Argon2dPasswordHashing()=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.
Argon2dPasswordHashing(const Argon2dPasswordHashing &)=default
Argon2dPasswordHashing(size_t hash_length=32, size_t salt_length=32, uint32_t t=3, uint32_t m=512, uint32_t p=1)
Initialize 'Argon2' password hashing with required parameters.
const std::string & name() const override
Get the password hashing algorithm name.
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.
uint32_t p() const noexcept
Get the degree of parallelism.
Argon2dPasswordHashing & operator=(Argon2dPasswordHashing &&)=default
uint32_t t() const noexcept
Get the number of iterations.
uint32_t m() const noexcept
Get the memory usage in kibibytes.
Argon2dPasswordHashing(Argon2dPasswordHashing &&)=default
Argon2dPasswordHashing & operator=(const Argon2dPasswordHashing &)=default
'Argon2i' password hashing algorithm
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.
const std::string & name() const override
Get the password hashing algorithm name.
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.
'Argon2id' password hashing algorithm
const std::string & name() const override
Get the password hashing algorithm name.
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.
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.
Password hashing interface definition.