Skip to main content

decode_into_constant_time

Function decode_into_constant_time 

Source
pub const fn decode_into_constant_time(
    output: &mut [u8],
    encoded_data: &[u8],
    alphabet: Alphabet,
) -> Result<(), DecodeError>
Expand description

Constant-time base32 decoding. Processes all input data without secret-dependent branches or memory accesses, making it suitable for cryptographic applications.

Consumers may prefer the faster decode_into which dispatches to a SIMD-accelerated path when available (non constant-time).

ยงExample

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