Skip to main content

encode_into

Function encode_into 

Source
pub fn encode_into(
    output: &mut [u8],
    data: &[u8],
    alphabet: Alphabet,
) -> Result<(), EncodeError>
Expand description

Encodes bytes into an existing buffer.

Dispatches to a SIMD-accelerated implementation (AVX2 or NEON) when the target feature is available.

See encode_into_constant_time for security-sensitive and cryptographic operations.

§Errors

Returns EncodeError if output.len() is less than the expected encoded length.

§Example

let mut buf = [0u8; 8];
base32::encode_into(&mut buf, b"hello", base32::Alphabet::Rfc4648).unwrap();
assert_eq!(&buf, b"NBSWY3DP");