pub struct Cipher<C>where
C: BlockCipher<BlockSize = U16>,{ /* private fields */ }Expand description
Cipher is an instance of the HCTR2 cipher.
Implementations§
Source§impl<C> Cipher<C>
impl<C> Cipher<C>
Sourcepub fn encrypt(&mut self, ciphertext: &mut [u8], plaintext: &[u8], tweak: &[u8])
pub fn encrypt(&mut self, ciphertext: &mut [u8], plaintext: &[u8], tweak: &[u8])
Encrypts plaintext into ciphertext using tweak.
It panics if either plaintext or ciphertext are less than
BLOCK_SIZE bytes.
Sourcepub fn decrypt(&mut self, plaintext: &mut [u8], ciphertext: &[u8], tweak: &[u8])
pub fn decrypt(&mut self, plaintext: &mut [u8], ciphertext: &[u8], tweak: &[u8])
Decrypts ciphertext into plaintext using tweak.
It panics if either ciphertext or plaintext are less than
BLOCK_SIZE bytes.
Sourcepub fn encrypt_in_place(&mut self, plaintext: &mut [u8], tweak: &[u8])
pub fn encrypt_in_place(&mut self, plaintext: &mut [u8], tweak: &[u8])
Encrypts plaintext in-place using tweak.
It panics if plaintext is less than BLOCK_SIZE bytes.
Sourcepub fn decrypt_in_place(&mut self, ciphertext: &mut [u8], tweak: &[u8])
pub fn decrypt_in_place(&mut self, ciphertext: &mut [u8], tweak: &[u8])
Decrypts ciphertext in-place using tweak.
It panics if ciphertext is less than BLOCK_SIZE bytes.
Trait Implementations§
Source§impl<C> Drop for Cipher<C>where
C: BlockCipher<BlockSize = U16>,
Available on crate feature zeroize only.
impl<C> Drop for Cipher<C>where
C: BlockCipher<BlockSize = U16>,
Available on crate feature
zeroize only.Source§impl<C> KeyInit for Cipher<C>
impl<C> KeyInit for Cipher<C>
Source§fn new(key: &Key<C>) -> Self
fn new(key: &Key<C>) -> Self
new creates an HCTR2 cipher.
The provided block cipher must have a block size of exactly BLOCK_SIZE bytes.
Source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable size key.
Source§impl<C> KeySizeUser for Cipher<C>
impl<C> KeySizeUser for Cipher<C>
impl<C> ZeroizeOnDrop for Cipher<C>where
C: BlockCipher<BlockSize = U16>,
Available on crate feature
zeroize only.Auto Trait Implementations§
impl<C> Freeze for Cipher<C>where
C: Freeze,
impl<C> RefUnwindSafe for Cipher<C>where
C: RefUnwindSafe,
impl<C> Send for Cipher<C>where
C: Send,
impl<C> Sync for Cipher<C>where
C: Sync,
impl<C> Unpin for Cipher<C>where
C: Unpin,
impl<C> UnwindSafe for Cipher<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