logo
pub trait StreamCipherCore: BlockSizeUser + Sized {
    fn remaining_blocks(&self) -> Option<usize>;
fn process_with_backend(
        &mut self,
        f: impl StreamClosure<BlockSize = Self::BlockSize>
    ); fn write_keystream_block(&mut self, block: &mut Block<Self>) { ... }
fn write_keystream_blocks(&mut self, blocks: &mut [Block<Self>]) { ... }
fn apply_keystream_block_inout(&mut self, block: InOut<'_, '_, Block<Self>>) { ... }
fn apply_keystream_blocks(&mut self, blocks: &mut [Block<Self>]) { ... }
fn apply_keystream_blocks_inout(
        &mut self,
        blocks: InOutBuf<'_, '_, Block<Self>>
    ) { ... }
fn try_apply_keystream_partial(
        self,
        buf: InOutBuf<'_, '_, u8>
    ) -> Result<(), StreamCipherError> { ... }
fn apply_keystream_partial(self, buf: InOutBuf<'_, '_, u8>) { ... } }
Expand description

Block-level synchronous stream ciphers.

Required methods

Return number of remaining blocks before cipher wraps around.

Returns None if number of remaining blocks can not be computed (e.g. in ciphers based on the sponge construction) or it’s too big to fit into usize.

Process data using backend provided to the rank-2 closure.

Provided methods

Write keystream block.

WARNING: this method does not check number of remaining blocks!

Write keystream blocks.

WARNING: this method does not check number of remaining blocks!

Apply keystream block.

WARNING: this method does not check number of remaining blocks!

Apply keystream blocks.

WARNING: this method does not check number of remaining blocks!

Apply keystream blocks.

WARNING: this method does not check number of remaining blocks!

Try to apply keystream to data not divided into blocks.

Consumes cipher since it may consume final keystream block only partially.

Returns an error if number of remaining blocks is not sufficient for processing the input data.

Try to apply keystream to data not divided into blocks.

Consumes cipher since it may consume final keystream block only partially.

Panics

If number of remaining blocks is not sufficient for processing the input data.

Implementors