Expand description
BIP 93 codex32 BCH primitives for HRP "ms" (regular code only).
Vendored from md-codec’s structure at the v0.34.0 promotion (descriptor-mnemonic
commit 94069ea) per plan §2.B.2 / D22. ms1 strings are all regular-code length
per consts::VALID_STR_LENGTHS, so the long-code primitives are intentionally
absent (mk-codec carries the long-code variants).
All public per plan D22 (no pub(crate) half-private items in ms-codec): the
downstream bch_decode module (B.4) re-declares the 3 internal consts locally
per the Q3 lock — they stay bare-private here.
The MS_REGULAR_CONST value is byte-exact with the toolkit’s vendored copy at
mnemonic-toolkit/crates/mnemonic-toolkit/src/repair.rs:42 per Phase B.0 (e)
cross-check. The toolkit’s v0.23.0 migration (Phase B.7) deletes its local
copy and delegates to this crate.
Constants§
- GEN_
REGULAR - BCH(93,80,8) generator polynomial coefficients (5 × 65-bit).
- MS_
REGULAR_ CONST - MS-domain target residue: codex32’s “SECRETSHARE32” Fe-vec packed in
big-endian 5-bit chunks (the natural u128 representation that
polymod_runproduces for a valid ms1 input).
Functions§
- bch_
create_ checksum_ regular - 13-symbol regular-code BCH checksum over
hrp_expand(hrp) || data || [0; 13]. - bch_
verify_ regular - Verify a regular-code BCH checksum over the data-part-with-checksum.
- hrp_
expand - BIP 173-style HRP expansion:
[c >> 5 for c in hrp] ++ [0] ++ [c & 31 for c in hrp]. - polymod_
run - Run the BCH polymod over
valuesstarting from the BIP-93 initial residue.