Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

/p/nym-moultest123/x/daily/base32/v0

Directory · 4 Files
README.md Open

gno.land/p/nym-moultest123/x/daily/base32/v0

RFC 4648 and Crockford base32 — Encode, EncodeUnpadded, EncodeCrockford, Decode, DecodeCrockford.

1import "gno.land/p/nym-moultest123/x/daily/base32/v0"
2
3base32.Encode("foobar")           // "MZXW6YTBOI======"
4base32.EncodeCrockford("hello")   // "D1JPRV3F"
5base32.DecodeCrockford("d1-jprv3f")  // "hello" — case folded, hyphen ignored

Two alphabets, for two different jobs. RFC 4648 (A–Z, 2–7, = padding) is the interoperable one — use it when something else has to decode the result. Crockford (0–9, A–Z minus I, L, O, U) is designed to be read aloud and typed back: decoding folds case, reads I/L as 1 and O as 0, and ignores hyphens, so a mis-heard identifier still decodes. U is excluded to avoid accidental obscenities.

Verified against the RFC 4648 §10 vectors at every partial-group length, and the demo's pinned output is that vector set — so the example doubles as a conformance test.

Decoding is strict where it matters: leftover bits after the final byte must be zero padding, never data, so "MB" is rejected rather than silently truncated. It is lenient where it is safe: lowercase and missing padding are accepted.

Base32 costs 60% expansion (8 characters per 5 bytes) against base64's 33%. You pay that to get an alphabet that survives case-insensitive systems and the telephone.

Live demo: r/moul/x/daily/base32demo · render it at /r/nym-moultest123/x/daily/base32demo/v0.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.