pub struct BlockBuffer<BlockSize, Kind>{ /* private fields */ }
Expand description
Buffer for block processing of data.
Implementations§
source§impl<BlockSize, Kind> BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> BlockBuffer<BlockSize, Kind>
sourcepub fn try_new(buf: &[u8]) -> Result<Self, Error>
pub fn try_new(buf: &[u8]) -> Result<Self, Error>
Create new buffer from slice.
Returns an error if slice length is not valid for used buffer kind.
sourcepub fn digest_blocks(
&mut self,
input: &[u8],
compress: impl FnMut(&[Block<BlockSize>]),
)
pub fn digest_blocks( &mut self, input: &[u8], compress: impl FnMut(&[Block<BlockSize>]), )
Digest data in input
in blocks of size BlockSize
using
the compress
function, which accepts slice of blocks.
sourcepub fn pad_with_zeros(&mut self) -> &mut Block<BlockSize>
pub fn pad_with_zeros(&mut self) -> &mut Block<BlockSize>
Pad remaining data with zeros and return resulting block.
source§impl<BlockSize> BlockBuffer<BlockSize, Eager>
impl<BlockSize> BlockBuffer<BlockSize, Eager>
sourcepub fn set_data(
&mut self,
data: &mut [u8],
process_blocks: impl FnMut(&mut [Block<BlockSize>]),
)
pub fn set_data( &mut self, data: &mut [u8], process_blocks: impl FnMut(&mut [Block<BlockSize>]), )
Set data
to generated blocks.
sourcepub fn digest_pad(
&mut self,
delim: u8,
suffix: &[u8],
compress: impl FnMut(&Block<BlockSize>),
)
pub fn digest_pad( &mut self, delim: u8, suffix: &[u8], compress: impl FnMut(&Block<BlockSize>), )
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.
§Panics
If suffix length is bigger than block size.
sourcepub fn len64_padding_be(
&mut self,
data_len: u64,
compress: impl FnMut(&Block<BlockSize>),
)
pub fn len64_padding_be( &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.
sourcepub fn len64_padding_le(
&mut self,
data_len: u64,
compress: impl FnMut(&Block<BlockSize>),
)
pub fn len64_padding_le( &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.
sourcepub fn len128_padding_be(
&mut self,
data_len: u128,
compress: impl FnMut(&Block<BlockSize>),
)
pub fn len128_padding_be( &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.
Trait Implementations§
source§impl<BlockSize, Kind> Clone for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> Clone for BlockBuffer<BlockSize, Kind>
source§impl<BlockSize, Kind> Debug for BlockBuffer<BlockSize, Kind>where
BlockSize: ArrayLength<u8> + IsLess<U256> + Debug,
Le<BlockSize, U256>: NonZero,
Kind: BufferKind + Debug,
impl<BlockSize, Kind> Debug for BlockBuffer<BlockSize, Kind>where
BlockSize: ArrayLength<u8> + IsLess<U256> + Debug,
Le<BlockSize, U256>: NonZero,
Kind: BufferKind + Debug,
Auto Trait Implementations§
impl<BlockSize, Kind> Freeze for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> RefUnwindSafe for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> Send for BlockBuffer<BlockSize, Kind>where
Kind: Send,
impl<BlockSize, Kind> Sync for BlockBuffer<BlockSize, Kind>where
Kind: Sync,
impl<BlockSize, Kind> Unpin for BlockBuffer<BlockSize, Kind>
impl<BlockSize, Kind> UnwindSafe for BlockBuffer<BlockSize, Kind>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)