VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Static Public Member Functions
DtPasswordHasher Class Reference

DtPasswordHasher — PBKDF2-SHA256 password hashing and verification utility.

Stored hash format (self-describing, colon-delimited):

pbkdf2-sha256:<iterations>:<base64-salt>:<base64-hash>

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)
 

Member Function Documentation

static std::string DtPasswordHasher::hash ( const std::string &  password)
static

Hashes the given password using PBKDF2-SHA256 with a fresh cryptographic random salt.

Parameters
passwordThe plaintext password to hash.
Returns
A self-describing hash string in the form "pbkdf2-sha256:600000:<base64-salt>:<base64-hash>".
Exceptions
std::runtime_errorif the underlying OpenSSL calls fail.
static bool DtPasswordHasher::verify ( const std::string &  password,
const std::string &  storedHash 
)
static

Verifies a plaintext password against a previously stored hash string. Uses constant-time comparison to prevent timing side-channel attacks.

Parameters
passwordThe plaintext password provided at login.
storedHashThe hash string as returned by hash(), stored in users.json.
Returns
true if the password matches; false if it does not, or if storedHash is empty.
static bool DtPasswordHasher::requiresPassword ( const std::string &  storedHash)
static

Returns true if the stored hash is non-empty, meaning a password is required to authenticate this account.


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

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)