This is a Go language package for encoding and decoding base58 strings. This package supports multiple encodings, flickr, ripple and bitcoin.
package main
import (
"fmt"
"os"
"github.com/itchyny/base58-go"
)
func main() {
encoding := base58.FlickrEncoding // or RippleEncoding or BitcoinEncoding
encoded, err := encoding.Encode([]byte("100"))
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
fmt.Println(string(encoded))
decoded, err := encoding.Decode(encoded)
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
fmt.Println(string(decoded))
}
brew install itchyny/tap/base58
go install github.com/itchyny/base58-go/cmd/base58@latest
$ base58
100
2J
100000000
9QwvW
79228162514264337593543950336
5QchsBFApWPVxyp9C
^D
$ base58 --decode
2J
100
9QwvW
100000000
5QchsBFApWPVxyp9C
79228162514264337593543950336
^D
$ echo 100000000 | base58
9QwvW
$ echo 9QwvW | base58 --decode
100000000
$ echo 100000000 | base58 --encoding=bitcoin
9qXWw
Report bug at Issues・itchyny/base58-go - GitHub.
itchyny (https://github.com/itchyny)
This software is released under the MIT License, see LICENSE.