Trait cipher::block::BlockCipher [−][src]
pub trait BlockCipher {
type BlockSize: ArrayLength<u8>;
type ParBlocks: ArrayLength<Block<Self>>;
fn encrypt_block(&self, block: &mut Block<Self>);
fn decrypt_block(&self, block: &mut Block<Self>);
fn encrypt_blocks(&self, blocks: &mut ParBlocks<Self>) { ... }
fn encrypt_slice(&self, blocks: &mut [Block<Self>]) { ... }
fn decrypt_blocks(&self, blocks: &mut ParBlocks<Self>) { ... }
fn decrypt_slice(&self, blocks: &mut [Block<Self>]) { ... }
}
Expand description
The trait which defines in-place encryption and decryption over single block or several blocks in parallel.
Associated Types
type BlockSize: ArrayLength<u8>
type BlockSize: ArrayLength<u8>
Size of the block in bytes
type ParBlocks: ArrayLength<Block<Self>>
type ParBlocks: ArrayLength<Block<Self>>
Number of blocks which can be processed in parallel by cipher implementation
Required methods
fn encrypt_block(&self, block: &mut Block<Self>)
fn encrypt_block(&self, block: &mut Block<Self>)
Encrypt block in-place
fn decrypt_block(&self, block: &mut Block<Self>)
fn decrypt_block(&self, block: &mut Block<Self>)
Decrypt block in-place
Provided methods
fn encrypt_blocks(&self, blocks: &mut ParBlocks<Self>)
fn encrypt_blocks(&self, blocks: &mut ParBlocks<Self>)
Encrypt several blocks in parallel using instruction level parallelism if possible.
If ParBlocks
equals to 1 it’s equivalent to encrypt_block
.
fn encrypt_slice(&self, blocks: &mut [Block<Self>])
fn encrypt_slice(&self, blocks: &mut [Block<Self>])
Encrypt a slice of blocks, leveraging parallelism when available.
fn decrypt_blocks(&self, blocks: &mut ParBlocks<Self>)
fn decrypt_blocks(&self, blocks: &mut ParBlocks<Self>)
Decrypt several blocks in parallel using instruction level parallelism if possible.
If ParBlocks
equals to 1 it’s equivalent to decrypt_block
.
fn decrypt_slice(&self, blocks: &mut [Block<Self>])
fn decrypt_slice(&self, blocks: &mut [Block<Self>])
Decrypt a slice of blocks, leveraging parallelism when available.