CppSecurity  1.1.1.0
C++ Security Library
Public Member Functions | List of all members
CppSecurity::Argon2idPasswordHashing Class Reference

'Argon2id' password hashing algorithm More...

#include <password_hashing_argon2.h>

Inheritance diagram for CppSecurity::Argon2idPasswordHashing:
CppSecurity::Argon2dPasswordHashing CppSecurity::PasswordHashing

Public Member Functions

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...
 
 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
 
- Public Member Functions inherited from 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. More...
 
 Argon2dPasswordHashing (const Argon2dPasswordHashing &)=default
 
 Argon2dPasswordHashing (Argon2dPasswordHashing &&)=default
 
 ~Argon2dPasswordHashing ()=default
 
Argon2dPasswordHashingoperator= (const Argon2dPasswordHashing &)=default
 
Argon2dPasswordHashingoperator= (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...
 
- Public Member Functions inherited from CppSecurity::PasswordHashing
 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
 
PasswordHashingoperator= (const PasswordHashing &)=default
 
PasswordHashingoperator= (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...
 

Detailed Description

'Argon2id' password hashing algorithm

'Argon2id' 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.

Argon2id is a hybrid of Argon2i and Argon2d, using a combination of data-depending and data-independent memory accesses, which gives some of Argon2i's resistance to side-channel cache timing attacks and much of Argon2d's resistance to GPU cracking attacks.

https://github.com/P-H-C/phc-winner-argon2

Thread-safe.

Definition at line 111 of file password_hashing_argon2.h.

Member Function Documentation

◆ Argon2dPasswordHashing() [1/3]

CppSecurity::Argon2dPasswordHashing::Argon2dPasswordHashing
default

◆ Argon2dPasswordHashing() [2/3]

CppSecurity::Argon2dPasswordHashing::Argon2dPasswordHashing
default

◆ Argon2dPasswordHashing() [3/3]

CppSecurity::Argon2dPasswordHashing::Argon2dPasswordHashing

Initialize 'Argon2' password hashing with required parameters.

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 41 of file password_hashing_argon2.cpp.

◆ GenerateHash()

std::string CppSecurity::Argon2idPasswordHashing::GenerateHash ( std::string_view  password,
std::string_view  salt 
) const
overridevirtual

Generate the strong password hash for the given user password and unique salt.

Parameters
password- User password
salt- Unique password salt
Returns
Strong password hash

Reimplemented from CppSecurity::Argon2dPasswordHashing.

Definition at line 67 of file password_hashing_argon2.cpp.

◆ name()

const std::string& CppSecurity::Argon2idPasswordHashing::name ( ) const
inlineoverridevirtual

Get the password hashing algorithm name.

Reimplemented from CppSecurity::Argon2dPasswordHashing.

Definition at line 117 of file password_hashing_argon2.h.

◆ Validate()

bool CppSecurity::Argon2idPasswordHashing::Validate ( std::string_view  password,
std::string_view  hash,
std::string_view  salt 
) const
overridevirtual

Validate the user password over the given strong password hash and unique salt.

Parameters
password- User password
hash- Strong password hash
salt- Unique password salt
Returns
'true' if the given user password is valid, 'false' if the given user password is invalid

Reimplemented from CppSecurity::Argon2dPasswordHashing.

Definition at line 76 of file password_hashing_argon2.cpp.


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