pub trait SpongeAPI {
type Acc;
type Value;
// Required methods
fn start(
&mut self,
p: IOPattern,
domain_separator: Option<u32>,
acc: &mut Self::Acc,
);
fn absorb(
&mut self,
length: u32,
elements: &[Self::Value],
acc: &mut Self::Acc,
);
fn squeeze(
&mut self,
length: u32,
elements: &mut [Self::Value],
acc: &mut Self::Acc,
);
fn finish(&mut self) -> Result<(), Error>;
}Expand description
This is the SpongeAPI trait as you can find it in Neptune,
see <https://github.com/filecoin-project/neptune/blob/master/src/sponge/api.rs>
Slightly modified so that the squeeze function takes an argument as a mutable slice
instead of returning a Vec.
Required Associated Types§
Required Methods§
Sourcefn start(
&mut self,
p: IOPattern,
domain_separator: Option<u32>,
acc: &mut Self::Acc,
)
fn start( &mut self, p: IOPattern, domain_separator: Option<u32>, acc: &mut Self::Acc, )
This initializes the internal state of the sponge, modifying up to c/2 field elements of the state. It’s done once in the lifetime of a sponge.
Sourcefn absorb(&mut self, length: u32, elements: &[Self::Value], acc: &mut Self::Acc)
fn absorb(&mut self, length: u32, elements: &[Self::Value], acc: &mut Self::Acc)
This injects length field elements to the state from the array elements, interleaving calls to the permutation
It also checks if the current call matches the IO pattern.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".