Skip to content

md-codec v0.34.0 — public BCH primitives + decode_with_correction

Choose a tag to compare

@bg002h bg002h released this 18 May 00:59

Tranche B Phase B.1 + B.2 of the v0.22.x follow-ups cycle. Promotes md-codec's BCH primitives to the public API and adds a full-decode-semantic decode_with_correction for downstream sibling-codec + toolkit consumers.

What's new

  • Public BCH surfacebch::{GEN_REGULAR, MD_REGULAR_CONST, polymod_run, hrp_expand, bch_create_checksum_regular, bch_verify_regular} now pub. Lifts the visibility gate that blocked toolkit + ms-codec from consuming these primitives without forking.
  • bch_decode module — vendored Berlekamp-Massey + Chien + Forney + Gf32/Gf1024 (~450 LOC prod + ~100 LOC tests; constant-agnostic body parameterized on MD_REGULAR_CONST). Mirrors mk_codec::string_layer::bch_decode byte-equivalent under parity-smoke against mnemonic-toolkit-v0.22.1.
  • chunk::decode_with_correction(strings: &[&str]) -> Result<(Descriptor, Vec<CorrectionDetail>), Error> — full-decode semantics (Q1 lock): BCH-corrects each chunk then runs the existing decoder. Atomic per chunk per D28 (any chunk failing capacity bound → entire call fails with chunk_index named).
  • New Error::TooManyErrors { chunk_index: usize, bound: u8 } variant for BCH-correction-capacity failures.

Closes FOLLOWUPs

  • md-codec-decode-with-correction-public-api (toolkit + this repo)

Files new at this release

2 visibility-pin/parity tests + 1 unit test file (bch_decode.rs)
+550 LOC bch_decode.rs prod
+190 LOC chunk.rs (decode_with_correction)

Lockstep

🤖 Released as part of the v0.22.x follow-ups cycle (Tranche B close).