A Hasher implements a hash algorithm. This is used to compute the small digests NuDB needs to effectively implement a hash table. NuDB provides the default implementation xxhasher, which is suitable for most use cases. For advanced applications, a user supplied hash function may be supplied which must meet these requirements.
In the table below:
X
denotes a hasher class
a
denotes a value of
type X const
s
denotes a value of
type std::uint64_t
p
denotes a value of
type void const*
n
denotes a value of
type std::size_t
Table 2. Hasher requirements
operation |
type |
semantics, pre/post-conditions |
---|---|---|
|
|
|
|
|
Returns the digest of the memory * Values are uniformly distributed in the full range * Values for the same input are distinctly different for different seeds * Small changes in the input produce unpredictable output values |