[][src]Function koibumi_base32::decode

pub fn decode(s: impl AsRef<str>) -> Result<Vec<u8>, DecodeError>

Decodes Base32 string into byte array.

The input is Base32 encoded lowercase str reference and the output is arbitrary Vec<u8>. Using lowercase RFC4648 alphabet and can be used for Onion addresses. Padding is not supported, so if the length of the input is not multiple of 8, an error will be returned.

Examples

use koibumi_base32 as base32;

let test = base32::decode("nbswy3dp")?;
let expected = b"hello";
assert_eq!(test, expected);