pub struct Poseidon2<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> { /* private fields */ }
Expand description
The Poseidon2 permutation.
Implementations§
Source§impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Poseidon2<AF, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField,
AF::F: PrimeField,
ExternalPerm: ExternalLayerConstructor<AF, WIDTH>,
InternalPerm: InternalLayerConstructor<AF>,
impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Poseidon2<AF, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField,
AF::F: PrimeField,
ExternalPerm: ExternalLayerConstructor<AF, WIDTH>,
InternalPerm: InternalLayerConstructor<AF>,
Sourcepub fn new(
external_constants: ExternalLayerConstants<AF::F, WIDTH>,
internal_constants: Vec<AF::F>,
) -> Self
pub fn new( external_constants: ExternalLayerConstants<AF::F, WIDTH>, internal_constants: Vec<AF::F>, ) -> Self
Create a new Poseidon2 configuration. This internally converts the given constants to the relevant packed versions.
Source§impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Poseidon2<AF, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField,
AF::F: PrimeField64,
ExternalPerm: ExternalLayerConstructor<AF, WIDTH>,
InternalPerm: InternalLayerConstructor<AF>,
impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Poseidon2<AF, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField,
AF::F: PrimeField64,
ExternalPerm: ExternalLayerConstructor<AF, WIDTH>,
InternalPerm: InternalLayerConstructor<AF>,
Sourcepub fn new_from_rng_128<R: Rng>(rng: &mut R) -> Self
pub fn new_from_rng_128<R: Rng>(rng: &mut R) -> Self
Create a new Poseidon2 configuration with 128 bit security and random rounds constants.
Trait Implementations§
Source§impl<F: Clone, ExternalPerm: Clone, InternalPerm: Clone, const WIDTH: usize, const D: u64> Clone for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F: Clone, ExternalPerm: Clone, InternalPerm: Clone, const WIDTH: usize, const D: u64> Clone for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
Source§impl<F: Debug, ExternalPerm: Debug, InternalPerm: Debug, const WIDTH: usize, const D: u64> Debug for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F: Debug, ExternalPerm: Debug, InternalPerm: Debug, const WIDTH: usize, const D: u64> Debug for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
Source§impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Permutation<[AF; WIDTH]> for Poseidon2<<AF::F as Field>::Packing, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField + Sync,
AF::F: PrimeField,
ExternalPerm: ExternalLayer<AF, WIDTH, D>,
InternalPerm: InternalLayer<AF, WIDTH, D>,
impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Permutation<[AF; WIDTH]> for Poseidon2<<AF::F as Field>::Packing, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField + Sync,
AF::F: PrimeField,
ExternalPerm: ExternalLayer<AF, WIDTH, D>,
InternalPerm: InternalLayer<AF, WIDTH, D>,
fn permute_mut(&self, state: &mut [AF; WIDTH])
fn permute(&self, input: T) -> T
impl<AF, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> CryptographicPermutation<[AF; WIDTH]> for Poseidon2<<AF::F as Field>::Packing, ExternalPerm, InternalPerm, WIDTH, D>where
AF: AbstractField + Sync,
AF::F: PrimeField,
ExternalPerm: ExternalLayer<AF, WIDTH, D>,
InternalPerm: InternalLayer<AF, WIDTH, D>,
Auto Trait Implementations§
impl<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Freeze for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> RefUnwindSafe for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Send for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Sync for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> Unpin for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
impl<F, ExternalPerm, InternalPerm, const WIDTH: usize, const D: u64> UnwindSafe for Poseidon2<F, ExternalPerm, InternalPerm, WIDTH, D>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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