lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
lintel::Cryption Class Reference

#include <Cryption.h>

Public Member Functions

 Cryption ()
 

Static Public Member Functions

static std::string hashOf (const std::string &password)
 
static bool verifyOf (const std::string &password, const std::string &storedHash)
 
static bool isModernHash (const std::string &storedHash)
 
static std::string hashOfSha512 (const std::string &text)
 
static std::string encodeBase64 (const std::string &in)
 
static std::string decodeBase64 (const std::string &in)
 

Detailed Description

Utility class providing cryptographic hash and Base64 encoding/decoding operations.

Constructor & Destructor Documentation

◆ Cryption()

lintel::Cryption::Cryption ( )

Default constructor.

Member Function Documentation

◆ decodeBase64()

static std::string lintel::Cryption::decodeBase64 ( const std::string &  in)
static

Decode a Base64-encoded string.

Parameters
inthe Base64-encoded input
Returns
the decoded string

◆ encodeBase64()

static std::string lintel::Cryption::encodeBase64 ( const std::string &  in)
static

Encode a string to Base64.

Parameters
inthe input string
Returns
the Base64-encoded string

◆ hashOf()

static std::string lintel::Cryption::hashOf ( const std::string &  password)
static

Compute a salted, iterated hash (PBKDF2-HMAC-SHA512) of the given password. The result embeds salt and iteration count, so it is safe for password storage. Format: $pbkdf2-sha512$<iterations>$<salt-hex>$<derived-hex>.

Parameters
passwordthe password to hash
Returns
the salted password hash

◆ hashOfSha512()

static std::string lintel::Cryption::hashOfSha512 ( const std::string &  text)
static

Compute the legacy plain SHA-512 hex hash (kept for migration purposes).

Parameters
textthe input text
Returns
the SHA-512 hash as a hex string

◆ isModernHash()

static bool lintel::Cryption::isModernHash ( const std::string &  storedHash)
static
Returns
true if the stored hash uses the modern salted format

◆ verifyOf()

static bool lintel::Cryption::verifyOf ( const std::string &  password,
const std::string &  storedHash 
)
static

Verify a password against a stored hash. Supports the modern salted PBKDF2 format as well as legacy plain SHA-512 hex hashes.

Parameters
passwordthe password to check
storedHashthe stored hash
Returns
true if the password matches the stored hash

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