cryptocoinjs / bs58

Base58 encoding/decoding for Bitcoin
http://cryptocoinjs.com/modules/misc/bs58/
MIT License
216 stars 48 forks source link

Update tests and documentation for v4 #27

Closed sonicdoe closed 7 years ago

sonicdoe commented 7 years ago

Since v4.0.0, decode returns a Buffer.

fanatid commented 7 years ago

nice, I wanted do this, but you first :) please add output for out <Buffer 00 3c 17 6e 65 9b ea 0f 29 a3 e9 bf 78 80 c1 12 b1 b3 1b 4d c8 26 26 81 87>

sonicdoe commented 7 years ago
var bs58 = require('bs58')

var address = "16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS"
var out = bs58.decode(address)
console.log(out)
// => <Buffer 00 3c 17 6e 65 9b ea 0f 29 a3 e9 bf 78 80 c1 12 b1 b3 1b 4d c8 26 26 81 87>

Like this? Or would you like to have console.log(out) in addition to console.log(out.toString('hex'))?

fanatid commented 7 years ago

ah, sorry.. lets stay with

var bs58 = require('bs58')

var address = "16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS"
var out = bs58.decode(address)
console.log(out.toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187
sonicdoe commented 7 years ago

Okay, updated.

fanatid commented 7 years ago

Thank you!