The Battle for Wesnoth  1.19.5+dev
Functions
campaignd::auth Namespace Reference

Functions

bool verify_passphrase (const std::string &passphrase, const std::string &salt, const std::string &hash)
 Verifies the specified plain text passphrase against a salted hash. More...
 
std::pair< std::string, std::string > generate_hash (const std::string &passphrase)
 Generates a salted hash from the specified passphrase. More...
 

Function Documentation

◆ generate_hash()

std::pair< std::string, std::string > campaignd::auth::generate_hash ( const std::string &  passphrase)

Generates a salted hash from the specified passphrase.

Parameters
passphrasePassphrase (user input).
Returns
A pair consisting of the salt (in first) and Base64-encoded MD5 hash (in second).

Definition at line 55 of file auth.cpp.

References utils::md5::base64_digest().

◆ verify_passphrase()

bool campaignd::auth::verify_passphrase ( const std::string &  passphrase,
const std::string &  salt,
const std::string &  hash 
)

Verifies the specified plain text passphrase against a salted hash.

Parameters
passphrasePassphrase (user input).
saltSalt string.
hashBase64-encoded salted MD5 hash.

Definition at line 50 of file auth.cpp.

References utils::md5::base64_digest().