root 7621d6d22a 221005-1449-Kim | 2 лет назад | |
---|---|---|
.. | ||
CHANGELOG.md | 2 лет назад | |
README.md | 2 лет назад | |
index.js | 2 лет назад | |
package.json | 2 лет назад |
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 Buffer or an Array
. It returns a string
.
example:
const bs58 = require('bs58')
const bytes = Buffer.from('003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187', 'hex')
const address = bs58.encode(bytes)
console.log(address)
// => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
input
must be a base 58 encoded string. Returns a Buffer.
example:
const bs58 = require('bs58')
const address = '16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS'
const bytes = bs58.decode(address)
console.log(out.toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187
Uses JavaScript standard style. Read more:
bigi
as a dependencyMIT