blakejs provides a pure JavaScript implementation of the BLAKE2b and BLAKE2s cryptographic hash functions. It is currently at version 1.2.1 and appears to be in an active maintenance state, receiving updates as needed for bug fixes or minor enhancements rather than following a strict time-based release cadence. Its primary differentiator is its full compatibility with browser environments without requiring WebAssembly or native Node.js modules, making it an easy choice for client-side hashing. While it offers solid cryptographic security similar to SHA2 and SHA3, its pure JavaScript nature means it sacrifices performance compared to native or WASM alternatives, especially in server-side (Node.js) contexts. It's designed to be compact, with less than 500 lines of code, and easy to integrate, particularly for browser-based applications where native wrappers are not an option.
npm install blakejsVerified import paths — ran on the pinned version, not inferred.
Demonstrates both synchronous (hex string and Uint8Array) and streaming BLAKE2b/BLAKE2s hashing with optional keys, using an ESM import pattern.
For Node.js, use `node-blake2`. For browsers with WASM support, consider `blake2.wasm` for better performance.
Use hardware-accelerated or native cryptographic libraries for operations involving highly sensitive cryptographic keys in untrusted environments.
For inputs exceeding 2^53 bytes, an alternative hashing solution or custom streaming logic capable of handling such scale would be required, though this is an extreme edge case.
Ensure `outlen` and `key` array lengths passed to `blake2b*` functions are <= 64 bytes, and for `blake2s*` functions, <= 32 bytes.
Use `import * as blake from 'blakejs';` for ESM environments, or ensure your file is treated as a CommonJS module.
Ensure you are using `import * as blake from 'blakejs';` (ESM) or `const blake = require('blakejs');` (CJS), and then access functions via `blake.blake2bHex`.Convert the input data to an accepted type before passing it to `blakejs` functions. For example, use `new TextEncoder().encode('your string')` to convert a string to a `Uint8Array`.Adjust the `outlen` parameter to be less than or equal to 64 bytes for BLAKE2b functions, or less than or equal to 32 bytes for BLAKE2s functions.
No dependency data recorded yet.