🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

imurmurhash

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imurmurhash

An incremental implementation of MurmurHash3

0.1.4
latest
Source
npm
Version published
Weekly downloads
60M
-16.01%
Maintainers
1
Weekly downloads
 
Created

What is imurmurhash?

The imurmurhash npm package is a JavaScript implementation of the MurmurHash3 hashing algorithm. It's designed for efficiently generating 32-bit hashes from strings. This package is useful for tasks such as generating hash keys for data caching, creating compact unique identifiers for objects, and implementing hash-based data structures like bloom filters.

What are imurmurhash's main functionalities?

Hash Initialization and Update

This feature demonstrates initializing a new hash instance and updating it with a string. The `result` method is then used to get the hash value.

const MurmurHash3 = require('imurmurhash');
const hash = new MurmurHash3();
hash.hash('Hello, world!');
console.log(hash.result());

Incremental Hash Updates

This feature shows how to incrementally update the hash with multiple pieces of data. This is useful for hashing data streams or large datasets in chunks.

const MurmurHash3 = require('imurmurhash');
const hash = new MurmurHash3();
hash.hash('Hello, ');
hash.hash('world!');
console.log(hash.result());

Resetting Hash State

This feature illustrates how to reset the hash to its initial state after computing a hash value, allowing the same hash instance to be reused for hashing new data.

const MurmurHash3 = require('imurmurhash');
const hash = new MurmurHash3().hash('Hello, world!');
console.log(hash.result());
hash.reset();
hash.hash('Another string');
console.log(hash.result());

Other packages similar to imurmurhash

Keywords

murmur

FAQs

Package last updated on 24 Aug 2013

Did you know?

Socket

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.

Install

Related posts