Skip to main content

Module encode

Module encode 

Source
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 Descriptor into the canonical payload bit stream and return (bytes, total_bit_count). The bytes are zero-padded; total_bit_count is the exact unpadded length needed for round-trip decoding (see §3.7’s “TLV section ends when codex32 total-length is exhausted” rule).
render_codex32_grouped
Render a codex32 string with optional N-char hyphen grouping for transcription aid. Per spec §10.2, every 4-5 chars optionally separated by - for human readability. group_size = 0 returns the input unchanged (no grouping).