{"id":15490752,"url":"https://github.com/theodesp/go-blooms","last_synced_at":"2025-04-22T19:11:12.521Z","repository":{"id":57565784,"uuid":"114483316","full_name":"theodesp/go-blooms","owner":"theodesp","description":"Simple and efficient bloom filter implementations in Go","archived":false,"fork":false,"pushed_at":"2018-09-26T14:30:59.000Z","size":8,"stargazers_count":8,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T18:02:08.099Z","etag":null,"topics":["bloom-filter","data-structures","probabilistic-data-structures"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/theodesp/go-blooms","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theodesp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-16T18:53:11.000Z","updated_at":"2024-07-09T09:50:27.000Z","dependencies_parsed_at":"2022-09-03T11:21:37.786Z","dependency_job_id":null,"html_url":"https://github.com/theodesp/go-blooms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodesp%2Fgo-blooms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodesp%2Fgo-blooms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodesp%2Fgo-blooms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodesp%2Fgo-blooms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theodesp","download_url":"https://codeload.github.com/theodesp/go-blooms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250306638,"owners_count":21408926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bloom-filter","data-structures","probabilistic-data-structures"],"created_at":"2024-10-02T07:23:37.083Z","updated_at":"2025-04-22T19:11:12.499Z","avatar_url":"https://github.com/theodesp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-blooms\n---\n\nFrom Wiki\n\u003eBloom Filter: A space-efficient probabilistic data structure that is used to test whether an element is a member of\na set. False positive matches are possible, but false negatives are not; i.e. a query returns either \"possibly in set\"\nor \"definitely not in set\". Elements can be added to the set, but not removed.\n\nThis bloom filter implementation is backed by bool slice for simplicity.\n\nAnd the hashing functions used are fnv and murmur both 64 bit versions.\n\n## Installation\n```go\ngo get -u github.com/theodesp/go-blooms\n```\n\n\n## Usage\n\n```go\npackage example\nimport \"github.com/theodesp/go-blooms\"\n\nconst (\n  size = 64 * 1024\n)\n\nbf := go_blooms.New(size, go_blooms.DefaultHashFunctions)\n\nvalue := \"hello\"\n\nbf.Add([]byte(value)) // we accept only a byte slice\nif bf.Test([]byte(value)) { // probably true, could be false\n  // whatever\n}\n\nanotherValue := \"world\"\n\nif bf.Test([]byte(anotherValue) { // Bloom filter guarantees that anotherValue is not in the set\n  panic(\"This should never happen\")\n}\n\n```\n\n## Complexity\n\n**Time**\n\nIf we are using a bloom filter with  bits and  hash function,\ninsertion and search will both take  time.\nIn both cases, we just need to run the input through all of\nthe hash functions. Then we just check the output bits.\n\n|  Operation | Complexity  |\n|---|---|\n|  insertion |  O(k)  |\n|  search |  O(k)  |\n\n**Space**\nThe space of the actual data structure (what holds the data).\n\n|  Complexity |\n|---|\n|  O(m) |\n\nWhere `m` is the size of the slice.\n\n## Benchmarks\nm=1024, k=3\n```bash\nPASS: bloomFilter_test.go:66: MySuite.BenchmarkAdd      10000000               231 ns/op\nPASS: bloomFilter_test.go:74: MySuite.BenchmarkTest     10000000               231 ns/op\n```\n\n\n## License\n\nCopyright © 2017 Theo Despoudis\nMIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheodesp%2Fgo-blooms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheodesp%2Fgo-blooms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheodesp%2Fgo-blooms/lists"}