generic & simple bloom filter implementation in Go
- No hash function implementation
- Implement your own.
- No 3rd party dependencies
- No complex implementation.
import (
"fmt"
"github.com/thara/go-bloomfilter/bloomfilter"
)
const K = 4
func ExampleBloomFilter() {
bits := make([]byte, 1024)
f := bloomfilter.New(K, myHash)
f.Set(bits, "smith")
f.Set(bits, "james")
f.Set(bits, "mary")
f.Set(bits, "johnson")
f.Set(bits, "john")
f.Set(bits, "patricia")
result := f.Test(bits, "mary")
fmt.Println(result)
// Output:
// true
}
MIT
Tomochika Hara (a.k.a thara)