Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 1.34 KB

hash.md

File metadata and controls

23 lines (16 loc) · 1.34 KB

Hash: small collection of hash utilities

The hash module provides several hash-related functions:

  • seq::hash_finalize: mix input hash value for better avalanching
  • seq::hash_combine: combine 2 hash values
  • seq::hash_bytes_murmur64: murmurhash2 algorithm
  • seq::hash_bytes_fnv1a: fnv1a hash algorithm
  • seq::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 and std::shared_ptr
  • std::tuple and std::pair
  • std::basic_string, std::basic_string_view (if available) and seq::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.