Weekly downloads
Readme
JavaScript component to compute base 58 encoding. This encoding is typically used for crypto currencies such as Bitcoin.
Note: If you're looking for base 58 check encoding, see: https://github.com/bitcoinjs/bs58check, which depends upon this library.
npm i --save bs58
input
must be a Uint8Array
, Buffer
, or an Array
. It returns a string
.
example:
const bs58 = require('bs58')
const bytes = Uint8Array.from([
0, 60, 23, 110, 101, 155, 234,
15, 41, 163, 233, 191, 120, 128,
193, 18, 177, 179, 27, 77, 200,
38, 38, 129, 135
])
const address = bs58.encode(bytes)
console.log(address)
// => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
input
must be a base 58 encoded string. Returns a Uint8Array.
example:
const bs58 = require('bs58')
const address = '16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS'
const bytes = bs58.decode(address)
// See uint8array-tools package for helpful hex encoding/decoding/compare tools
console.log(Buffer.from(bytes).toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187
You can use this module in the browser. Install Browserify:
npm install -g browserify
then run:
browserify node_modules/bs58/index.js -o bs58.bundle.js --standalone bs58
Uses JavaScript standard style. Read more:
bigi
as a dependencyMIT
FAQs
Base 58 encoding / decoding
The npm package bs58 receives a total of 931,718 weekly downloads. As such, bs58 popularity was classified as popular.
We found that bs58 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.