|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Applies the Poseidon2 permutation function from https://eprint.iacr.org/2023/323. More...
#include <poseidon2_permutation.hpp>
Public Types | |
| using | FF = typename Params::FF |
| using | State = std::array< FF, t > |
| using | RoundConstants = std::array< FF, t > |
| using | MatrixDiagonal = std::array< FF, t > |
| using | RoundConstantsContainer = std::array< RoundConstants, NUM_ROUNDS > |
Static Public Member Functions | |
| static constexpr void | matrix_multiplication_4x4 (State &input) |
| static constexpr void | add_round_constants (State &input, const RoundConstants &rc) |
| static constexpr void | matrix_multiplication_internal (State &input) |
| static constexpr void | matrix_multiplication_external (State &input) |
| static constexpr void | apply_single_sbox (FF &input) |
| S-box: x -> x^5. | |
| static constexpr void | apply_sbox (State &input) |
| static constexpr State | permutation (const State &input) |
| Native form of Poseidon2 permutation from https://eprint.iacr.org/2023/323. | |
Static Public Attributes | |
| static constexpr size_t | t = Params::t |
| static constexpr size_t | rounds_f = Params::rounds_f |
| static constexpr size_t | rounds_p = Params::rounds_p |
| static constexpr size_t | NUM_ROUNDS = Params::rounds_f + Params::rounds_p |
| static constexpr MatrixDiagonal | internal_matrix_diagonal = Params::internal_matrix_diagonal |
| static constexpr RoundConstantsContainer | round_constants = Params::round_constants |
Applies the Poseidon2 permutation function from https://eprint.iacr.org/2023/323.
This algorithm was implemented using https://github.com/HorizenLabs/poseidon2 as a reference.
| Params |
Definition at line 23 of file poseidon2_permutation.hpp.
| using bb::crypto::Poseidon2Permutation< Params >::FF = typename Params::FF |
Definition at line 36 of file poseidon2_permutation.hpp.
| using bb::crypto::Poseidon2Permutation< Params >::MatrixDiagonal = std::array<FF, t> |
Definition at line 39 of file poseidon2_permutation.hpp.
| using bb::crypto::Poseidon2Permutation< Params >::RoundConstants = std::array<FF, t> |
Definition at line 38 of file poseidon2_permutation.hpp.
| using bb::crypto::Poseidon2Permutation< Params >::RoundConstantsContainer = std::array<RoundConstants, NUM_ROUNDS> |
Definition at line 40 of file poseidon2_permutation.hpp.
| using bb::crypto::Poseidon2Permutation< Params >::State = std::array<FF, t> |
Definition at line 37 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
Definition at line 78 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
Definition at line 117 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
S-box: x -> x^5.
For a given field, d is the smallest element of p such that gdc(d, p - 1) = 1 (excluding 1) For bn254/grumpkin, d = 5
Definition at line 110 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
hardcoded algorithm that evaluates matrix multiplication using the following MDS matrix: / \ | 5 7 1 3 | | 4 6 1 1 | | 1 3 5 7 | | 1 1 4 6 | \ /
Algorithm is taken directly from the Poseidon2 paper.
Definition at line 45 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
Definition at line 98 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
Definition at line 85 of file poseidon2_permutation.hpp.
|
inlinestaticconstexpr |
Native form of Poseidon2 permutation from https://eprint.iacr.org/2023/323.
The permutation consists of one initial linear layer, then a set of external rounds, a set of internal rounds, and a set of external rounds.
| input |
Definition at line 131 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 42 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 34 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 43 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 31 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 33 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 29 of file poseidon2_permutation.hpp.