Template Function shad::HashFunction(const std::vector<KeyTy>&, uint8_t)

Function Documentation

template <typename KeyTy>
uint64_t shad::HashFunction(const std::vector<KeyTy> &key, uint8_t seed)

Jenkins one-at-a-time hash function for std::vector.

The original algorithm was proposed by Bob Jenkins in 1997 in a Dr. Dobbs article. It is a non-cryptographic hash-function for multi-byte keys. Our implementation produces a 64-bit hashing two bytes at time. This specialization use the content of the std::vector to produce the hash value.

Typical Usage:

ValueType value;
uint8_t ultimateSeed = 42;
auto hash = shad::HashFunction(value, ultimateSeed);

Return
A 8-bytes long hash value.
Template Parameters
  • KeyTy: The type of the key to hash.
Parameters
  • key: The std::vector storing the byte sequence to be hashed.
  • seed: A random seed for the hashing process.