Struct block_modes::Ecb
source · [−]pub struct Ecb<C: BlockCipher, P: Padding> { /* private fields */ }
Expand description
Electronic Codebook (ECB) block cipher mode instance.
Note that new
method ignores IV, so during initialization you can
just pass Default::default()
instead.
Trait Implementations
sourceimpl<C: BlockCipher, P: Padding> BlockMode<C, P> for Ecb<C, P>
impl<C: BlockCipher, P: Padding> BlockMode<C, P> for Ecb<C, P>
sourcefn new(cipher: C, _iv: &GenericArray<u8, <C as BlockCipher>::BlockSize>) -> Self
fn new(cipher: C, _iv: &GenericArray<u8, <C as BlockCipher>::BlockSize>) -> Self
Create a new block mode instance from initialized block cipher and IV.
sourcefn new_var(key: &[u8], _iv: &[u8]) -> Result<Self, InvalidKeyIvLength>
fn new_var(key: &[u8], _iv: &[u8]) -> Result<Self, InvalidKeyIvLength>
Create a new block mode instance from variable size key and IV. Read more
sourcefn encrypt_blocks(
&mut self,
blocks: &mut [GenericArray<u8, <C as BlockCipher>::BlockSize>]
)
fn encrypt_blocks(
&mut self,
blocks: &mut [GenericArray<u8, <C as BlockCipher>::BlockSize>]
)
Encrypt blocks of data
sourcefn decrypt_blocks(
&mut self,
blocks: &mut [GenericArray<u8, <C as BlockCipher>::BlockSize>]
)
fn decrypt_blocks(
&mut self,
blocks: &mut [GenericArray<u8, <C as BlockCipher>::BlockSize>]
)
Decrypt blocks of data
sourcefn new_fix(
key: &GenericArray<u8, <C as BlockCipher>::KeySize>,
iv: &GenericArray<u8, <C as BlockCipher>::BlockSize>
) -> Self
fn new_fix(
key: &GenericArray<u8, <C as BlockCipher>::KeySize>,
iv: &GenericArray<u8, <C as BlockCipher>::BlockSize>
) -> Self
Create a new block mode instance from fixed sized key and IV.
sourcefn encrypt(self, buffer: &mut [u8], pos: usize) -> Result<&[u8], BlockModeError>
fn encrypt(self, buffer: &mut [u8], pos: usize) -> Result<&[u8], BlockModeError>
Encrypt message in-place. Read more
sourcefn decrypt(self, buffer: &mut [u8]) -> Result<&[u8], BlockModeError>
fn decrypt(self, buffer: &mut [u8]) -> Result<&[u8], BlockModeError>
Decrypt message in-place. Read more
sourcefn encrypt_vec(self, plaintext: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn encrypt_vec(self, plaintext: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Encrypt message and store result in vector.
sourcefn decrypt_vec(self, ciphertext: &[u8]) -> Result<Vec<u8>, BlockModeError>
fn decrypt_vec(self, ciphertext: &[u8]) -> Result<Vec<u8>, BlockModeError>
Encrypt message and store result in vector.
Auto Trait Implementations
impl<C, P> RefUnwindSafe for Ecb<C, P> where
C: RefUnwindSafe,
P: RefUnwindSafe,
impl<C, P> Send for Ecb<C, P> where
C: Send,
P: Send,
impl<C, P> Sync for Ecb<C, P> where
C: Sync,
P: Sync,
impl<C, P> Unpin for Ecb<C, P> where
C: Unpin,
P: Unpin,
impl<C, P> UnwindSafe for Ecb<C, P> where
C: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more