pub struct CtEngine<A, const PAD: bool> { /* private fields */ }Expand description
A zero-sized constant-time-oriented Base64 decoder.
Implementations§
Source§impl<A, const PAD: bool> CtEngine<A, PAD>where
A: Alphabet,
impl<A, const PAD: bool> CtEngine<A, PAD>where
A: Alphabet,
Sourcepub fn decode_slice(
&self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, DecodeError>
pub fn decode_slice( &self, input: &[u8], output: &mut [u8], ) -> Result<usize, DecodeError>
Decodes input into output, returning the number of bytes
written.
This path uses branch-minimized arithmetic for Base64 symbol mapping and avoids secret-indexed lookup tables. Input length, padding length, output length, and final success or failure remain public. Malformed input errors are intentionally non-localized; use the normal strict decoder when exact error indexes are required.
§Examples
use base64_ng::ct;
let mut output = [0u8; 5];
let written = ct::STANDARD
.decode_slice(b"aGVsbG8=", &mut output)
.unwrap();
assert_eq!(&output[..written], b"hello");Trait Implementations§
Source§impl<A: PartialEq, const PAD: bool> PartialEq for CtEngine<A, PAD>
impl<A: PartialEq, const PAD: bool> PartialEq for CtEngine<A, PAD>
impl<A: Copy, const PAD: bool> Copy for CtEngine<A, PAD>
impl<A: Eq, const PAD: bool> Eq for CtEngine<A, PAD>
impl<A, const PAD: bool> StructuralPartialEq for CtEngine<A, PAD>
Auto Trait Implementations§
impl<A, const PAD: bool> Freeze for CtEngine<A, PAD>
impl<A, const PAD: bool> RefUnwindSafe for CtEngine<A, PAD>where
A: RefUnwindSafe,
impl<A, const PAD: bool> Send for CtEngine<A, PAD>where
A: Send,
impl<A, const PAD: bool> Sync for CtEngine<A, PAD>where
A: Sync,
impl<A, const PAD: bool> Unpin for CtEngine<A, PAD>where
A: Unpin,
impl<A, const PAD: bool> UnsafeUnpin for CtEngine<A, PAD>
impl<A, const PAD: bool> UnwindSafe for CtEngine<A, PAD>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more