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 🙏

© 2024 – Pkg Stats / Ryan Hefner

noble-base58check

v0.1.4

Published

Noble base58check. Typed, native, 0-dep port of bs58check module.

Downloads

24

Readme

noble-base58check Node CI code style: prettier

Base58Check, a modified Base 58 binary-to-text encoding known as Base58Check is used for encoding Bitcoin addresses. More generically, Base58Check encoding is used for encoding byte arrays in Bitcoin into human-typable strings.

Port of bs58check module.

This library belongs to noble crypto

noble-crypto — high-security, easily auditable set of contained cryptographic libraries and tools.

  • No dependencies, one small file
  • Easily auditable TypeScript/JS code
  • Uses es2020 bigint. Supported in Chrome, Firefox, Safari, node 10+
  • All releases are signed and trusted
  • Check out all libraries: secp256k1, ed25519, bls12-381, ripemd160

Usage

Node:

npm install noble-base58check
import * as b58c from "noble-base58check";
import { strictEqual } from "assert";

const hash = "1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i";
(async () => {
  const bytes = await b58c.decode(hash);
  const sameHash = await b58c.encode(bytes);
  strictEqual(sameHash, hash);
})();

Deno:

import * as b58c from "https://deno.land/x/base58check/mod.ts";
import { assertEquals } from "https://deno.land/x/testing/asserts.ts";

const hash = "1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i";
const bytes = await b58c.decode(hash);
const sameHash = await b58c.encode(bytes);
assertEquals(sameHash, hash);

Library: https://deno.land/x/base58check

API

decode(string)
function decode(string: string): Promise<Uint8Array>;
  • string: string - string to decode with Base58Check
  • Returns Promise<Uint8Array>: decoded bytes
encode(payload)
function encode(payload: Uint8Array): Promise<string>;
  • payload: Uint8Array - payload to encode with Base58Check
  • Returns Promise<string>: encoded string
decodeUnsafe(string)
function decodeUnsafe(string: string): Promise<Uint8Array | undefined>;
  • string: string - string to decode with Base58Check
  • Returns Promise<Uint8Array | undefined>: Promise<Uint8Array> if success; otherwise Promise<undefined>
decodePlain(string)
function decodePlain(string: string): Promise<Uint8Array>;
  • string: string - string to decode with plain Base58 (without check)
  • Returns Promise<Uint8Array>: decoded bytes
encodePlain(payload)
function encodePlain(payload: Uint8Array): Promise<string>;
  • payload: Uint8Array - payload to encode with plain Base58 (without check)
  • Returns Promise<string>: encoded string
decodePlainUnsafe(string)
function decodePlainUnsafe(string: string): Promise<Uint8Array | undefined>;
  • string: string - string to decode with plain Base58 (without check)
  • Returns Promise<Uint8Array | undefined>: Promise<Uint8Array> if success; otherwise Promise<undefined>
decodeRaw(buffer)
function decodeRaw(buffer: Uint8Array): Promise<Uint8Array | undefined>;
  • buffer: Uint8Array - payload to encode with plain Base58 (without check)
  • Returns Promise<Uint8Array | undefined>: Promise<Uint8Array> payload without last 4 bytes if checksum valid; otherwise Promise<undefined>
getChecksum(buffer)
function getChecksum(buffer: Uint8Array): Promise<Uint8Array>;
  • buffer: Uint8Array - payload
  • Returns Promise<Uint8Array>: checksum (double sha256)

Inspiration

Contributing

  1. Clone the repository.
  2. npm install to install build dependencies like TypeScript
  3. npm run compile to compile TypeScript code
  4. npm run test to run jest on test/index.ts

License

MIT (c) Serhii Pashchenko (https://serh11p.com), see LICENSE file.