1. md5-hex
Create a MD5 hash with hex encoding
md5-hex
Package: md5-hex
Created by: sindresorhus
Last modified: Sun, 22 Oct 2023 19:10:24 GMT
Version: 5.0.0
License: MIT
Downloads: 3,159,298
Repository: https://github.com/sindresorhus/md5-hex

Install

npm install md5-hex
yarn add md5-hex

md5-hex

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).

Checkout hasha if you need something more flexible.

Install

 npm install md5-hex

Usage

 import fs from 'node:fs';
import md5Hex from 'md5-hex';

const buffer = fs.readFileSync('unicorn.png');

md5Hex(buffer);
//=> '1abcb33beeb811dca15f0ac3e47b88d9'

API

md5Hex(data)

data

Type: 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.

  • crypto-hash - Tiny hashing module that uses the native crypto API in Node.js and the browser
  • hasha - Hashing made simple
  • hash-obj - Get the hash of an object

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code