The `md5.js` package provides an MD5 hashing algorithm implementation written purely in JavaScript, designed to be compatible with Node.js's `crypto` module style. As of its current stable version 1.3.5, it offers a straightforward API for computing MD5 hashes from strings or streams. While it facilitates MD5 computation, it's crucial for developers to acknowledge that the MD5 algorithm is cryptographically compromised, particularly regarding its collision resistance, as highlighted by NIST SP 800-131A. This vulnerability makes it unsuitable for security-sensitive applications such as digital signatures, password hashing, or any scenario where collision resistance is paramount. The package is part of the broader `crypto-browserify` project, which aims to provide Node.js-compatible cryptographic primitives for browser environments, often through polyfills. It maintains a stable, rather than rapid, release cadence, reflecting its mature and foundational utility, despite the inherent cryptographic weaknesses of MD5 itself. Its key differentiator is its pure JavaScript nature, making it universally deployable without native dependencies.
npm install md5.jsVerified import paths — ran on the pinned version, not inferred.
Demonstrates both synchronous string hashing and asynchronous, stream-like processing to compute MD5 hashes, outputting them in hexadecimal format.
For security-critical hashing, migrate to modern cryptographic hash functions like SHA-256, SHA-3, or Argon2 (for password hashing). This package should only be used for legacy compatibility, data integrity checks where collisions are not a security concern, or non-security-critical applications.
If high performance in Node.js is critical and pure JavaScript portability isn't strictly required, consider using `node:crypto`'s native MD5 hashing instead. This package is primarily beneficial for browser environments via bundlers or specific environments where native crypto is unavailable.
For stream-based hashing, use `write()` and `end()` to feed data, then `read()` to obtain the final hash `Buffer`. If integrating with complex stream pipelines, consider adapting to `node:crypto`'s `createHash('md5')` which offers a more robust stream interface.Ensure you are using `const MD5 = require('md5.js')` and then instantiating it with `new MD5()` to create an MD5 object.Add `const MD5 = require('md5.js');` at the top of your JavaScript file or within the appropriate scope before attempting to use the `MD5` symbol.No dependency data recorded yet.