pub struct PoseidonSponge<const NAME: u32, F: PrimeField, const R: usize, const N: usize> {
pub full_rounds: usize,
pub partial_rounds: usize,
pub alpha: u64,
pub ark: &'static [[F; N]],
pub mds: &'static [[F; N]],
pub state: [F; N],
}
Expand description
Poseidon Sponge.
The NAME
const is to distinbuish between different bitsizes of the same Field.
For instance Bls12_381 and Bn254 both have field type Fp<MontBackend<FrConfig, 4>, 4> but are different fields.
Fields§
§full_rounds: usize
Number of rounds in a full-round operation.
partial_rounds: usize
Number of rounds in a partial-round operation.
alpha: u64
Exponent used in S-boxes.
ark: &'static [[F; N]]
Additive Round keys. These are added before each MDS matrix application to make it an affine shift.
They are indexed by ark[round_num][state_element_index]
mds: &'static [[F; N]]
Maximally Distance Separating (MDS) Matrix.
state: [F; N]
Sponge state
Trait Implementations§
Source§impl<const NAME: u32, F: PrimeField, const R: usize, const N: usize> AsMut<[F]> for PoseidonSponge<NAME, F, R, N>
impl<const NAME: u32, F: PrimeField, const R: usize, const N: usize> AsMut<[F]> for PoseidonSponge<NAME, F, R, N>
Source§impl<const NAME: u32, F: PrimeField, const R: usize, const N: usize> AsRef<[F]> for PoseidonSponge<NAME, F, R, N>
impl<const NAME: u32, F: PrimeField, const R: usize, const N: usize> AsRef<[F]> for PoseidonSponge<NAME, F, R, N>
Source§impl<const NAME: u32, F: Clone + PrimeField, const R: usize, const N: usize> Clone for PoseidonSponge<NAME, F, R, N>
impl<const NAME: u32, F: Clone + PrimeField, const R: usize, const N: usize> Clone for PoseidonSponge<NAME, F, R, N>
Source§fn clone(&self) -> PoseidonSponge<NAME, F, R, N>
fn clone(&self) -> PoseidonSponge<NAME, F, R, N>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<const NAME: u32, F: PrimeField, const R: usize, const N: usize> Debug for PoseidonSponge<NAME, F, R, N>
impl<const NAME: u32, F: PrimeField, const R: usize, const N: usize> Debug for PoseidonSponge<NAME, F, R, N>
Auto Trait Implementations§
impl<const NAME: u32, F, const R: usize, const N: usize> Freeze for PoseidonSponge<NAME, F, R, N>where
F: Freeze,
impl<const NAME: u32, F, const R: usize, const N: usize> RefUnwindSafe for PoseidonSponge<NAME, F, R, N>where
F: RefUnwindSafe,
impl<const NAME: u32, F, const R: usize, const N: usize> Send for PoseidonSponge<NAME, F, R, N>
impl<const NAME: u32, F, const R: usize, const N: usize> Sync for PoseidonSponge<NAME, F, R, N>
impl<const NAME: u32, F, const R: usize, const N: usize> Unpin for PoseidonSponge<NAME, F, R, N>where
F: Unpin,
impl<const NAME: u32, F, const R: usize, const N: usize> UnwindSafe for PoseidonSponge<NAME, F, R, N>where
F: UnwindSafe + RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more