|
R-Type
Distributed multiplayer game engine in C++
|
Argon2id password hashing wrapper. More...
#include <Argon2PasswordHasher.hpp>


Public Member Functions | |
| Argon2PasswordHasher () | |
| Constructor with default parameters. | |
| Argon2PasswordHasher (uint32_t timeCost, uint32_t memoryCost, uint32_t parallelism, size_t hashLength=32, size_t saltLength=16) | |
| Constructor with custom parameters. | |
| ~Argon2PasswordHasher () override=default | |
| std::string | hash (const std::string &password) override |
| Hash a plaintext password using Argon2id. | |
| bool | verify (const std::string &password, const std::string &hash) override |
| Verify a password against an Argon2id hash. | |
Public Member Functions inherited from IPasswordHasher | |
| virtual | ~IPasswordHasher ()=default |
Private Attributes | |
| uint32_t | _timeCost |
| uint32_t | _memoryCost |
| uint32_t | _parallelism |
| size_t | _hashLength |
| size_t | _saltLength |
Argon2id password hashing wrapper.
This class wraps the Argon2id algorithm for secure password hashing. Argon2id is the recommended variant for password hashing as it provides resistance against both side-channel and GPU attacks.
Default parameters:
Definition at line 28 of file Argon2PasswordHasher.hpp.
| Argon2PasswordHasher::Argon2PasswordHasher | ( | ) |
Constructor with default parameters.
Definition at line 13 of file Argon2PasswordHasher.cpp.
| Argon2PasswordHasher::Argon2PasswordHasher | ( | uint32_t | timeCost, |
| uint32_t | memoryCost, | ||
| uint32_t | parallelism, | ||
| size_t | hashLength = 32, |
||
| size_t | saltLength = 16 |
||
| ) |
Constructor with custom parameters.
| timeCost | Number of iterations (default: 2) |
| memoryCost | Memory usage in KiB (default: 65536 = 64 MiB) |
| parallelism | Number of threads (default: 1) |
| hashLength | Length of the hash in bytes (default: 32) |
| saltLength | Length of the salt in bytes (default: 16) |
Definition at line 16 of file Argon2PasswordHasher.cpp.
|
overridedefault |
|
overridevirtual |
Hash a plaintext password using Argon2id.
| password | The plaintext password to hash |
| std::runtime_error | if hashing fails |
Implements IPasswordHasher.
Definition at line 24 of file Argon2PasswordHasher.cpp.
References _hashLength, _memoryCost, _parallelism, _saltLength, and _timeCost.
Referenced by verify().
|
overridevirtual |
Verify a password against an Argon2id hash.
| password | The plaintext password to verify |
| hash | The Argon2id hash to verify against |
Implements IPasswordHasher.
Definition at line 54 of file Argon2PasswordHasher.cpp.
References hash().

|
private |
Definition at line 68 of file Argon2PasswordHasher.hpp.
Referenced by hash().
|
private |
Definition at line 66 of file Argon2PasswordHasher.hpp.
Referenced by hash().
|
private |
Definition at line 67 of file Argon2PasswordHasher.hpp.
Referenced by hash().
|
private |
Definition at line 69 of file Argon2PasswordHasher.hpp.
Referenced by hash().
|
private |
Definition at line 65 of file Argon2PasswordHasher.hpp.
Referenced by hash().