pub struct SpongeCursor<const RATE: usize> {
pub(crate) pos: u8,
}Expand description
Cursor for implementing sponge-based absorption and squeezing.
This type wraps u8 and enforces that its value is always smaller than RATE.
RATE MUST be smaller than 256, trying to initialize cursor with an invalid rate will
result in a compilation error.
Fields§
§pos: u8Implementations§
Source§impl<const RATE: usize> SpongeCursor<RATE>
impl<const RATE: usize> SpongeCursor<RATE>
Sourcepub fn new(pos: u8) -> Option<Self>
pub fn new(pos: u8) -> Option<Self>
Create new cursor with the provided position.
Returns None if pos is bigger or equal to RATE.
Sourcepub fn absorb_u64_le<const N: usize>(
&mut self,
state: &mut [u64; N],
sponge: fn(&mut [u64; N]),
data: &[u8],
)
pub fn absorb_u64_le<const N: usize>( &mut self, state: &mut [u64; N], sponge: fn(&mut [u64; N]), data: &[u8], )
Absorb bytes from data into state using little-endian byte order.
Size of state in bytes MUST be greater or equal to RATE.
Using an invalid N will result in a compilation error.
Sourcepub fn squeeze_read_u64_le<const N: usize>(
&mut self,
state: &mut [u64; N],
sponge: fn(&mut [u64; N]),
buf: &mut [u8],
)
pub fn squeeze_read_u64_le<const N: usize>( &mut self, state: &mut [u64; N], sponge: fn(&mut [u64; N]), buf: &mut [u8], )
Squeeze data from state by reading it into buf using little-endian byte order.
Size of state in bytes MUST be greater or equal to RATE.
Using an invalid N will result in a compilation error.
Sourcepub fn squeeze_xor_u64_le<const N: usize>(
&mut self,
state: &mut [u64; N],
sponge: fn(&mut [u64; N]),
buf: &mut [u8],
)
pub fn squeeze_xor_u64_le<const N: usize>( &mut self, state: &mut [u64; N], sponge: fn(&mut [u64; N]), buf: &mut [u8], )
Squeeze data from state by XOR-ing it with data in buf using little-endian byte order.
Size of state in bytes MUST be greater or equal to RATE.
Using an invalid N will result in a compilation error.
Sourcepub(crate) fn squeeze_inner_u64_le<const N: usize>(
&mut self,
state: &mut [u64; N],
sponge: fn(&mut [u64; N]),
buf: &mut [u8],
process_partial: fn(&[u64; N], usize, &mut [u8]),
process_full: fn(&[u64; N], &mut [u8; RATE]),
)
pub(crate) fn squeeze_inner_u64_le<const N: usize>( &mut self, state: &mut [u64; N], sponge: fn(&mut [u64; N]), buf: &mut [u8], process_partial: fn(&[u64; N], usize, &mut [u8]), process_full: fn(&[u64; N], &mut [u8; RATE]), )
Squeeze data by calling custom functions using little-endian byte order.
Trait Implementations§
Source§impl<const RATE: usize> Clone for SpongeCursor<RATE>
impl<const RATE: usize> Clone for SpongeCursor<RATE>
Source§fn clone(&self) -> SpongeCursor<RATE>
fn clone(&self) -> SpongeCursor<RATE>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more