Files
openlan/vendor/github.com/riobard/go-bloom
2022-07-29 23:38:54 +08:00
..
2022-07-29 23:38:54 +08:00
2022-07-29 23:38:54 +08:00
2022-07-29 23:38:54 +08:00

Bloom Filter using double hashing.

func doubleFNV(b []byte) (uint64, uint64) {
    hx := fnv.New64()
    hx.Write(b)
    x := hx.Sum64()
    hy := fnv.New64a()
    hy.Write(b)
    y := hy.Sum64()
    return x, y
}

bf := bloom.New(1000000, 0.0001, doubleFNV)
bf.Add([]byte("hello"))
bf.Test([]byte("hello"))
bf.Test([]byte("world"))