Socket
Book a DemoInstallSign in
Socket

micro-base58

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-base58

Fast and beautiful base58 encoder without dependencies.

latest
Source
npmnpm
Version
0.5.1
Version published
Weekly downloads
151
0.67%
Maintainers
1
Weekly downloads
 
Created
Source

micro-base58

Fast and beautiful base58 encoder without dependencies.

Deprecated. Switch to micro-base for audited version of base58 and others.

npm install micro-base58

Usage: base58(text[, alphabet]).

Included alphabets: ipfs/btc (default), xrp, xmr, flickr

First argument could be string, Buffer or UInt8Array.

const base58 = require('micro-base58');

base58('hello world'); // => 'StV1DL6CwTryKyV'
new Uint8Array(Array.from('hello world').map(c => c.charCodeAt(0))) // Browser
// => 'StV1DL6CwTryKyV'
base58('hello world', 'xrp'); // => 'StVrDLaUATiyKyV'

We don't include base58check because it requires sha256. You can implement it like this:

function base58check(array) {
  const checksum = sha256(sha256(array)).slice(0, 4);
  const data = new Uint8Array(array.length + 4);
  data.set(array);
  data.set(checksum, array.length)
  return base58(data);
}

License

MIT License (c) 2020, Paul Miller (https://paulmillr.com).

See LICENSE file.

Keywords

base58

FAQs

Package last updated on 15 Oct 2021

Did you know?

Socket

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