Skip to main content

checked_base58_decode_array

Function checked_base58_decode_array 

Source
pub fn checked_base58_decode_array<const N: usize>(
    input: impl AsRef<[u8]>,
) -> Result<[u8; N], ParseCurveError>
Expand description

Base-58 decode bytes array of a an exact size. If decoded length doesn’t match N, an error will be returned.

§Examples

assert_eq!(
    checked_base58_decode_array::<8>("he11owor1d")?,
    hex!("04305e2b2473f058"),
);
checked_base58_decode_array::<7>("he11owor1d").expect_err("buffer too small");
checked_base58_decode_array::<9>("he11owor1d").expect_err("buffer too large");