pub enum OperationMode<W: Word, const N: usize> {
ECB,
CBC {
iv: [W; N],
},
CTR {
nonce_and_counter: [W; N],
},
}Expand description
Modes of operation for a block cipher.
- ECB: Electronic Codebook mode.
- CBC: Cipher Block Chaining mode.
- CTR: Counter mode.
ECB mode of operation is less secure and is not recommended to use in production applications since it can be broken muc easily, special care should be kept while using this mode.
Variants§
ECB
Electronic Codebook
Encrypt/Decrypt each block independently Without any additional security.
CBC
Cipher Block Chaining
Requires an initialization vector to add one stage enhanced security.
CTR
Counter
Requires a starting nonce + counter block, this way it adds two stage complexity over encryption/decryption.
Auto Trait Implementations§
impl<W, const N: usize> Freeze for OperationMode<W, N>where
W: Freeze,
impl<W, const N: usize> RefUnwindSafe for OperationMode<W, N>where
W: RefUnwindSafe,
impl<W, const N: usize> Send for OperationMode<W, N>where
W: Send,
impl<W, const N: usize> Sync for OperationMode<W, N>where
W: Sync,
impl<W, const N: usize> Unpin for OperationMode<W, N>where
W: Unpin,
impl<W, const N: usize> UnsafeUnpin for OperationMode<W, N>where
W: UnsafeUnpin,
impl<W, const N: usize> UnwindSafe for OperationMode<W, N>where
W: 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