Skip to main content

hrp_expand

Function hrp_expand 

Source
pub fn hrp_expand(hrp: &str) -> Vec<u8> ⓘ
Expand description

BIP 173-style HRP-expansion: produces the 5-bit-symbol prelude that gets prepended to the data part before running the BCH polymod.

For each HRP character c, emits c >> 5 (high 3 bits); then emits a single 0 separator; then emits each character’s c & 31 (low 5 bits). The result has length 2 * hrp.len() + 1 for ASCII HRPs.

For hrp_expand("md") this returns [3, 3, 0, 13, 4].