pub struct BlockBuffer<BS: ArraySize, K: BufferKind> { /* private fields */ }
Expand description
Buffer for block processing of data.
Implementations§
Source§impl<BS: ArraySize, K: BufferKind> BlockBuffer<BS, K>
impl<BS: ArraySize, K: BufferKind> BlockBuffer<BS, K>
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(&[Array<u8, BS>]),
)
pub fn digest_blocks( &mut self, input: &[u8], compress: impl FnMut(&[Array<u8, BS>]), )
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) -> Array<u8, BS>
pub fn pad_with_zeros(&mut self) -> Array<u8, BS>
Pad remaining data with zeros and return resulting block.
Source§impl<BS: ArraySize> BlockBuffer<BS, Eager>
impl<BS: ArraySize> BlockBuffer<BS, Eager>
Sourcepub fn digest_pad(
&mut self,
delim: u8,
suffix: &[u8],
compress: impl FnMut(&Array<u8, BS>),
)
pub fn digest_pad( &mut self, delim: u8, suffix: &[u8], compress: impl FnMut(&Array<u8, BS>), )
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(&Array<u8, BS>),
)
pub fn len64_padding_be( &mut self, data_len: u64, compress: impl FnMut(&Array<u8, BS>), )
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(&Array<u8, BS>),
)
pub fn len64_padding_le( &mut self, data_len: u64, compress: impl FnMut(&Array<u8, BS>), )
Pad message with 0x80, zeros and 64-bit message length using little-endian byte order.
Source§impl<BS: ArraySize> BlockBuffer<BS, Lazy>
impl<BS: ArraySize> BlockBuffer<BS, Lazy>
Trait Implementations§
Source§impl<BS: ArraySize, K: BufferKind> Clone for BlockBuffer<BS, K>
impl<BS: ArraySize, K: BufferKind> Clone for BlockBuffer<BS, K>
Source§impl<BS: ArraySize, K: BufferKind> Debug for BlockBuffer<BS, K>
impl<BS: ArraySize, K: BufferKind> Debug for BlockBuffer<BS, K>
Source§impl<BS: ArraySize, K: BufferKind> Default for BlockBuffer<BS, K>
impl<BS: ArraySize, K: BufferKind> Default for BlockBuffer<BS, K>
Auto Trait Implementations§
impl<BS, K> Freeze for BlockBuffer<BS, K>
impl<BS, K> RefUnwindSafe for BlockBuffer<BS, K>
impl<BS, K> Send for BlockBuffer<BS, K>where
<K as Sealed>::Pos: Send,
impl<BS, K> Sync for BlockBuffer<BS, K>where
<K as Sealed>::Pos: Sync,
impl<BS, K> Unpin for BlockBuffer<BS, K>
impl<BS, K> UnwindSafe for BlockBuffer<BS, K>
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
Mutably borrows from an owned value. Read more