Crate p3_poseidon2

Source
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§

Traits§

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.