atbfdeprecated

simple attenuated bloom filter

Usage no npm install needed!

<script type="module">
  import atbf from 'https://cdn.skypack.dev/atbf';
</script>

README

atbf

Build Status

This package provides a simple attenuated bloom filter. An attenuated bloom filter is a series of bloom filters that can be used to represent items in sets over a sort of distance plot. This is useful in particular for things like Quasar where each bloom filter in the set is used to represent topics to which peers N hops aways are subscribed.

Usage

npm install atbf --save
const AttenuatedBloomFilter = require('atbf');
const atbf = new AttenuatedBloomFilter({ bitfieldSize: 160, filterDepth: 3 });

atbf[0].add(Buffer.from('some item'));
atbf[0].has(Buffer.from('some item')); // true
atbf[0].has(Buffer.from('other item')); // false

The AttenuatedBloomFilter object extends Array, so the usual suspects like map, forEach, etc are available.

License

GNU Lesser General Public License 3.0