![]() |
VR-Forces Developer's Guide
|
DtPasswordHasher — PBKDF2-SHA256 password hashing and verification utility.
Stored hash format (self-describing, colon-delimited):
An empty stored hash string means no password is required for that account. All methods in this class are static; the class is not intended to be instantiated.
Static Public Member Functions | |
| static std::string | hash (const std::string &password) |
| static bool | verify (const std::string &password, const std::string &storedHash) |
| static bool | requiresPassword (const std::string &storedHash) |
|
static |
Hashes the given password using PBKDF2-SHA256 with a fresh cryptographic random salt.
| password | The plaintext password to hash. |
| std::runtime_error | if the underlying OpenSSL calls fail. |
|
static |
Verifies a plaintext password against a previously stored hash string. Uses constant-time comparison to prevent timing side-channel attacks.
| password | The plaintext password provided at login. |
| storedHash | The hash string as returned by hash(), stored in users.json. |
|
static |
Returns true if the stored hash is non-empty, meaning a password is required to authenticate this account.