Skip to content

base32_encode

Encodes data as base32 (RFC 4648 section 6), with = padding.

use helpers4::hex::base32_encode;

Cargo feature hex (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features hex

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.7", default-features = false, features = ["hex"] }
pub fn base32_encode(data: &[u8]) -> String
ParameterTypeDescription
data&[u8]The bytes to encode.

String — The base32 string; its length is always a multiple of 8.

use helpers4::hex::base32_encode;

assert_eq!(base32_encode(b"foobar"), "MZXW6YTBOI======");
assert_eq!(base32_encode(b""), "");

src/hex/base32_encode.rs