wire / encoding / base58

Base58 (Bitcoin alphabet)

Base58 is a binary-to-text encoding that treats the input as one big-endian integer and re-expresses it in base 58 over the alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'. It deliberately omits the visually ambiguous characters 0 (zero), O (capital o), I (capital i) and l (lowercase L), plus '+' and '/', so addresses copy cleanly and double-click-select as one token. Leading zero bytes are encoded as leading '1's. Originated in Bitcoin and is the basis of Base58Check.

encoding kind encoding status de-facto verification verified tier B encoding@1

aka: base-58 · Bitcoin base58 · btc base58

test vectors

Bitcoin Wiki — Base58Check encoding · alphabet: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

inputoutputnote
utf8 ascii Empty input -> empty output (integer 0 with no leading zero bytes).
Hello World! utf8 2NEpo7TZRRrLZSi2U ascii Canonical Bitcoin Wiki example: base58("Hello World!") = "2NEpo7TZRRrLZSi2U".
00000000287fb4cd bytes-hex 1111233QC4 ascii Leading-zero handling: four 0x00 bytes -> four leading '1' characters, then base58 of 0x287fb4cd.
2NEpo7TZRRrLZSi2U ascii Hello World! utf8 Round-trip: base58-decode("2NEpo7TZRRrLZSi2U") = "Hello World!".

provenance

see also

agent: curl -H 'accept: application/json' wire.phall.io/encoding/base58 or /encoding/base58.json