Struct BlockBuffer
struct BlockBuffer<BlockSize, Kind> { ... }
where
BlockSize: ArrayLength<u8> + IsLess<generic_array::typenum::U256>,
generic_array::typenum::Le<BlockSize, generic_array::typenum::U256>: NonZero,
Kind: BufferKind
Buffer for block processing of data.
Implementations
impl<BlockSize> BlockBuffer<BlockSize, Eager>
fn set_data<impl FnMut(&mut [Block<BlockSize>]): FnMut(&mut [Block<BlockSize>])>(self: &mut Self, data: &mut [u8], process_blocks: impl FnMut(&mut [Block<BlockSize>]))Set
datato generated blocks.fn digest_pad<impl FnMut(&Block<BlockSize>): FnMut(&Block<BlockSize>)>(self: &mut Self, delim: u8, suffix: &[u8], compress: impl FnMut(&Block<BlockSize>))Compress remaining data after padding it with
delim, zeros and thesuffixbytes. If there is not enough unused space,compresswill be called twice.Panics
If suffix length is bigger than block size.
fn len64_padding_be<impl FnMut(&Block<BlockSize>): FnMut(&Block<BlockSize>)>(self: &mut Self, data_len: u64, compress: impl FnMut(&Block<BlockSize>))Pad message with 0x80, zeros and 64-bit message length using big-endian byte order.
fn len64_padding_le<impl FnMut(&Block<BlockSize>): FnMut(&Block<BlockSize>)>(self: &mut Self, data_len: u64, compress: impl FnMut(&Block<BlockSize>))Pad message with 0x80, zeros and 64-bit message length using little-endian byte order.
fn len128_padding_be<impl FnMut(&Block<BlockSize>): FnMut(&Block<BlockSize>)>(self: &mut Self, data_len: u128, compress: impl FnMut(&Block<BlockSize>))Pad message with 0x80, zeros and 128-bit message length using big-endian byte order.
impl<BlockSize, Kind> BlockBuffer<BlockSize, Kind>
fn new(buf: &[u8]) -> SelfCreate new buffer from slice.
Panics
If slice length is not valid for used buffer kind.
fn digest_blocks<impl FnMut(&[Block<BlockSize>]): FnMut(&[Block<BlockSize>])>(self: &mut Self, input: &[u8], compress: impl FnMut(&[Block<BlockSize>]))Digest data in
inputin blocks of sizeBlockSizeusing thecompressfunction, which accepts slice of blocks.fn reset(self: &mut Self)Reset buffer by setting cursor position to zero.
fn pad_with_zeros(self: &mut Self) -> &mut Block<BlockSize>Pad remaining data with zeros and return resulting block.
fn get_pos(self: &Self) -> usizeReturn current cursor position.
fn get_data(self: &Self) -> &[u8]Return slice of data stored inside the buffer.
fn set(self: &mut Self, buf: Block<BlockSize>, pos: usize)Set buffer content and cursor position.
Panics
If
posis bigger or equal to block size.fn size(self: &Self) -> usizeReturn size of the internall buffer in bytes.
fn remaining(self: &Self) -> usizeReturn number of remaining bytes in the internall buffer.
impl<BlockSize, Kind> Clone for BlockBuffer<BlockSize, Kind>
fn clone(self: &Self) -> Self
impl<BlockSize, Kind> Debug for BlockBuffer<BlockSize, Kind>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<BlockSize, Kind> Default for BlockBuffer<BlockSize, Kind>
fn default() -> Self
impl<BlockSize, Kind> Freeze for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> RefUnwindSafe for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> Send for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> Sync for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> Unpin for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> UnsafeUnpin for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> UnwindSafe for BlockBuffer<BlockSize, Kind>
impl<T> Any for BlockBuffer<BlockSize, Kind>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for BlockBuffer<BlockSize, Kind>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for BlockBuffer<BlockSize, Kind>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for BlockBuffer<BlockSize, Kind>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for BlockBuffer<BlockSize, Kind>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Same for BlockBuffer<BlockSize, Kind>
impl<T, U> Into for BlockBuffer<BlockSize, Kind>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for BlockBuffer<BlockSize, Kind>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for BlockBuffer<BlockSize, Kind>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>