
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
A simple and fast MD5 hash function for JavaScript supports UTF-8 encoding.
MD5 Online
MD5 File Checksum Online
jsPerf Benchmark
File Benchmark
You can also install js-md5 by using Bower.
bower install md5
For node.js, you can use this command to install:
npm install js-md5
buffer method is deprecated. This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
You could use like this:
md5('Message to hash');
var hash = md5.create();
hash.update('Message to hash');
hash.hex();
// HMAC
md5.hmac('key', 'Message to hash');
var hash = md5.hmac.create('key');
hash.update('Message to hash');
hash.hex();
If you use node.js, you should require the module first:
var md5 = require('js-md5');
If you use TypeScript, you can import like this:
import { md5 } from 'js-md5';
It supports AMD:
require(['your/path/md5.js'], function(md5) {
// ...
});
md5(''); // d41d8cd98f00b204e9800998ecf8427e
md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
// It also supports UTF-8 encoding
md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
md5([]); // d41d8cd98f00b204e9800998ecf8427e
md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
// Different output
md5(''); // d41d8cd98f00b204e9800998ecf8427e
md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.arrayBuffer(''); // ArrayBuffer
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
md5.base64(''); // 1B2M2Y8AsgTpgAmY7PhCfg==
// HMAC
md5.hmac.hex('key', 'Message to hash');
md5.hmac.array('key', 'Message to hash');
// ...
The project is released under the MIT license.
The project's website is located at https://github.com/emn178/js-md5
Author: Chen, Yi-Cyuan (emn178@gmail.com)
Crypto-js is a widely-used library that provides a variety of cryptographic algorithms, including MD5, SHA-1, SHA-256, and more. It is more comprehensive than js-md5, offering a broader range of cryptographic functionalities.
The md5 package is another popular library for generating MD5 hashes. It is similar to js-md5 in terms of functionality but is often preferred for its simplicity and ease of use.
Hash.js is a library that provides a variety of hash functions, including MD5, SHA-1, and SHA-256. It is known for its performance and flexibility, making it a good alternative to js-md5 for more complex hashing needs.
FAQs
A simple MD5 hash function for JavaScript supports UTF-8 encoding.
The npm package js-md5 receives a total of 137,118 weekly downloads. As such, js-md5 popularity was classified as popular.
We found that js-md5 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.