[−][src]Trait tx_padding::Padding
Trait for padding messages divided into blocks
Required methods
fn pad_block(block: &mut [u8], pos: usize) -> Result<(), PadError>
Pads block filled with data up to pos.
pos should be inside of the block and block must not be full, i.e.
pos < block.len() must be true. Otherwise method will return
PadError. Some potentially irreversible padding schemes can allow
padding of the full block, in this case aforementioned condition is
relaxed to pos <= block.len().
fn unpad(data: &[u8]) -> Result<&[u8], UnpadError>
Unpad given data by truncating it according to the used padding.
In case of the malformed padding will return UnpadError
Provided methods
fn pad(
buf: &mut [u8],
pos: usize,
block_size: usize
) -> Result<&mut [u8], PadError>
buf: &mut [u8],
pos: usize,
block_size: usize
) -> Result<&mut [u8], PadError>
Pads message with length pos in the provided buffer.
&buf[..pos] is perceived as the message, the buffer must contain
enough leftover space for padding: block_size - (pos % block_size)
extra bytes must be available. Otherwise method will return
PadError.
Implementations on Foreign Types
impl Padding for Pkcs7[src]
fn pad_block(block: &mut [u8], pos: usize) -> Result<(), PadError>[src]
fn unpad(data: &[u8]) -> Result<&[u8], UnpadError>[src]
impl Padding for Iso7816[src]
fn pad_block(block: &mut [u8], pos: usize) -> Result<(), PadError>[src]
fn unpad(data: &[u8]) -> Result<&[u8], UnpadError>[src]
impl Padding for NoPadding[src]
fn pad_block(block: &mut [u8], pos: usize) -> Result<(), PadError>[src]
fn pad(
buf: &mut [u8],
pos: usize,
block_size: usize
) -> Result<&mut [u8], PadError>[src]
buf: &mut [u8],
pos: usize,
block_size: usize
) -> Result<&mut [u8], PadError>
fn unpad(data: &[u8]) -> Result<&[u8], UnpadError>[src]
impl Padding for ZeroPadding[src]
fn pad_block(block: &mut [u8], pos: usize) -> Result<(), PadError>[src]
fn pad(
buf: &mut [u8],
pos: usize,
block_size: usize
) -> Result<&mut [u8], PadError>[src]
buf: &mut [u8],
pos: usize,
block_size: usize
) -> Result<&mut [u8], PadError>
fn unpad(data: &[u8]) -> Result<&[u8], UnpadError>[src]
impl Padding for AnsiX923[src]
fn pad_block(block: &mut [u8], pos: usize) -> Result<(), PadError>[src]
fn unpad(data: &[u8]) -> Result<&[u8], UnpadError>[src]
Implementors
impl<N> Padding for TxPadding<N> where
N: PowerOfTwo + Unsigned + IsLessOrEqual<U256> + IsGreater<U1>,
LeEq<N, U256>: NonZero,
Gr<N, U1>: NonZero, [src]
N: PowerOfTwo + Unsigned + IsLessOrEqual<U256> + IsGreater<U1>,
LeEq<N, U256>: NonZero,
Gr<N, U1>: NonZero,