Raven Engine v0.1
Loading...
Searching...
No Matches
Hash

Hashing utilities. More...

Functions

template<class T>
constexpr unsigned long long Crux::Hash::FNV1a64 (const T &toHash)
 Computes the 64-bit FNV-1a hash of a string-like object at compile time.
constexpr unsigned long long Crux::Hash::Hash64 (unsigned long long x) noexcept
 Computes the 64-bit FNV-1a hash of an integral value. (Name change pending)

Detailed Description

Hashing utilities.

Contains hash functions and helpers used across Crux and Raven.

Function Documentation

◆ FNV1a64()

template<class T>
unsigned long long Crux::Hash::FNV1a64 ( const T & toHash)
inlineconstexpr

Computes the 64-bit FNV-1a hash of a string-like object at compile time.

Applies the FNV-1a hashing algorithm to each byte of the input in sequence. The result is a 64-bit value with good dispersion properties for small inputs.

Template Parameters
TA string-like type with a .begin() and .end(). Typically a std::string_view or string literal.
Parameters
toHashThe object whose contents will be hashed.
Returns
64-bit FNV-1a hash of the input.

◆ Hash64()

unsigned long long Crux::Hash::Hash64 ( unsigned long long x)
inlineconstexprnoexcept

Computes the 64-bit FNV-1a hash of an integral value. (Name change pending)

Hashes the 8-byte input by splitting it into bytes and applying the same FNV-1a algorithm used in string hashing. Useful for generating a stable hash of integral values at compile time.

Parameters
xThe unsigned 64-bit integer to hash.
Returns
64-bit FNV-1a hash of the input.