This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
md5-hex with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Create a MD5 hash with hex encoding
Please don't use MD5 hashes for anything sensitive!
Works in the browser too, when used with a bundler like Webpack, Rollup, Browserify.
hasha if you need something more flexible.
$ npm install md5-hex
const fs = require('fs'); const md5Hex = require('md5-hex'); const buffer = fs.readFileSync('unicorn.png'); md5Hex(buffer); //=> '1abcb33beeb811dca15f0ac3e47b88d9'
Buffer | string | Array<Buffer | string>
Prefer buffers as they're faster to hash, but strings can be useful for small things.
Pass an array instead of concatenating strings and/or buffers. The output is the same, but arrays do not incur the overhead of concatenation.