npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pure-md5

v1.0.0

Published

A lightweight JavaScript function for hashing messages by the MD5 algorithm

Readme

pure-md5

A lightweight, zero-dependency MD5 hashing library for Node.js and browsers.

npm version npm downloads Coverage Status License: MIT


Install

npm install pure-md5

Quick Start

import { md5 } from 'pure-md5';

md5('hello'); // "5d41402abc4b2a76b9719d911017c592"

For the smallest possible bundle, import from the minimal entry:

import { md5 } from 'pure-md5/md5'; // ~1.5 KB gzipped

Streaming & File Hashing

import { hashFile, createMD5Stream } from 'pure-md5/stream';

// Hash a file
const result = await hashFile('large-file.bin');
console.log(result.digest); // "abc123..."

// Stream API
import fs from 'fs';
const stream = createMD5Stream();
stream.on('md5', r => console.log('MD5:', r.digest));
fs.createReadStream('large-file.bin').pipe(stream);

Binary Data

import { md5Buffer } from 'pure-md5';

const data = new Uint8Array([0x00, 0xFF, 0x80]);
md5Buffer(data); // correct hash for raw bytes

Features

  • Zero dependencies — no external packages, ever
  • ~1.5 KB gzipped for md5() (tree-shakeable)
  • Streaming — hash multi-GB files without loading into memory
  • TypeScript — full type definitions included
  • Universal — works in Node.js and browsers
  • Binary-safe — correct hashes for non-UTF-8 byte data

API

md5(message: string): string

Compute MD5 hash of a string (UTF-8 encoded).

import { md5 } from 'pure-md5';
md5('hello'); // "5d41402abc4b2a76b9719d911017c592"

md5Buffer(data: Uint8Array | ArrayBuffer): string

Compute MD5 hash of binary data.

import { md5Buffer } from 'pure-md5';
md5Buffer(new Uint8Array([104, 101, 108, 108, 111])); // "5d41402abc4b2a76b9719d911017c592"

md5Async(message: string): Promise<string>

Async wrapper with automatic backend selection.

import { md5Async } from 'pure-md5';
await md5Async('hello'); // "5d41402abc4b2a76b9719d911017c592"

Streaming API (pure-md5/stream)

| Function | Description | |----------|-------------| | hashFile(path, options?) | Hash a file asynchronously with optional progress | | hashFileDigest(path) | Hash a file, return digest only | | hashFileSync(path) | Synchronous file hash (small files) | | verifyFile(path, expected) | Verify file integrity | | createMD5Stream() | Create a Node.js Transform stream | | pipeThroughMD5(source) | Pipe a stream through MD5, get a promise | | fromStream(stream) | Create stream + result promise pair | | createProgressTracker(total, cb) | Progress callback helper |

import { hashFile, createProgressTracker } from 'pure-md5/stream';

const result = await hashFile('video.mp4', {
  onProgress: createProgressTracker(fileSize, pct => console.log(`${pct}%`))
});

WHATWG Streams (Browser)

import { MD5ReadableStream, hashBlob } from 'pure-md5/stream';

// Hash a Blob
const digest = await hashBlob(fileBlob);

// Hash a ReadableStream
const result = await MD5ReadableStream.hash(readableStream);

Backend Adapters

import { NodeCryptoBackend, BrowserBackend, PureJSBackend } from 'pure-md5';

const backend = new NodeCryptoBackend();
await backend.hash('hello');

Use pure-md5/detect for backend detection and fallback utilities.


Comparison

| Feature | pure-md5 | js-md5 | crypto-js | node-md5 | Node crypto | |---------|----------|--------|-----------|----------|-------------| | MD5 only size | ~1.5 KB¹ | ~3 KB | ~68 KB² | ~3 KB | N/A | | Dependencies | 0 | 0 | 0 | 0 | 0 | | Streaming | ✅ | ❌ | ❌ | ❌ | ✅ | | Browser | ✅ | ✅ | ✅ | ❌ | ❌ | | TypeScript | ✅ | ⚠️ | ❌ | ❌ | ❌ | | Binary-safe | ✅ | ✅ | ✅ | ✅ | ✅ | | Tree-shaking | ✅ | ❌ | ❌ | ❌ | N/A |

¹ With import { md5 } from 'pure-md5/md5' ² crypto-js is a monolithic bundle


CDN

<script type="module">
  import { md5 } from 'https://esm.sh/pure-md5';
  console.log(md5('hello'));
</script>

Documentation


Contributing

See Contributing Guide.

git clone https://github.com/eustatos/pure-md5.git
cd pure-md5
npm install
npm test

License

MIT — see LICENSE.md.