Encodings
Crockford's Base32
Base32 for people without I and L and O and U. Decoding forgives look-alikes and hyphens
Encoding / Base32
Crockford's Base32
Base32 for people: no I, L, O or U to misread.
- Overhead
- +60% on random bytes
- Padding
- none
- Standard
- Douglas Crockford, Base32 (crockford.com/base32.html)
- Used by
- ULID
family 4 / 20
Sample
- Out
- D1JPRV3F41VPYWKCCGGG
- Back
- "hello world!"
0123456789ABCDEFGHJKMNPQRSTVWXYZ
Access
- Import
import { base32crockford } from "@agntn/encodings/base32" - CLI
encodings encode base32-crockford 'hello world!' - Tryplayground with the sample above
- Kinbase32, base32hex, z-base-32
Douglas Crockford's take on base32. No I, L, O or U. Nothing reads as something else. And nothing spells a rude word by accident, which is why U had to go. ULIDs use this alphabet.
encode("base32-crockford", "foobar"); // "CSQPYRK1E8"
decode("base32-crockford", "csqp-yrki-e8");
// the same six bytes: lowercase, hyphens, and i read as 1
Decoding ignores case and hyphens. It reads O as 0 and I or L as 1. Lenient? No, that's the spec. This is the byte encoding. Crockford also defines a number encoding with a check symbol, which isn't here.