pub struct SpongeCursor<const RATE: usize> { /* private fields */ }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.
Implementations§
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.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const RATE: usize> Debug for SpongeCursor<RATE>
impl<const RATE: usize> Debug for SpongeCursor<RATE>
Source§impl<const RATE: usize> Default for SpongeCursor<RATE>
impl<const RATE: usize> Default for SpongeCursor<RATE>
Source§impl<const RATE: usize> Hash for SpongeCursor<RATE>
impl<const RATE: usize> Hash for SpongeCursor<RATE>
Source§impl<const RATE: usize> PartialEq for SpongeCursor<RATE>
impl<const RATE: usize> PartialEq for SpongeCursor<RATE>
Source§fn eq(&self, other: &SpongeCursor<RATE>) -> bool
fn eq(&self, other: &SpongeCursor<RATE>) -> bool
self and other values to be equal, and is used by ==.