Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BloomFilter ¶
type BloomFilter []byte
BloomFilter is an encoded set of a []byte key.
func NewBloomFilter ¶
func NewBloomFilter(key []byte) (BloomFilter, error)
NewBloomFilter returns a new bloom filter that encodes the given key with 16 bits allotted for it. This bloom filter has a set length of 16 bits, and uses 5 hash functions in order to provide less than 0.1% chance of false positives. The following 5 hash functions used are highway, murmur3, fnv, sha256, and keccak256. These are reliably quick hashes that used together can provide strong collision resistance.
func (BloomFilter) Contains ¶
func (f BloomFilter) Contains(key []byte) (bool, error)
Contains returns whether the bloom filter contains given key. False positives are possible, where it could return true for a key not in the original set. This function generates the proper hashes for the key and checks if the corresponding bit is marked in the bloom filter.