logo
pub trait Padding<BlockSize: ArrayLength<u8>> {
    const TYPE: PadType;

    fn pad(block: &mut Block<BlockSize>, pos: usize);
    fn unpad(block: &Block<BlockSize>) -> Result<&[u8], UnpadError>;

    fn unpad_blocks(blocks: &[Block<BlockSize>]) -> Result<&[u8], UnpadError> { ... }
}
Expand description

Trait for padding messages divided into blocks

Required Associated Constants

Padding type

Required Methods

Pads block filled with data up to pos (i.e length of a message stored in the block is equal to pos).

Panics

If pos is bigger than BlockSize. Most paddin algorithms also panic if they are equal.

Unpad data in the block.

Returns Err(UnpadError) if the block containts malformed padding.

Provided Methods

Unpad data in the blocks.

Returns Err(UnpadError) if the block containts malformed padding.

Implementors