https://github.com/jgautheron/bloomfilter
Standard bloom filter implementation in Go
https://github.com/jgautheron/bloomfilter
algorithm bloom-filter go
Last synced: 6 months ago
JSON representation
Standard bloom filter implementation in Go
- Host: GitHub
- URL: https://github.com/jgautheron/bloomfilter
- Owner: jgautheron
- License: mit
- Created: 2018-03-11T23:13:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-11T23:42:13.000Z (over 7 years ago)
- Last Synced: 2025-04-11T02:08:58.674Z (6 months ago)
- Topics: algorithm, bloom-filter, go
- Language: Go
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bloom filter
[](https://exago.io/project/github.com/jgautheron/bloomfilter)
[](https://exago.io/project/github.com/jgautheron/bloomfilter)
[](https://godoc.org/github.com/jgautheron/bloomfilter)[Standard Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) implementation in Go. [MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash) is used for hashing.
```go
// First parameter is the maximum foreseeable size of your dataset.
// The second is the false positive probability value that is acceptable for you.
// Based on these two values, optimal values are calculated for the hash count & bit array size.
bf := bloomfilter.New(1000, 0.025)
bf.Add("foo")
bf.Add("bar")// "foo" has been found!
if bf.Check("foo") {
fmt.Println("Found!")
}
``````
BenchmarkAdd10000-8 10000000 147 ns/op
BenchmarkCheck10000-8 10000000 152 ns/op
```## License
MIT