|
| constexpr std::uint32_t | fnv1a (std::span< const std::byte > data) noexcept |
| | Compute the FNV-1a 32-bit hash for a span of bytes.
|
| |
| constexpr std::uint32_t | fnv1a (std::string_view sv) noexcept |
| | Compute the FNV-1a 32-bit hash for a std::string_view.
|
| |
template<typename T >
requires std::is_trivially_copyable_v<T> |
| constexpr std::uint32_t | fnv1a (const T &value) noexcept |
| | Compute the FNV-1a 32-bit hash for a trivially copyable POD object.
|
| |
| constexpr std::uint64_t | fnv1a_64 (std::span< const std::byte > data) noexcept |
| | Compute the FNV-1a 64-bit hash for a span of bytes.
|
| |
| constexpr std::uint64_t | fnv1a_64 (std::string_view sv) noexcept |
| | Compute the FNV-1a 64-bit hash for a std::string_view.
|
| |
template<typename T >
requires std::is_trivially_copyable_v<T> |
| constexpr std::uint64_t | fnv1a_64 (const T &value) noexcept |
| | Compute the FNV-1a 64-bit hash for a trivially copyable POD object.
|
| |
Lightweight hashing utilities (FNV-1a implementations).
Provides constexpr, header-only implementations of the FNV-1a hashing algorithms (32-bit and 64-bit) with overloads that accept:
- std::span<const std::byte>
- std::string_view
- trivially-copyable POD objects
These utilities are intended for fast, deterministic hashing of byte sequences and simple value-based hashing of POD types. Implementations are usable in constexpr contexts for string literals and other compile-time scenarios.
- Note
- Use the POD overloads only for trivially-copyable types where hashing the raw memory representation is intended.
- See also
- fnv1a(), fnv1a_64()
template<typename T >
requires std::is_trivially_copyable_v<T>
| constexpr std::uint32_t fnv1a |
( |
const T & |
value | ) |
|
|
inlineconstexprnoexcept |
Compute the FNV-1a 32-bit hash for a trivially copyable POD object.
The object is hashed as its raw bytes (binary representation). Use only for POD/trivially-copyable types where this behaviour is intended.
- Template Parameters
-
| T | Trivially copyable type. |
- Parameters
-
| value | Reference to the object to hash. |
- Returns
- std::uint32_t 32-bit FNV-1a hash.
Definition at line 118 of file hash.h.
template<typename T >
requires std::is_trivially_copyable_v<T>
| constexpr std::uint64_t fnv1a_64 |
( |
const T & |
value | ) |
|
|
inlineconstexprnoexcept |
Compute the FNV-1a 64-bit hash for a trivially copyable POD object.
The object is hashed as its raw bytes (binary representation). Use only for POD/trivially-copyable types where this behaviour is intended.
- Template Parameters
-
| T | Trivially copyable type. |
- Parameters
-
| value | Reference to the object to hash. |
- Returns
- std::uint64_t 64-bit FNV-1a hash.
Definition at line 147 of file hash.h.