Expand description
Chunk header per SPEC v0.30 §2.2.
Encodes the 37-bit chunked wire-format header. First-symbol layout
MSB-first: [v3][v2][v1][v0][chunked] (4-bit version + 1-bit chunked-flag).
Remainder: 20-bit chunk-set-id + 6-bit count-minus-1 + 6-bit index.
Total = 4 + 1 + 20 + 6 + 6 = 37 bits.
v0.34.0: also hosts decode_with_correction — the BCH-error-correcting
decode entry point. Per chunk: parse → polymod-residue → (if non-zero)
call crate::bch_decode::decode_regular_errors → apply corrections →
re-encode → forward to reassemble. Atomic per plan §1 D28: any chunk
exceeding the BCH t = 4 capacity fails the whole call without partial
output.
Structs§
- Chunk
Header - Wire header for a single chunk in a chunked v0.30 payload.
- Correction
Detail - Per-correction report emitted by
decode_with_correction. One entry per repaired character.positionis 0-indexed into the codex32 data-part (i.e. the characters following themd1HRP + separator);wasis the original (corrupted) char from the input;nowis the corrected char.
Constants§
- SINGLE_
STRING_ PAYLOAD_ BIT_ LIMIT - Per-chunk payload sizing budget (in payload bits) that
splituses to choose the chunk count:count = ceil(padded_payload_bits / 320). It is 64 data symbols (64 × 5 = 320 bits), deliberately BELOW the codex32 regular single-string data cap of 80 symbols / 400 bits (enforced bycrate::codex32::wrap_payload), so each chunk’s 37-bit header fits alongside the fragment inside one regular-code codeword.
Functions§
- decode_
with_ correction - BCH-error-correcting decode for a chunk-set of md1 strings.
- derive_
chunk_ set_ id - Derive the 20-bit chunk-set-id from a
Md1EncodingIdby taking the top 20 bits of the underlying 16-byte hash, MSB-first. - reassemble
- Reassemble a
Descriptorfrom N md1 codex32 strings. - split
- Split a
Descriptorinto N codex32 md1 strings, each carrying a chunk header and a slice of the canonical payload.