xxhashjs is a pure JavaScript implementation of the xxHash fast hashing algorithm. Currently at version 0.2.2, the library provides both 32-bit and 64-bit hashing capabilities, a feature introduced in version 0.2.0. While it aims to replicate the speed of the original C implementation, it acknowledges performance limitations inherent to JavaScript's handling of unsigned 32-bit integers. The project appears to be in a maintenance phase, with infrequent updates since its last release. It supports both Node.js environments via CommonJS and browser environments through a global `_XXH_` object, offering a convenient way to compute hashes in single or multiple steps for various data types including strings, ArrayBuffers, and Node.js Buffers.
npm install xxhashjsVerified import paths — ran on the pinned version, not inferred.
Demonstrates both 32-bit and 64-bit xxHash calculations, including multi-step hashing with object reuse, suitable for Node.js CommonJS or browser global usage.
Be aware of performance characteristics for high-throughput applications. Consider native add-ons if absolute maximum speed is critical.
Ensure you use `const XXH = require('xxhashjs');` for Node.js. If you need to use it in an ESM context, consider using a CommonJS wrapper or a bundler that handles CJS modules.If conflicts arise, load `xxhashjs` in an isolated scope (e.g., an IIFE if possible) or consider manually mapping the global `_XXH_` to another variable immediately after loading.
Evaluate the project's suitability for long-term critical applications. For actively maintained alternatives, explore other hashing libraries or actively developed xxHash ports.
Change your import statement to `const XXH = require('xxhashjs');` for Node.js.To use `.update()`, first instantiate a hasher: `const H = XXH.h32(seed);` (without data), then call `H.update(data);`.
Ensure you call `.digest()`: `const hashResult = H.digest(); console.log(hashResult.toString(16));`
Verify the script path in your HTML `<script>` tag is correct and that the script loads before any JavaScript code that attempts to use the `_XXH_` global variable.
No dependency data recorded yet.