Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
murmur-bloomfilter
Advanced tools
It's a Bloom filter, implemented using murmur hash function.
A bloom filter has two methods: add()
and test()
. You
add()
an element and voodoo happens; you
test()
for an element and it returns false
if the element is definitely
not in the set, or true
if the element is probably in the set.
npm install murmur-bloomfilter --save
Usage:
var BloomFilter = require("murmur-bloomfilter");
//Simple Usage: create a filter with 1000 expected item and 0.01 false positive probability.
/*
ie: if you are expecting to load 1000 items and you want to maintain a probability of not more than 0.01 false positives
*/
//Recomendded: it will calculate the best setup for your need.
var filter = new BloomFilter(1000, 0.01);
// Add some keys
filter.add("test")
filter.add("hey");
// Test them
console.log(filter.test("test")); // true
console.log(filter.test("man")); // false
console.log("false positive probability",filter.currentFPP())
console.log(filter.test("hey")); //true
/// advanced mode : use your own parameters for filter size and hash count (m,k)
var filter = new BloomFilter({m:1024,k:2});
filter.add("hey");
console.log(filter.test("hey")); // true
/// serialization interface:
var filter = new BloomFilter(1000, 0.01);
filter.add("hey");
filter.add("woot");
filter.serialize("bloom.data",()=>{
const newFilter=BloomFilter.from("bloo.data").then(()=>{
newFilter.test("hey") //true
newFilter.test("woot") //true
});
});
Ported from geeksforgeeks.org tutourial.
FAQs
murmur-bloomfilter ===============================
We found that murmur-bloomfilter 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.