js-murmurhash3
v1.0.0
Published
Fast MurmurHash3 32-bit hashing for ASCII strings.
Downloads
16
Maintainers
Readme
js-murmurhash3
Fast 32-bit MurmurHash3 hashing for ASCII strings.
Overview
This project provides a small JavaScript implementation of the MurmurHash3 32-bit non-cryptographic hash function. It is intended for fast hashing in modern JavaScript environments.
Features
- 32-bit MurmurHash3 implementation for ASCII string input
- Native ECMAScript module export with no runtime dependencies
Project Structure
murmurhash3.js: source module that exports the hashing functionsmurmurhash3.d.ts: TypeScript declarations for the public APItest/murmurhash3.test.js: automated tests for the public hashing APIpackage.json: package metadata and project scripts
Requirements
- A JavaScript runtime with ECMAScript module support
- Support for
Math.imul
Installation
This project can be used either from local source files or as a standard npm package.
Package Manager
npm install js-murmurhash3Local Files
Copy murmurhash3.js into your project, then import it from your local source tree.
Usage
Import the hashing function from the source that matches your installation method.
npm Package
import { murmurHash3_32 } from 'js-murmurhash3';
const hashFromString = murmurHash3_32('example-key', 12345);Local File Import
import { murmurHash3_32 } from './murmurhash3.js';
const hashFromString = murmurHash3_32('example-key', 12345);Note:
murmurHash3_32is designed for ASCII strings. Non-ASCII code units are truncated to 8-bit values before hashing.
Testing
Run the automated test suite with:
npm testLicense
This project is licensed under the terms of MIT. See the LICENSE file for details.
