Struct extra_safe::ExtraSponge
source · pub struct ExtraSponge<A: SpongeAPI, I: List> { /* private fields */ }Expand description
This is a slightly extended generic NewType wrapper around the original SpongeAPI. It is decorated with the IOPattern I intended for this sponge instance.
Implementations§
source§impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>where
Norm<I>: ToIOPattern,
impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>where Norm<I>: ToIOPattern,
sourcepub fn start(
domain_separator: Option<u32>,
api: A,
acc: &mut A::Acc
) -> ExtraSponge<A, Norm<I>>
pub fn start( domain_separator: Option<u32>, api: A, acc: &mut A::Acc ) -> ExtraSponge<A, Norm<I>>
Creates a sponge with the IOPatten given as a type parameter. Note that we do not require this pattern to be normalized - instead the constructor will return an ExtraSPonge with a normalized pattern.
source§impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>
impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>
sourcepub fn absorb<U>(
self,
harray: Array<A::Value, U>,
acc: &mut A::Acc
) -> ExtraSponge<A, Use<I, Absorb<U>>>where
U: ArraySize<A::Value>,
I: Consume<Absorb<U>>,
pub fn absorb<U>( self, harray: Array<A::Value, U>, acc: &mut A::Acc ) -> ExtraSponge<A, Use<I, Absorb<U>>>where U: ArraySize<A::Value>, I: Consume<Absorb<U>>,
This pass-through function is used to absorb elements in the sponge. It calls the underlying API’s absorb function, and then returns a new ExtraSponge but a successful method dispatch to this implementation gaurantees the call is coherent with the IOPattern.
source§impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>
impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>
sourcepub fn squeeze<U>(
self,
harray: &mut Array<A::Value, U>,
acc: &mut A::Acc
) -> ExtraSponge<A, Use<I, Squeeze<U>>>where
U: ArraySize<A::Value>,
I: Consume<Squeeze<U>>,
pub fn squeeze<U>( self, harray: &mut Array<A::Value, U>, acc: &mut A::Acc ) -> ExtraSponge<A, Use<I, Squeeze<U>>>where U: ArraySize<A::Value>, I: Consume<Squeeze<U>>,
This pass-through function is used to squeeze elements out of the sponge. It calls the underlying API’s squeeze function, and then returns a new ExtraSponge but a successful method dispatch to this implementation gaurantees the call is coherent with the IOPattern.