pub struct PoseidonSponge<F: PrimeField, const RATE: usize, const CAPACITY: usize> {
    pub mode: DuplexSpongeMode,
    /* private fields */
}
Expand description

A duplex sponge based using the Poseidon permutation.

This implementation of Poseidon is entirely from Fractal’s implementation in COS20 with small syntax changes.

Fields

mode: DuplexSpongeMode

Current mode (whether its absorbing or squeezing)

Implementations

Compress every two elements if possible. Provides a vector of (limb, num_of_additions), both of which are F.

Convert a TargetField element into limbs (not constraints) This is an internal function that would be reused by a number of other functions

Obtain the limbs directly from a big int

Push elements to sponge, treated in the non-native field representations.

obtain random bits from hashchain. not guaranteed to be uniformly distributed, should only be used in certain situations.

obtain random field elements from hashchain. not guaranteed to be uniformly distributed, should only be used in certain situations.

Trait Implementations

Takes in field elements.

Takes in field elements.

Takes out field elements of 168 bits.

Parameters used by the sponge.
Initialize a new instance of the sponge.
Takes out field elements.
Takes in field elements.
Initialize a new instance of the sponge.
Takes in bytes.
Takes out a field element of 168 bits.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.