Expand description
The Poseidon2 permutation.
This implementation was based upon the following resources:
- https://github.com/HorizenLabs/poseidon2/blob/main/plain_implementations/src/poseidon2/poseidon2.rs
- https://eprint.iacr.org/2023/323.pdf
Structs§
- A struct which holds the constants for the external layer.
- The 4x4 MDS matrix used by the Horizon Labs implementation of Poseidon2.
- The fastest 4x4 MDS matrix.
- The Poseidon2 permutation.
Traits§
- A trait containing all data needed to implement the external layers of Poseidon2.
- Initialize an external layer from a set of constants.
- A trait containing all data needed to implement the internal layers of Poseidon2.
- Initialize an internal layer from a set of constants.
Functions§
- A generic method performing the transformation:
- A helper method which allow any field to easily implement the initial External Layer.
- A helper method which allow any field to easily implement the terminal External Layer.
- A helper method which allows any field to easily implement Internal Layer. This should only be used in places where performance is not critical.
- Given a vector v compute the matrix vector product (1 + diag(v))state with 1 denoting the constant matrix of ones.
- Implement the matrix multiplication used by the external layer.
- Given a field, a width and an D return the number of full and partial rounds needed to achieve 128 bit security.
- The compiler doesn’t realize that add is associative so we help it out and minimize the dependency chains by hand.
- The compiler doesn’t realize that add is associative so we help it out and minimize the dependency chains by hand.