{"id":22192085,"url":"https://github.com/srinivasreddy/rust-bloomfilter","last_synced_at":"2025-06-28T09:34:16.106Z","repository":{"id":57664914,"uuid":"215987991","full_name":"srinivasreddy/rust-bloomfilter","owner":"srinivasreddy","description":" 🦀  Bloom filter implementation in Rust  🦀","archived":false,"fork":false,"pushed_at":"2020-11-18T05:47:38.000Z","size":18,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-24T01:06:44.530Z","etag":null,"topics":["bloom-filter","probabilistic-data-structures","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/srinivasreddy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"srinivasreddy"}},"created_at":"2019-10-18T09:23:48.000Z","updated_at":"2025-04-28T15:55:37.000Z","dependencies_parsed_at":"2022-09-14T21:41:18.782Z","dependency_job_id":null,"html_url":"https://github.com/srinivasreddy/rust-bloomfilter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/srinivasreddy/rust-bloomfilter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinivasreddy%2Frust-bloomfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinivasreddy%2Frust-bloomfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinivasreddy%2Frust-bloomfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinivasreddy%2Frust-bloomfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srinivasreddy","download_url":"https://codeload.github.com/srinivasreddy/rust-bloomfilter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinivasreddy%2Frust-bloomfilter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259610151,"owners_count":22884205,"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","probabilistic-data-structures","rust"],"created_at":"2024-12-02T12:19:09.519Z","updated_at":"2025-06-13T08:32:47.305Z","avatar_url":"https://github.com/srinivasreddy.png","language":"Rust","funding_links":["https://patreon.com/srinivasreddy"],"categories":[],"sub_categories":[],"readme":"## rust-bloomfilter\n\nBloom filters are defined by 4 interdependent values:\n\n* n - Number of items in the filter\n* p - Probability of false positives, float between 0 and 1 or a number indicating 1-in-p\n* m - Number of bits in the filter\n* k - Number of hash functions\n\n## Guide for selecting the parameters\nThe values are interdependent as shown in the following calculations:\n\n```\nm = ceil((n * log(p)) / log(1.0 / (pow(2.0, log(2.0)))));\n\nk = round(log(2.0) * m / n);\n```\n## Design\nI use murmur3 hash to generate 128 bit hash integer, and then i split it into two integers of 64 bits each.\nFollowing is the pseudo-code written for the design of bloom filter.\n\n````\nlet hash_128 = murmur3_hash(data);\nlet first_64 = (hash_128 \u0026 (2_u128.pow(64) - 1));\nlet second_64 = hash \u003e\u003e 64;\nfor i 0..num_of_hashfuncs{\n    first_64 += i* second_64;\n    index =  fist_64 % number_of_bits\n    self.bitvec.set(index, true);\n}\n````\n## Usage\n````rust\nextern crate rust_bloomfilter;\n\nuse rust_bloomfilter::BloomFilter;\n\nlet mut b = BloomFilter(20000, 0.01, true);\nb.add(\"Helloworld\");\nassert!(b.contains(\"Helloworld\"));\n\n````","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrinivasreddy%2Frust-bloomfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrinivasreddy%2Frust-bloomfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrinivasreddy%2Frust-bloomfilter/lists"}