Registry / serialization / fmix
library0.2.0jsnpmunverified

fmix is a JavaScript implementation of the MurmurHash3 x86 finalization mix function, a crucial step in the MurmurHash3 algorithm for generating high-quality hash values. The package provides a lightweight, single-purpose utility to apply this finalization step to a given 32-bit number. The current stable version is 1.0.0, released in July 2021. As a focused cryptographic utility, its release cadence is typically slow, with updates primarily addressing environmental compatibility or minor optimizations rather than new features, signifying a mature and stable API. It differentiates itself by offering only the finalization mix, allowing developers to integrate it into custom hashing implementations or use it alongside other MurmurHash3 components like `murmur-32` or `murmur-128` (from the same author) where modularity is desired, rather than a full end-to-end hashing solution. This allows for fine-grained control over the hashing process. The library is dependency-free, ensuring a minimal footprint.

npm install fmix
INSTALL
IMPORT
SIG · FMIX
F
fmix
serializationjavascriptv0.2.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fmix
✓ import fmix from 'fmix'
✗ const fmix = require('fmix')
Since v1.0.0, this package is ESM-only and must be imported using native ES module syntax. CommonJS `require()` is no longer supported.

Demonstrates how to install `fmix` and compute the finalization mix for a given 32-bit number, showing its deterministic output.

import fmix from 'fmix'; // The fmix function applies the finalization steps of MurmurHash3 // to an input number, enhancing its distribution and mixing properties. // This is typically the last step after all input data has been processed // into a single 32-bit hash state. const initialHashState = 0xdeadbeef; // Example 32-bit number (hexadecimal) const finalHash = fmix(initialHashState); console.log(`Initial hash state: 0x${initialHashState.toString(16)}`); console.log(`Finalization mix result: ${finalHash}`); console.log(`Finalization mix result (hex): 0x${finalHash.toString(16)}`); // Example with a different input const anotherState = 0x12345678; const anotherFinalHash = fmix(anotherState); console.log(`\nAnother state: 0x${anotherState.toString(16)}`); console.log(`Another finalization mix result: ${anotherFinalHash}`); // Illustrating the deterministic nature const sameState = 0xdeadbeef; const retryFinalHash = fmix(sameState); console.log(`\nRe-applying to 0x${sameState.toString(16)}: ${retryFinalHash}`);
Debug
Known issues
breakingThe package converted from CommonJS to ECMAScript Modules (ESM) in v1.0.0.
fix
Migrate all `require()` statements to `import` statements (e.g., `import fmix from 'fmix'`) and ensure your project environment supports ESM.
affects: >=1.0.0
breakingSupport for older Node.js versions was dropped in v1.0.0.
fix
Ensure your Node.js environment is `^12.20.0`, `^14.13.1`, or `>=16.0.0` or newer to use `fmix@1.0.0` and above.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... fmix/index.js from ... not supported.
Attempting to import the `fmix` package using CommonJS `require()` syntax when the package is ESM-only.
fix
Change `const fmix = require('fmix');` to `import fmix from 'fmix';` in your JavaScript or TypeScript files. Ensure your environment is configured for ESM.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
fmix — npm install fmix · libregistry