Encodings
Base32
RFC 4648 base32 with A to Z and 2 to 7 padded with = to blocks of eight
Encoding / Base32
Base32
Letters and 2 to 7, survives a case-blind file system.
- Overhead
- +60% on random bytes
- Padding
- = to a whole block
- Standard
- RFC 4648 §6
- Used by
- TOTP secrets, Onion v3
family 4 / 20
Sample
- Out
- NBSWY3DPEB3W64TMMQQQ====
- Back
- "hello world!"
ABCDEFGHIJKLMNOPQRSTUVWXYZ234567
Access
- Import
import { base32 } from "@agntn/encodings/base32" - CLI
encodings encode base32 'hello world!' - Tryplayground with the sample above
- Kinbase32hex, base32-crockford, z-base-32
Letters and the digits 2 to 7. It survives a file system that ignores case. It survives a person who confuses 0 with O, too. The secret behind your authenticator app? Base32. Onion v3 addresses as well.
encode("base32", "foobar"); // "MZXW6YTBOI======"
That's the RFC 4648 test vector. Five bytes become eight characters, and the last block pads with =. Decoding takes lowercase and the text with or without padding. Wrong padding is an error, though. Six = where the length needs four means something got mangled on the way.