Skip to main content

decode

Function decode 

Source
pub fn decode(input: impl AsRef<[u8]>) -> Result<Vec<u8>, DecodeError>
Expand description

Decodes strict standard padded Base64 into an owned byte vector.

This is a convenience wrapper around Engine::decode_vec on STANDARD. It uses the normal strict decoder, not the crate::ct module, and may branch or return early on malformed input. For secret-bearing payloads where malformed-input timing matters, use crate::ct::CtEngine::decode_secret through crate::ct::STANDARD instead.

ยงExamples

assert_eq!(base64_ng::decode("aGVsbG8=").unwrap(), b"hello");