Expand description
Top-level encoder per spec §13.3.
Structs§
- Descriptor
- Top-level descriptor parsed/built from a v0.30 wire payload.
Functions§
- encode_
md1_ string - Encode a Descriptor into a complete codex32 md1 string (HRP + payload + BCH checksum). Returns the canonical single-string form.
- encode_
payload - Encode a
Descriptorinto the canonical payload bit stream and return(bytes, total_bit_count). The bytes are zero-padded;total_bit_countis the exact unpadded length needed for round-trip decoding (see §3.7’s “TLV section ends when codex32 total-length is exhausted” rule). - is_
display_ separator - True for any character treated as a display separator on intake: ALL Unicode
whitespace plus
-and,. SPEC §3.2 (mstring display-grouping). None of these appear in the codex32 alphabet (qpzry9x8gf2tvdw0s3jn54khce6mua7l) or thems/mk/md/1structural chars (SPEC §4), so stripping is unambiguous. - render_
codex32_ grouped - Render a codex32 string with optional N-char HYPHEN grouping for
transcription aid (spec §10.2).
group_size = 0returns the input unchanged. Back-compat wrapper overrender_grouped(hyphen separator). Retained as public API (documented in the technical manual); new callers userender_groupedwith an explicit separator. - render_
grouped - Insert
separatorafter everygroup_sizecharacters (SPEC §3.1).group_size == 0returns the input unchanged. Single line; ASCII-safe. - strip_
display_ separators - Strip every display separator (SPEC §3.2) — used on intake before decode. Idempotent; strips ONLY separators (other chars pass through, so a malformed card is never silently “cleaned” into validity).