A 32-bit key hash for BloomFilter and CountingBloomFilter.
More...
#include "donner/base/BloomFilter.h"
|
| constexpr | BloomHash (std::uint32_t value) noexcept |
| | Wraps a precomputed hash value.
|
|
constexpr std::uint32_t | value () const noexcept |
| | Returns the hash value.
|
|
| static constexpr BloomHash | Of (std::string_view bytes, std::uint32_t salt) noexcept |
| | Hashes bytes under salt.
|
|
|
constexpr bool | operator== (BloomHash lhs, BloomHash rhs) noexcept=default |
| | Equality operator.
|
A 32-bit key hash for BloomFilter and CountingBloomFilter.
Compute it once per key with Of and reuse it for every insertion and probe.
The value is a pure function of the key bytes and the salt, identical on every platform and standard library, so tests and fuzzer corpora are reproducible.
◆ BloomHash()
| donner::BloomHash::BloomHash |
( |
std::uint32_t | value | ) |
|
|
inlineexplicitconstexprnoexcept |
Wraps a precomputed hash value.
- Parameters
-
| value | Hash value; a filter with 2^k slots probes bits 0 to k-1 and k to 2k-1. |
◆ Of()
| constexpr BloomHash donner::BloomHash::Of |
( |
std::string_view | bytes, |
|
|
std::uint32_t | salt ) |
|
inlinestaticconstexprnoexcept |
Hashes bytes under salt.
The hash is 32-bit FNV-1a over the salt's four bytes in little-endian order followed by bytes, then the MurmurHash3 fmix32 finalizer, so that every input bit affects the low bits the filters probe.
- Parameters
-
| bytes | Key bytes; each byte is taken as an unsigned value. |
| salt | Key kind, so that keys of different kinds with the same spelling (for example a tag name and a class name) hash differently. |
The documentation for this class was generated from the following file: