Function bech32::segwit::encode

source ·
pub fn encode(
    hrp: &Hrp,
    witness_version: Fe32,
    witness_program: &[u8]
) -> Result<String, EncodeError>
Expand description

Encodes a segwit address.

Does validity checks on the witness_version and length checks on the witness_program.

As specified by [BIP-350] we use the Bech32m checksum algorithm for witness versions 1 and above, and for witness version 0 we use the original ([BIP-173]) Bech32 checksum algorithm.

See also encode_v0 or encode_v1.