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

ripemd160-js

v4.0.0

Published

A tiny, zero-dependency RIPEMD-160 implementation for JavaScript and TypeScript.

Readme

RIPEMD1600 logo

ripemd160-js

npm License: MIT Zero Dependencies ESM TypeScript Node Browser Package Size

A tiny, dependency-free, isomorphic RIPEMD-160 implementation for modern JavaScript and TypeScript.

Designed as a minimal cryptographic primitive:

  • ≈2 KB package footprint (gzip & minify)
  • Zero runtime dependencies
  • Native ESM
  • Node.js and browser compatible
  • TypeScript declarations included
  • Uint8Array in, Uint8Array out
  • No Node.js Buffer dependency
  • No WebAssembly runtime required
  • No platform-specific crypto APIs

The package operates directly on bytes, making it suitable for cryptographic, blockchain, protocol, encoding, and binary-data applications where RIPEMD-160 compatibility is required.


Installation

npm install ripemd160-js

Usage

import { ripemd160 } from "ripemd160-js";

const input = new Uint8Array([1, 2, 3]);

const digest = ripemd160(input);

console.log(digest);
// Uint8Array(20)

ripemd160() is synchronous and always returns a 20-byte Uint8Array.


Hashing text

RIPEMD-160 operates on bytes rather than strings.

Use TextEncoder when hashing UTF-8 text:

import { ripemd160 } from "ripemd160-js";

const input = new TextEncoder().encode(
  "the quick brown fox jumps over the lazy dog",
);

const digest = ripemd160(input);

This keeps text encoding explicit and avoids ambiguity between UTF-8, UTF-16, Latin-1, or other encodings.


Converting the digest to hex

The library intentionally returns raw bytes rather than imposing an output encoding.

const hex = Array.from(digest, (byte) =>
  byte.toString(16).padStart(2, "0"),
).join("");

console.log(hex);

For:

the quick brown fox jumps over the lazy dog

the RIPEMD-160 digest is:

704f5bd0a04f44c1f8e5aced93c381db13f1af5b

TypeScript

TypeScript declarations are included with the package.

import { ripemd160 } from "ripemd160-js";

const input: Uint8Array = new TextEncoder().encode("hello");

const digest: Uint8Array = ripemd160(input);

The API is deliberately small:

function ripemd160(input: Uint8Array): Uint8Array;

No additional types, classes, contexts, or platform abstractions are required.


Browser

ripemd160-js uses standard JavaScript typed arrays and can be imported directly into modern browser applications:

import { ripemd160 } from "ripemd160-js";

const data = new TextEncoder().encode("hello");

const digest = ripemd160(data);

There are no Node.js-specific runtime dependencies such as:

Buffer
crypto
stream
process

and no polyfills are required by the RIPEMD-160 implementation itself.


Node.js

The same API works natively in Node.js:

import { ripemd160 } from "ripemd160-js";

const data = new TextEncoder().encode("hello");

const digest = ripemd160(data);

The package uses native ECMAScript modules:

import { ripemd160 } from "ripemd160-js";

CommonJS require() is intentionally not provided.


Why Uint8Array?

Cryptographic hash functions operate on bytes.

Earlier versions of ripemd160-js provided additional conversion behavior for strings and encoded output. The current API reduces the library to the underlying primitive:

Uint8Array → RIPEMD-160 → Uint8Array(20)

This has several advantages:

  • explicit input encoding
  • predictable output
  • smaller implementation
  • simpler TypeScript types
  • fewer platform-specific assumptions
  • easier interoperability with binary protocols
  • no implicit string conversion
  • no dependency on Node.js Buffer

For text:

new TextEncoder().encode("hello");

For hex or other output formats, encode the returned digest according to the requirements of your application.


Minimal by design

ripemd160-js intentionally does one thing:

RIPEMD-160

Isomorphic

The implementation is based entirely on standard ECMAScript primitives including:

Uint8Array
Int32Array
Array
Math
32-bit bitwise operations

As a result, the RIPEMD-160 implementation itself is environment-independent and suitable for environments that support standard JavaScript typed arrays.


API

ripemd160(input)

Calculates the RIPEMD-160 digest of a byte sequence.

Parameters

input: Uint8Array;

The bytes to hash.

Returns

Uint8Array;

A 20-byte RIPEMD-160 digest.

Example

import { ripemd160 } from "ripemd160-js";

const digest = ripemd160(new Uint8Array([1, 2, 3, 4]));

Development

Install development dependencies:

npm install

Build the TypeScript source:

npm run build

Run the test suite:

npm test

Format the project:

npm run prettier:fix

Check the contents that would be published to npm:

npm pack --dry-run

The TypeScript source lives under:

src/

and is compiled into:

dist/

Only the compiled distribution is included in the published npm package.


Compatibility

ripemd160-js is intended for:

  • Node.js
  • browsers
  • TypeScript
  • JavaScript
  • bundlers
  • server-side runtimes
  • client-side applications
  • blockchain and protocol tooling

The distributed JavaScript uses native ECMAScript modules.


RIPEMD-160 security note

RIPEMD-160 is an older cryptographic hash function.

This package exists primarily for compatibility with protocols and systems that specifically require RIPEMD-160, including various blockchain and cryptographic formats.

For new protocols where no compatibility requirement exists, prefer a modern cryptographic hash function appropriate to the security requirements of the application.


License

MIT