wire / encoding / base32

Base32 (RFC 4648 §6)

Base32 maps every 5 input bytes (40 bits) to 8 ASCII characters drawn from a 32-symbol alphabet (A–Z and 2–7), padding the final group with '=' to a multiple of 8 characters. It trades density for a case-insensitive, human-transcribable alphabet that omits the easily confused 0/1/8/9, which is why it backs TOTP/HOTP secrets (RFC 4226/6238) and onion addresses.

encoding kind encoding status standard verification verified tier A encoding@1

aka: base-32 · RFC 4648 base32

test vectors

RFC4648 · alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ234567

inputoutputnote
utf8 ascii RFC 4648 §10 test vector: BASE32("") = "".
f utf8 MY====== ascii RFC 4648 §10 test vector: BASE32("f") = "MY======".
fo utf8 MZXQ==== ascii RFC 4648 §10 test vector: BASE32("fo") = "MZXQ====".
foo utf8 MZXW6=== ascii RFC 4648 §10 test vector: BASE32("foo") = "MZXW6===".
foob utf8 MZXW6YQ= ascii RFC 4648 §10 test vector: BASE32("foob") = "MZXW6YQ=".
fooba utf8 MZXW6YTB ascii RFC 4648 §10 test vector: BASE32("fooba") = "MZXW6YTB" (5 bytes -> 8 chars, no padding).
foobar utf8 MZXW6YTBOI====== ascii RFC 4648 §10 test vector: BASE32("foobar") = "MZXW6YTBOI======".
MZXW6YTBOI====== ascii foobar utf8 Round-trip: BASE32-decode("MZXW6YTBOI======") = "foobar".

provenance

see also

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