pub struct Cbc64<C: BlockCipher64> { /* private fields */ }Expand description
CBC-mode wrapper around a 64-bit-block cipher. Parallel to the
128-bit crate::cipher::Cbc — same semantics, just an 8-byte
chaining value. Unauthenticated; the IV must be unpredictable, and
a (key, IV) pair must never be reused.
Implementations§
Source§impl<C: BlockCipher64> Cbc64<C>
impl<C: BlockCipher64> Cbc64<C>
Sourcepub fn new(cipher: C, iv: &[u8; 8]) -> Self
pub fn new(cipher: C, iv: &[u8; 8]) -> Self
Creates a CBC context from cipher and an 8-byte IV.
Sourcepub fn encrypt(&mut self, data: &mut [u8]) -> Result<(), InvalidLength>
pub fn encrypt(&mut self, data: &mut [u8]) -> Result<(), InvalidLength>
Encrypts data in place. May be called repeatedly to continue
the chain; every call’s length must be a multiple of 8.
§Errors
Returns InvalidLength (without modifying data) if the
length is not a whole number of blocks.
Sourcepub fn decrypt(&mut self, data: &mut [u8]) -> Result<(), InvalidLength>
pub fn decrypt(&mut self, data: &mut [u8]) -> Result<(), InvalidLength>
Decrypts data in place. May be called repeatedly to continue
the chain; every call’s length must be a multiple of 8.
§Errors
Returns InvalidLength (without modifying data) if the
length is not a whole number of blocks.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Cbc64<C>where
C: Freeze,
impl<C> RefUnwindSafe for Cbc64<C>where
C: RefUnwindSafe,
impl<C> Send for Cbc64<C>where
C: Send,
impl<C> Sync for Cbc64<C>where
C: Sync,
impl<C> Unpin for Cbc64<C>where
C: Unpin,
impl<C> UnsafeUnpin for Cbc64<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for Cbc64<C>where
C: 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