The hash module provides several hash-related functions:
seq::hash_finalize
: mix input hash value for better avalanchingseq::hash_combine
: combine 2 hash valuesseq::hash_bytes_murmur64
: murmurhash2 algorithmseq::hash_bytes_fnv1a
: fnv1a hash algorithmseq::hash_bytes_komihash
: simplified komihash hash function.
The hash module also provides its own hashing class called seq::hasher
that, by default, inherits std::hash
. seq::hasher
is specialized for:
- All arithmetic types as well character types (use 128 bits multiplication)
- Enumerations
- Pointers
std::unique_ptr
andstd::shared_ptr
std::tuple
andstd::pair
std::basic_string
,std::basic_string_view
(if available) andseq::tiny_string
(<seq/tiny_string.hpp>
must be included).
For string types, seq::hasher
uses a seeded version of komihash. komihash is a very fast hash function that passes all SMhasher tests, and is especially efficient on small strings.
Note that seq::hasher
is the default hash function for all hash tables within the seq library: seq::ordered_set/map
, seq::radix_hash_set/map
and seq::concurrent_set/map
.