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

ts-base58

v1.0.0

Published

TypeScript port of deemru/b58 — Bitcoin-alphabet Base58 encoding.

Readme

ts-base58

A direct TypeScript port of deemru/b58 — Bitcoin-alphabet Base58 encoding.

If you find this project useful, you can support this and further ports at ko-fi.com/scottmoore0.

Upstream provenance

This package is a TypeScript port of deemru/b58 (b58.c, b58.h) by Dmitrii Pichulin, MIT License.

The translated output is validated against canonical Bitcoin Base58 test vectors including the standard "Hello World!" → "2NEpo7TZRRrLZSi2U" reference plus encode-then-decode round-trips on arbitrary 32-byte inputs (simulates a private key).

Why this exists

Base58 is the encoding used for Bitcoin addresses, IPFS CIDs (v0), Solana public keys, Monero addresses, Stellar account IDs, Ripple, and many cryptocurrency / decentralised-system identifiers. The 58-character alphabet excludes 0, O, I, l to avoid visually-ambiguous characters when transcribing by hand. This is not base58check (which adds a 4-byte SHA-256-SHA-256 checksum) — for that, layer a SHA-256 (via ts-sha2) on top.

Install

npm install ts-base58

Usage

import { base58Encode, base58Decode } from 'ts-base58';

base58Encode(new TextEncoder().encode('Hello World!'));
// '2NEpo7TZRRrLZSi2U'

const decoded = base58Decode('2NEpo7TZRRrLZSi2U');
new TextDecoder().decode(decoded);
// 'Hello World!'

// Encoding a Bitcoin-style 32-byte private key
const privkey = new Uint8Array(32);
crypto.getRandomValues(privkey);
const wif = base58Encode(privkey);

API surface

  • base58Encode(input: Uint8Array | string): string — encode to Base58.
  • base58Decode(input: string): Uint8Array — decode from Base58.

Both empty-input and leading-zero (0x00... prefix) inputs are handled correctly — Base58 encodes leading zero bytes as leading '1' characters.

Reference values

The test suite asserts against canonical Bitcoin Base58 vectors:

| Bytes | Base58 | |---|---| | (empty) | (empty) | | 0x00 | 1 | | 0x00 0x00 | 11 | | 0x61 | 2g | | 0x62 0x62 0x62 | a3gV | | 0x63 0x63 0x63 | aPEr | | "Hello World!" | 2NEpo7TZRRrLZSi2U | | "The quick brown fox jumps over the lazy dog." | USm3fpXnKG5EUBx2ndxBDMPVciP5hGey2Jh4NDv6gmeo1LkMeiKrLJUUBk6Z |

Plus round-trip checks (32-byte simulated private key) and alphabet sanity (no 0, O, I, l characters in output).

Run:

npm test

Caveats

  • Not base58check. This is plain Base58 — no checksum. For Bitcoin addresses use base58check by appending a 4-byte SHA-256-SHA-256 checksum before encoding (build it with ts-sha2).
  • Not Flickr / Ripple alphabets. This is the Bitcoin alphabet: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz. Other Base58 variants (Flickr swaps letter case order; Ripple uses a different ordering) need a different package or post-processing.
  • Performance. Base58 encoding is O(n²) in the input length due to the carrying-into-arbitrary-precision-arithmetic nature of the algorithm. Fine for keys/hashes (typically 32 bytes); slower for very long inputs.

License

MIT. Original C by Dmitrii Pichulin under MIT.

See also