CppSecurity
1.1.1.0
C++ Security Library
|
'Argon2d' password hashing algorithm More...
#include <password_hashing_argon2.h>
Public Member Functions | |
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. More... | |
Argon2dPasswordHashing (const Argon2dPasswordHashing &)=default | |
Argon2dPasswordHashing (Argon2dPasswordHashing &&)=default | |
~Argon2dPasswordHashing ()=default | |
Argon2dPasswordHashing & | operator= (const Argon2dPasswordHashing &)=default |
Argon2dPasswordHashing & | operator= (Argon2dPasswordHashing &&)=default |
uint32_t | t () const noexcept |
Get the number of iterations. More... | |
uint32_t | m () const noexcept |
Get the memory usage in kibibytes. More... | |
uint32_t | p () const noexcept |
Get the degree of parallelism. More... | |
const std::string & | name () const override |
Get the password hashing algorithm name. More... | |
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. More... | |
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. More... | |
![]() | |
PasswordHashing (size_t hash_length=32, size_t salt_length=32) | |
Initialize password hashing with required parameters. More... | |
PasswordHashing (const PasswordHashing &)=default | |
PasswordHashing (PasswordHashing &&)=default | |
virtual | ~PasswordHashing ()=default |
PasswordHashing & | operator= (const PasswordHashing &)=default |
PasswordHashing & | operator= (PasswordHashing &&)=default |
size_t | hash_length () const noexcept |
Get the strong password hash length. More... | |
size_t | salt_length () const noexcept |
Get the unique password salt length. More... | |
virtual std::string | GenerateSalt () const |
Generate the unique password salt. More... | |
virtual std::pair< std::string, std::string > | GenerateHashAndSalt (std::string_view password) const |
Generate the strong password hash and unique salt for the given user password. More... | |
virtual std::string | GenerateDigest (std::string_view password) const |
Generate the secure digest string for the given user password. More... | |
virtual std::string | GenerateEncodedDigest (std::string_view password) const |
Generate the secure Base64 digest string for the given user password. More... | |
virtual bool | ValidateDigest (std::string_view password, std::string_view digest) const |
Validate the user password over the given secure digest string. More... | |
virtual bool | ValidateEncodedDigest (std::string_view password, std::string_view digest) const |
Validate the user password over the given secure Base64 digest string. More... | |
'Argon2d' password hashing algorithm
'Argon2d' is a password-hashing function that summarizes the state of the art in the design of memory-hard functions and can be used to hash passwords for credential storage, key derivation, or other applications.
Argon2d is faster and uses data-depending memory access, which makes it highly resistant against GPU cracking attacks and suitable for applications with no threats from side-channel timing attacks (eg. cryptocurrencies).
https://github.com/P-H-C/phc-winner-argon2
Thread-safe.
Definition at line 30 of file password_hashing_argon2.h.
CppSecurity::Argon2dPasswordHashing::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.
hash_length | - Strong password hash length (default is 32) |
salt_length | - Unique password salt length (default is 32) |
t | - Number of iterations (default is 3) |
m | - Memory usage in kibibytes (default is 512) |
p | - Degree of parallelism (default is 1) |
Definition at line 21 of file password_hashing_argon2.cpp.
|
default |
|
default |
|
default |
|
overridevirtual |
Generate the strong password hash for the given user password and unique salt.
password | - User password |
salt | - Unique password salt |
Implements CppSecurity::PasswordHashing.
Reimplemented in CppSecurity::Argon2idPasswordHashing, and CppSecurity::Argon2iPasswordHashing.
Definition at line 27 of file password_hashing_argon2.cpp.
|
inlinenoexcept |
Get the memory usage in kibibytes.
Definition at line 52 of file password_hashing_argon2.h.
|
inlineoverridevirtual |
Get the password hashing algorithm name.
Implements CppSecurity::PasswordHashing.
Reimplemented in CppSecurity::Argon2idPasswordHashing, and CppSecurity::Argon2iPasswordHashing.
Definition at line 57 of file password_hashing_argon2.h.
|
default |
|
default |
|
inlinenoexcept |
Get the degree of parallelism.
Definition at line 54 of file password_hashing_argon2.h.
|
inlinenoexcept |
Get the number of iterations.
Definition at line 50 of file password_hashing_argon2.h.
|
overridevirtual |
Validate the user password over the given strong password hash and unique salt.
password | - User password |
hash | - Strong password hash |
salt | - Unique password salt |
Implements CppSecurity::PasswordHashing.
Reimplemented in CppSecurity::Argon2idPasswordHashing, and CppSecurity::Argon2iPasswordHashing.
Definition at line 36 of file password_hashing_argon2.cpp.