
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
@rawify/bloomfilter
Advanced tools
The RAW BloomFilter library, a fast, memory-efficient bloom filter implementation for membership checks.
BloomFilter.js is a high-performance JavaScript implementation of Bloom filters, a probabilistic data structures for fast set membership testing.
They are particularly useful as pre-checks in situations where a lookup or request is expensive for example, checking whether an element might exist in a database, a cache, or an API before actually making the request. If the filter says “no”, you can skip the request entirely. If it says “yes”, you proceed, knowing there may still be a false positive. This trade-off makes Bloom filters ideal for large-scale systems where memory and response time matter.
You can install BloomFilter.js via npm:
npm install @rawify/bloomfilter
Or with yarn:
yarn add @rawify/bloomfilter
Alternatively, download or clone the repository:
git clone https://github.com/rawify/BloomFilter.js
Include the bloomfilter.min.js file in your project:
<script src="path/to/bloomfilter.min.js"></script>
Or in a Node.js / modern ES project:
const { BloomFilter } = require('@rawify/bloomfilter');
or
import { BloomFilter } from '@rawify/bloomfilter';
You can create a Bloom filter either by specifying the desired capacity and false-positive rate:
const bf = new BloomFilter({ capacity: 100000, errorRate: 0.01 });
or by explicitly providing the number of bits and hash functions:
const bf = new BloomFilter({ bitCount: 1 << 20, hashCount: 7 });
// Suppose we want to avoid unnecessary DB/API requests
bf.add("user:alice"); // mark known entries
bf.add("user:bob");
if (!bf.mightContain("user:mallory")) {
// definitely not present → skip expensive lookup
} else {
// possibly present → perform the real DB/API request
}
bf.add("alice");
bf.addAll(["bob", "carol"]);
bf.mightContain("alice"); // true (possibly)
bf.mightContain("mallory"); // false (definitely not)
bf.estimatedCardinality(); // Approximate number of inserted elements
bf.estimatedFalsePositiveRate(); // Current FP rate given fill ratio
bf.fillRatio(); // Fraction of bits set
const bf1 = new BloomFilter({ capacity: 1000, errorRate: 0.01 });
const bf2 = new BloomFilter({ capacity: 1000, errorRate: 0.01 });
bf1.add("foo");
bf2.add("bar");
const both = BloomFilter.union(bf1, bf2); // union of sets
const common = BloomFilter.intersection(bf1, bf2); // intersection of sets
const dump = bf.toJSON();
// Save to disk, send over network, etc.
const bf2 = BloomFilter.fromJSON(dump);
add(key) - insert a single element.addAll(iterable) - insert multiple elements.mightContain(key) - test membership (false = definitely not present).clear() - reset the filter.bitCount - number of bits in the filter.hashCount - number of hash functions.bitset - underlying Uint32Array.addCalls - number of add operations performed.countSetBits() - number of bits currently set.fillRatio() - fraction of bits set.estimatedCardinality() - approximate number of distinct inserted elements.estimatedFalsePositiveRate() - current false-positive probability.toJSON() - export configuration and bitset as JSON.BloomFilter.fromJSON(obj) - restore from serialized JSON.BloomFilter.optimalParameters(capacity, errorRate) - compute ideal {bitCount, hashCount}.BloomFilter.union(a, b) - compute union of two compatible filters.BloomFilter.intersection(a, b) - compute intersection of two compatible filters.Like all my libraries, BloomFilter is written to minimize size after compression with Google Closure Compiler in advanced mode. The code style is optimized to maximize compressibility. If you extend the library, please preserve this style.
After cloning the Git repository run:
npm install
npm run build
Copyright (c) 2025, Robert Eisele Licensed under the MIT license.
FAQs
The RAW BloomFilter library, a fast, memory-efficient bloom filter implementation for membership checks.
We found that @rawify/bloomfilter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.