|
nfx-hashing 0.1.2
Modern C++20 header-only hashing library with hardware acceleration
|
Unified template-based hash function API. More...
#include "nfx/hashing/Concepts.h"#include "nfx/hashing/Hasher.h"#include "nfx/detail/hashing/Hash.inl"

Go to the source code of this file.
Functions | |
| template<typename T, Hash32or64 HashType = uint32_t, HashType Seed = ( sizeof( HashType ) == 4 ? constants::FNV_OFFSET_BASIS_32 : constants::FNV_OFFSET_BASIS_64 )> | |
| HashType | nfx::hashing::hash (const T &value) noexcept |
| Hash a value with explicit type and hash size specification. | |
Unified template-based hash function API.
Provides a clean, STL-style hash<T>() interface that delegates to Hasher<HashType, Seed>. Supports explicit type and hash size specification with optional custom seeding.
Definition in file Hash.h.
|
inlinenodiscardnoexcept |
Hash a value with explicit type and hash size specification.
| T | The type of value to hash |
| HashType | The hash output type (uint32_t or uint64_t) |
| Seed | The seed value for hash initialization (default: FNV_OFFSET_BASIS_32 for 32-bit, FNV_OFFSET_BASIS_64 for 64-bit) |
| value | The value to hash |
Unified template-based hash function that provides a clean, STL-style API for hashing values. The function automatically selects appropriate algorithms based on input type:
Hardware Acceleration: String hashing uses SSE4.2 CRC32-C instructions when:
Without compiler flags, software fallback is used even if CPU supports SSE4.2.
Default Seed: FNV offset basis (0x811C9DC5 for 32-bit, 0xCBF29CE484222325 for 64-bit) provides consistent initialization across the library. For zero-seed behavior, explicitly specify: hash<T, HashType, 0>(value)
Internally delegates to Hasher<HashType, Seed> functor for type-specific implementations.