Struct light_poseidon::Poseidon
source · pub struct Poseidon<F: PrimeField> { /* private fields */ }
Expand description
A stateful sponge performing Poseidon hash computation.
Implementations§
source§impl<F: PrimeField> Poseidon<F>
impl<F: PrimeField> Poseidon<F>
sourcepub fn new(params: PoseidonParameters<F>) -> Self
pub fn new(params: PoseidonParameters<F>) -> Self
Returns a new Poseidon hasher based on the given parameters.
Optionally, a domain tag can be provided. If it is not provided, it will be set to zero.
source§impl<F: PrimeField> Poseidon<F>
impl<F: PrimeField> Poseidon<F>
pub fn new_circom(nr_inputs: usize) -> Result<Poseidon<Fr>, PoseidonError>
pub fn with_domain_tag_circom( nr_inputs: usize, domain_tag: Fr ) -> Result<Poseidon<Fr>, PoseidonError>
Trait Implementations§
source§impl<F: PrimeField> PoseidonBytesHasher for Poseidon<F>
impl<F: PrimeField> PoseidonBytesHasher for Poseidon<F>
source§fn hash_bytes_le(&mut self, inputs: &[&[u8]]) -> Result<[u8; 32], PoseidonError>
fn hash_bytes_le(&mut self, inputs: &[&[u8]]) -> Result<[u8; 32], PoseidonError>
Calculates a Poseidon hash for the given input of little-endian byte
slices and returns the result as a byte array. Read more
source§fn hash_bytes_be(&mut self, inputs: &[&[u8]]) -> Result<[u8; 32], PoseidonError>
fn hash_bytes_be(&mut self, inputs: &[&[u8]]) -> Result<[u8; 32], PoseidonError>
Calculates a Poseidon hash for the given input of big-endian byte slices
and returns the result as a byte array. Read more
source§impl<F: PrimeField> PoseidonHasher<F> for Poseidon<F>
impl<F: PrimeField> PoseidonHasher<F> for Poseidon<F>
Auto Trait Implementations§
impl<F> RefUnwindSafe for Poseidon<F>where F: RefUnwindSafe,
impl<F> Send for Poseidon<F>
impl<F> Sync for Poseidon<F>
impl<F> Unpin for Poseidon<F>where F: Unpin,
impl<F> UnwindSafe for Poseidon<F>where F: UnwindSafe,
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