imurmurhash
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
iMurmurHash is a JavaScript-based, incremental implementation of the MurmurHash3 (32-bit) hashing algorithm. It aims to provide fast and efficient computations of hashes, serving as a fundamental ingredient in the creation of hash functions and checksums in data structures. The algorithm is particularly revered for its performance and robustness, ensuring both speed and security in applications where these attributes are paramount.
Using iMurmurhash is straightforward. You can install it directly into your browser or through Node.js using NPM. Here's how:
To use iMurmurHash in the browser:
<script type="text/javascript" src="/scripts/imurmurhash.min.js"></script>
<script>
// Your code here, access iMurmurHash using the global object MurmurHash3
</script>
For Node.js, you can install the module using the NPM install command:
npm install imurmurhash
Then, you can include it in your scripts by requiring the package:
MurmurHash3 = require('imurmurhash');
Once you've installed and included the library, here's how to create a hash:
// Create the initial hash
var hashState = MurmurHash3('initial string');
// Incrementally add more text to the hash
hashState.hash('additional strings');
// You can chain several calls together
hashState.hash('and').hash('some').hash('more');
// Get a result
hashState.result(); // This will return the hash as a 32-bit positive integer
The comprehensive documentation of iMurmurHash is provided on its GitHub page located at https://github.com/jensyt/imurmurhash-js. The documentation contains a thorough explanation of its functions, providing code snippets and examples for basic usage, incremental hashing, chained calls, and obtaining results. You can follow the link to get detailed insights about implementing and using this versatile hashing algorithm.