
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
bloom-filter
Advanced tools
A bloom filter suitable for use in Bitcoin Connection Bloom Filtering as part of [BIP37](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki).
A bloom filter suitable for use in Bitcoin Connection Bloom Filtering as part of BIP37.
npm install bloom-filter
var BloomFilter = require('bloom-filter');
// convenient method to initialize the filter
var numberOfElements = 3;
var falsePositiveRate = 0.01;
var filter = BloomFilter.create(numberofElements, falsePositiveRate);
// elements
var a = new Buffer('99108ad8ed9bb6274d3980bab5a85c048f0950c8', 'hex');
var b = new Buffer('19108ad8ed9bb6274d3980bab5a85c048f0950c8', 'hex');
var c = new Buffer('b5a2c786d9ef4658287ced5914b37a1b4aa32eee', 'hex');
// insert elements
filter.insert(a);
filter.insert(b);
// check if elements match
assert(!filter.contains(c));
assert(filter.contains(a));
// reinstantiate from an object
var serialized = filter.toObject();
var filter = new BloomFilter(serialized);
// initialize directly
var filter = new BloomFilter({
vData: [], // the data of the filter
nHashFucs: 3, // the number of hash functions to use
nTweak: 2147483649, // the seed used for the hash fuctions
nFlags: 0 // flags used to update the filter when matched
});
Code released under the MIT license.
Copyright 2015 BitPay, Inc.
FAQs
A bloom filter suitable for use in Bitcoin Connection Bloom Filtering as part of [BIP37](https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki).
The npm package bloom-filter receives a total of 9,008 weekly downloads. As such, bloom-filter popularity was classified as popular.
We found that bloom-filter demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.