58 auto t0 = input[0] + input[1];
59 auto t1 = input[2] + input[3];
60 auto t2 = input[1] + input[1];
62 auto t3 = input[3] + input[3];
80 for (
size_t i = 0; i <
t; ++i) {
91 for (
size_t i = 1; i <
t; ++i) {
94 for (
size_t i = 0; i <
t; ++i) {
102 static_assert(
t == 4,
"Only t=4 is supported");
114 auto x2 = input.sqr();
121 for (
auto& in : input) {
137 constexpr size_t rounds_f_beginning =
rounds_f / 2;
138 for (
size_t i = 0; i < rounds_f_beginning; ++i) {
145 constexpr size_t p_end = rounds_f_beginning +
rounds_p;
146 for (
size_t i = rounds_f_beginning; i < p_end; ++i) {
Applies the Poseidon2 permutation function from https://eprint.iacr.org/2023/323.
static constexpr size_t NUM_ROUNDS
static constexpr size_t rounds_f
static constexpr void permutation_inplace(State &state)
In-place Poseidon2 permutation from https://eprint.iacr.org/2023/323.
static constexpr size_t rounds_p
static constexpr State permutation(const State &input)
Native form of Poseidon2 permutation (returns new state).
static constexpr void matrix_multiplication_4x4(State &input)
static constexpr void apply_single_sbox(FF &input)
S-box: x -> x^5.
std::array< FF, t > RoundConstants
static constexpr void matrix_multiplication_internal(State &input)
static constexpr void matrix_multiplication_external(State &input)
static constexpr void add_round_constants(State &input, const RoundConstants &rc)
static constexpr size_t t
static constexpr void apply_sbox(State &input)
std::array< RoundConstants, NUM_ROUNDS > RoundConstantsContainer
std::array< FF, t > MatrixDiagonal
static constexpr RoundConstantsContainer round_constants
static constexpr MatrixDiagonal internal_matrix_diagonal_minus_one
std::array< FF, t > State
Inner sum(Cont< Inner, Args... > const &in)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
static constexpr size_t t
static constexpr std::array< FF, t > internal_matrix_diagonal_minus_one
static constexpr size_t rounds_f
static constexpr size_t rounds_p
static constexpr std::array< std::array< FF, t >, rounds_f+rounds_p > round_constants