[−][src]Function koibumi_base32::encode
pub fn encode(bytes: impl AsRef<[u8]>) -> Result<String, EncodeError>
Encodes byte array into Base32 string.
The input is arbitrary [u8]
slice
and the output is lowercase String
.
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 5,
an error will be returned.
Examples
use koibumi_base32 as base32; let test = base32::encode(b"hello")?; let expected = "nbswy3dp"; assert_eq!(test, expected);