Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <poseidon2_permutation.hpp>
Public Types | |
using | NativePermutation = crypto::Poseidon2Permutation< Params > |
using | FF = typename Params::FF |
using | State = std::array< field_t< Builder >, t > |
using | NativeState = std::array< FF, t > |
using | RoundConstants = std::array< FF, t > |
using | RoundConstantsContainer = std::array< RoundConstants, NUM_ROUNDS > |
Static Public Member Functions | |
static State | permutation (Builder *builder, const State &input) |
Circuit form of Poseidon2 permutation from https://eprint.iacr.org/2023/323. | |
static void | matrix_multiplication_external (Builder *builder, State &state) |
Separate function to do just the first linear layer (equivalent to external matrix mul). | |
Static Public Attributes | |
static constexpr size_t | t = Params::t |
static constexpr size_t | d = Params::d |
static constexpr size_t | sbox_size = Params::sbox_size |
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 RoundConstantsContainer | round_constants = Params::round_constants |
Definition at line 18 of file poseidon2_permutation.hpp.
using bb::stdlib::Poseidon2Permutation< Params, Builder >::FF = typename Params::FF |
Definition at line 37 of file poseidon2_permutation.hpp.
using bb::stdlib::Poseidon2Permutation< Params, Builder >::NativePermutation = crypto::Poseidon2Permutation<Params> |
Definition at line 20 of file poseidon2_permutation.hpp.
using bb::stdlib::Poseidon2Permutation< Params, Builder >::NativeState = std::array<FF, t> |
Definition at line 39 of file poseidon2_permutation.hpp.
using bb::stdlib::Poseidon2Permutation< Params, Builder >::RoundConstants = std::array<FF, t> |
Definition at line 41 of file poseidon2_permutation.hpp.
using bb::stdlib::Poseidon2Permutation< Params, Builder >::RoundConstantsContainer = std::array<RoundConstants, NUM_ROUNDS> |
Definition at line 42 of file poseidon2_permutation.hpp.
Definition at line 38 of file poseidon2_permutation.hpp.
|
static |
Separate function to do just the first linear layer (equivalent to external matrix mul).
We use 6 arithmetic gates to implement: gate 1: Compute tmp1 = state[0] + state[1] + 2 * state[3] gate 2: Compute tmp2 = 2 * state[1] + state[2] + state[3] gate 3: Compute v2 = 4 * state[0] + 4 * state[1] + tmp2 gate 4: Compute v1 = v2 + tmp1 gate 5: Compute v4 = tmp1 + 4 * state[2] + 4 * state[3] gate 6: Compute v3 = v4 + tmp2 output state is [v1, v2, v3, v4]
builder | |
state |
|
static |
Circuit 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.
builder | |
input |
|
staticconstexpr |
Definition at line 28 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 35 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 43 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 32 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 34 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 30 of file poseidon2_permutation.hpp.
|
staticconstexpr |
Definition at line 25 of file poseidon2_permutation.hpp.