3 I copied this package from https://github.com/jbenet/go-base58
4 which in turn came from https://github.com/conformal/btcutil
5 to provide a simple base58 package that
6 - defaults to base58-check (btc)
7 - and allows using different alphabets.
8 - and returns an error on decoding problems to be
9 compatible with the `encoding/*` packages in stdlib
18 b58 "github.com/tendermint/go-wire/data/base58"
22 buf := []byte{255, 254, 253, 252}
23 fmt.Printf("buffer: %v\n", buf)
25 str := b58.Encode(buf)
26 fmt.Printf("encoded: %s\n", str)
28 buf2, err := b58.Decode(str)
32 fmt.Printf("decoded: %v\n", buf2)
43 b58 "github.com/tendermint/go-wire/data/base58"
46 const BogusAlphabet = "ZYXWVUTSRQPNMLKJHGFEDCBAzyxwvutsrqponmkjihgfedcba987654321"
49 func encdec(alphabet string) {
50 fmt.Printf("using: %s\n", alphabet)
52 buf := []byte{255, 254, 253, 252}
53 fmt.Printf("buffer: %v\n", buf)
55 str := b58.EncodeAlphabet(buf, alphabet)
56 fmt.Printf("encoded: %s\n", str)
58 buf2, err := b58.DecodeAlphabet(str, alphabet)
62 fmt.Printf("decoded: %v\n\n", buf2)
67 encdec(b58.BTCAlphabet)
68 encdec(b58.FlickrAlphabet)
76 Package base58 (and the original btcutil) are licensed under the ISC License.