[−][src]Struct neptune::poseidon::Poseidon
The Poseidon
structure will accept a number of inputs equal to the arity.
Fields
elements: GenericArray<E::Fr, Add1<Arity>>
the elements to permute
Methods
impl<'a, E, Arity> Poseidon<'a, E, Arity> where
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
[src]
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
pub fn new(constants: &'a PoseidonConstants<E, Arity>) -> Self
[src]
pub fn new_with_preimage(
preimage: &[E::Fr],
constants: &'a PoseidonConstants<E, Arity>
) -> Self
[src]
preimage: &[E::Fr],
constants: &'a PoseidonConstants<E, Arity>
) -> Self
pub fn set_preimage(&mut self, preimage: &[E::Fr])
[src]
Replace the elements with the provided optional items.
Panics
Panics if the provided slice is bigger than the arity.
pub fn reset(&mut self)
[src]
Restore the initial state
pub fn input(&mut self, element: E::Fr) -> Result<usize, Error>
[src]
The returned usize
represents the element position (within arity) for the input operation
pub fn hash_in_mode(&mut self, mode: HashMode) -> E::Fr
[src]
pub fn hash(&mut self) -> E::Fr
[src]
pub fn hash_correct(&mut self) -> E::Fr
[src]
The number of rounds is divided into two equal parts for the full rounds, plus the partial rounds.
The returned element is the second poseidon element, the first is the arity tag.
pub fn hash_optimized_dynamic(&mut self) -> E::Fr
[src]
pub fn hash_optimized_static(&mut self) -> E::Fr
[src]
pub fn full_round(&mut self)
[src]
pub fn full_round_dynamic(
&mut self,
add_current_round_keys: bool,
absorb_next_round_keys: bool
)
[src]
&mut self,
add_current_round_keys: bool,
absorb_next_round_keys: bool
)
pub fn partial_round(&mut self)
[src]
The partial round is the same as the full round, with the difference that we apply the S-Box only to the first bitflags poseidon leaf.
pub fn partial_round_dynamic(&mut self)
[src]
Trait Implementations
impl<'a, E: Clone, Arity: Clone> Clone for Poseidon<'a, E, Arity> where
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
E::Fr: Clone,
[src]
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
E::Fr: Clone,
impl<'a, E: Debug, Arity: Debug> Debug for Poseidon<'a, E, Arity> where
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
E::Fr: Debug,
[src]
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
E::Fr: Debug,
impl<'a, E: PartialEq, Arity: PartialEq> PartialEq<Poseidon<'a, E, Arity>> for Poseidon<'a, E, Arity> where
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
E::Fr: PartialEq,
[src]
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
E::Fr: PartialEq,
fn eq(&self, other: &Poseidon<'a, E, Arity>) -> bool
[src]
fn ne(&self, other: &Poseidon<'a, E, Arity>) -> bool
[src]
impl<'a, E, Arity> StructuralPartialEq for Poseidon<'a, E, Arity> where
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
[src]
E: ScalarEngine,
Arity: Unsigned + Add<B1> + Add<UInt<UTerm, B1>>,
Add1<Arity>: ArrayLength<E::Fr>,
Auto Trait Implementations
impl<'a, E, Arity> RefUnwindSafe for Poseidon<'a, E, Arity> where
Arity: RefUnwindSafe,
E: RefUnwindSafe,
<<Arity as Add<B1>>::Output as ArrayLength<<E as ScalarEngine>::Fr>>::ArrayType: RefUnwindSafe,
<E as ScalarEngine>::Fr: RefUnwindSafe,
Arity: RefUnwindSafe,
E: RefUnwindSafe,
<<Arity as Add<B1>>::Output as ArrayLength<<E as ScalarEngine>::Fr>>::ArrayType: RefUnwindSafe,
<E as ScalarEngine>::Fr: RefUnwindSafe,
impl<'a, E, Arity> Send for Poseidon<'a, E, Arity> where
Arity: Sync,
E: Send,
<E as ScalarEngine>::Fr: Send + Sync,
Arity: Sync,
E: Send,
<E as ScalarEngine>::Fr: Send + Sync,
impl<'a, E, Arity> Sync for Poseidon<'a, E, Arity> where
Arity: Sync,
E: Sync,
<E as ScalarEngine>::Fr: Sync,
Arity: Sync,
E: Sync,
<E as ScalarEngine>::Fr: Sync,
impl<'a, E, Arity> Unpin for Poseidon<'a, E, Arity> where
E: Unpin,
<<Arity as Add<B1>>::Output as ArrayLength<<E as ScalarEngine>::Fr>>::ArrayType: Unpin,
E: Unpin,
<<Arity as Add<B1>>::Output as ArrayLength<<E as ScalarEngine>::Fr>>::ArrayType: Unpin,
impl<'a, E, Arity> UnwindSafe for Poseidon<'a, E, Arity> where
Arity: RefUnwindSafe,
E: UnwindSafe,
<<Arity as Add<B1>>::Output as ArrayLength<<E as ScalarEngine>::Fr>>::ArrayType: UnwindSafe,
<E as ScalarEngine>::Fr: RefUnwindSafe,
Arity: RefUnwindSafe,
E: UnwindSafe,
<<Arity as Add<B1>>::Output as ArrayLength<<E as ScalarEngine>::Fr>>::ArrayType: UnwindSafe,
<E as ScalarEngine>::Fr: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,