bloom-filter
bloom-filter copied to clipboard
A JavaScript bloom filter suitable for use in Bitcoin Connection Bloom Filtering
# Steps to reproduce ```Typescript import BloomFilter from 'bloom-filter' BloomFilter.create(0, 0.01) ``` # Expected behaviour Doesn't throw an error # Actual behaviour > TypeError: Data object should include number of...
Here's a minimal test to demonstrate. ```js const BloomFilter = require("bloom-filter") const bf = BloomFilter.create(3, .01) bf.insert(1).insert(2).insert(3) console.log(bf.contains(1)) // expected: true; actual: true console.log(bf.contains(4)) // expected: false; actual: true ```
I tried creating a BF with 1B elements and fpr=0.001. I know that's a huge filter, so this library may enforce max sizes. But the nHashFuncs is way too low....
Moving my edits from https://github.com/bitpay/bloom-filter/pull/4 here so I can use my master branch.