Struct block_buffer::BlockBuffer[][src]

pub struct BlockBuffer<BlockSize: ArrayLength<u8>> { /* fields omitted */ }

Buffer for block processing of data.

Implementations

impl<BlockSize: ArrayLength<u8>> BlockBuffer<BlockSize>[src]

pub fn par_xor_data<S, N: ArrayLength<Block<BlockSize>>>(
    &mut self,
    data: &mut [u8],
    state: &mut S,
    gen_block: impl FnMut(&mut S) -> Block<BlockSize>,
    gen_blocks: impl FnMut(&mut S) -> ParBlock<BlockSize, N>
)
[src]

XORs data using the provided state and block generation functions.

This method is intended for stream cipher implementations. If N is equal to 1, the gen_blocks function is not used.

pub fn xor_data(
    &mut self,
    data: &mut [u8],
    gen_block: impl FnMut() -> Block<BlockSize>
)
[src]

Simplified version of the par_xor_data method, with N = 1.

pub fn set_data(
    &mut self,
    data: &mut [u8],
    gen_block: impl FnMut() -> Block<BlockSize>
)
[src]

Set data to generated blocks.

pub fn digest_pad(
    &mut self,
    delim: u8,
    suffix: &[u8],
    compress: impl FnMut(&Block<BlockSize>)
)
[src]

Compress remaining data after padding it with delim, zeros and the suffix bytes. If there is not enough unused space, compress will be called twice.

pub fn len64_padding_be(
    &mut self,
    data_len: u64,
    compress: impl FnMut(&Block<BlockSize>)
)
[src]

Pad message with 0x80, zeros and 64-bit message length using big-endian byte order.

pub fn len64_padding_le(
    &mut self,
    data_len: u64,
    compress: impl FnMut(&Block<BlockSize>)
)
[src]

Pad message with 0x80, zeros and 64-bit message length using little-endian byte order.

pub fn len128_padding_be(
    &mut self,
    data_len: u128,
    compress: impl FnMut(&Block<BlockSize>)
)
[src]

Pad message with 0x80, zeros and 128-bit message length using big-endian byte order.

pub fn size(&self) -> usize[src]

Return size of the internall buffer in bytes.

pub fn remaining(&self) -> usize[src]

Return number of remaining bytes in the internall buffer.

pub fn reset(&mut self)[src]

Reset buffer by setting cursor position to zero.

pub fn get_pos(&self) -> usize[src]

Return current cursor position.

pub fn set(&mut self, buf: Block<BlockSize>, pos: usize)[src]

Set buffer content and cursor position.

Panics

If pos is bigger or equal to block size.

Trait Implementations

impl<BlockSize: Clone + ArrayLength<u8>> Clone for BlockBuffer<BlockSize>[src]

impl<BlockSize: Default + ArrayLength<u8>> Default for BlockBuffer<BlockSize>[src]

impl<B: ArrayLength<u8>> DigestBuffer<B> for BlockBuffer<B>[src]

Auto Trait Implementations

impl<BlockSize> Send for BlockBuffer<BlockSize>

impl<BlockSize> Sync for BlockBuffer<BlockSize>

impl<BlockSize> Unpin for BlockBuffer<BlockSize> where
    <BlockSize as ArrayLength<u8>>::ArrayType: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.