Detalhes do pacote

ripple-bs58

you219798.5kMIT4.0.1

Base 58 encoding / decoding

base58, ripple, crypto, crytography

readme (leia-me)

ripple-bs58

build status

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/ripple-bs58check, which depends upon this library.

Install

npm i --save ripple-bs58

API

encode(input)

input must be a Buffer or an Array. It returns a string.

example:

const bs58 = require('ripple-bs58')

const bytes = Buffer.from('003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187', 'hex')
const address = bs58.encode(bytes)
console.log(address)
// => ra7jcY4BG9GTKhuqpCfyYNbu5CqUzoLMGS

decode(input)

input must be a base 58 encoded string. Returns a Buffer.

example:

const bs58 = require('ripple-bs58')

const address = 'ra7jcY4BG9GTKhuqpCfyYNbu5CqUzoLMGS'
const bytes = new Buffer(bs58.decode(address))
console.log(bytes.toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187

Hack / Test

Uses JavaScript standard style. Read more:

js-standard-style

Credits

License

MIT

changelog (log de mudanças)

4.0.0 / 2016-12-3

3.0.0 / 2015-08-18

  • refactored module into generic base-x.

2.0.1 / 2014-12-23

  • performance boost in encode() #10

2.0.0 / 2014-10-03

1.2.1 / 2014-07-24

1.2.0 / 2014-06-29

1.1.0 / 2014-06-26

  • user Buffer internally for calculations, providing cleaner code and a performance increase. Daniel Cousens

1.0.0 / 2014-05-27

  • removed binstring dep, Buffer now only input to encode() and output of decode()
  • update bigi from ~0.3.0 to ^1.1.0
  • added travis-ci support
  • added coveralls support
  • modified tests and library to handle fixture style testing (thanks to bitcoinjs-lib devs and Daniel Cousens)

0.3.0 / 2014-02-24

  • duck type input to encode and change output of decode to Buffer.

0.2.1 / 2014-02-24

  • removed bower and component support. Closes #1
  • convert from 4 spaces to 2

0.2.0 / 2013-12-07

  • renamed from cryptocoin-base58 to bs58

0.1.0 / 2013-11-20

  • removed AMD support

0.0.1 / 2013-11-04

  • initial release