pub struct Instance<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> { /* private fields */ }
Expand description
Represents a generic instance of Poseidon
.
Intended for generic fixed-width hashing.
Implementations§
Source§impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
Sourcepub fn new(
parameters: &'a PoseidonParameters<STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>,
) -> Self
pub fn new( parameters: &'a PoseidonParameters<STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>, ) -> Self
Instantiate a new hash function over Fq given Parameters
.
Sourcepub fn n_to_1_fixed_hash(&mut self, input_words: &[Fq; STATE_SIZE]) -> Fq
pub fn n_to_1_fixed_hash(&mut self, input_words: &[Fq; STATE_SIZE]) -> Fq
Fixed width hash from n:1. Outputs a F given t
input words.
Sourcepub fn output_words(&self) -> [Fq; STATE_SIZE]
pub fn output_words(&self) -> [Fq; STATE_SIZE]
Print out internal state.
Sourcepub fn unoptimized_n_to_1_fixed_hash(
&mut self,
input_words: [Fq; STATE_SIZE],
) -> Fq
pub fn unoptimized_n_to_1_fixed_hash( &mut self, input_words: [Fq; STATE_SIZE], ) -> Fq
Fixed width hash from n:1. Outputs a F given t
input words. Unoptimized.
Auto Trait Implementations§
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> Freeze for Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> RefUnwindSafe for Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> Send for Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> Sync for Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> Unpin for Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
impl<'a, const STATE_SIZE: usize, const STATE_SIZE_MINUS_1: usize, const NUM_MDS_ELEMENTS: usize, const NUM_STATE_SIZE_MINUS_1_ELEMENTS: usize, const NUM_ROUND_ROWS: usize, const NUM_ROUND_COLS: usize, const NUM_ROUND_ELEMENTS: usize, const NUM_PARTIAL_ROUNDS: usize> UnwindSafe for Instance<'a, STATE_SIZE, STATE_SIZE_MINUS_1, NUM_MDS_ELEMENTS, NUM_STATE_SIZE_MINUS_1_ELEMENTS, NUM_ROUND_ROWS, NUM_ROUND_COLS, NUM_ROUND_ELEMENTS, NUM_PARTIAL_ROUNDS>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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