Socket
Socket
Sign inDemoInstall

md5-hex

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    md5-hex

Create a MD5 hash with hex encoding


Version published
Weekly downloads
745K
decreased by-1.45%
Maintainers
1
Install size
32.4 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 22 Oct 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc