Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
poseidon2_hash.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <string_view>
5
9
10namespace bb::avm2 {
11
12template <typename FF_> class poseidon2_hashImpl {
13 public:
14 using FF = FF_;
15
16 static constexpr std::array<size_t, 20> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 4, 3, 4,
17 5, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
18
19 template <typename AllEntities> inline static bool skip(const AllEntities& in)
20 {
21 using C = ColumnAndShifts;
22
23 return (in.get(C::poseidon2_hash_sel)).is_zero();
24 }
25
26 template <typename ContainerOverSubrelations, typename AllEntities>
27 void static accumulate(ContainerOverSubrelations& evals,
28 const AllEntities& in,
29 [[maybe_unused]] const RelationParameters<FF>&,
30 [[maybe_unused]] const FF& scaling_factor);
31};
32
33template <typename FF> class poseidon2_hash : public Relation<poseidon2_hashImpl<FF>> {
34 public:
35 static constexpr const std::string_view NAME = "poseidon2_hash";
36
37 // Subrelation indices constants, to be used in tests.
38 static constexpr size_t SR_SEL_ON_START_OR_END = 3;
39 static constexpr size_t SR_TRACE_CONTINUITY = 4;
40 static constexpr size_t SR_START_AFTER_LATCH = 5;
41
42 static std::string get_subrelation_label(size_t index)
43 {
44#ifdef AVM_INCLUDE_COLUMN_INFORMATION
45 switch (index) {
47 return "SEL_ON_START_OR_END";
49 return "TRACE_CONTINUITY";
51 return "START_AFTER_LATCH";
52 }
53#endif
54 return std::to_string(index);
55 }
56};
57
58} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr size_t SR_TRACE_CONTINUITY
static constexpr const std::string_view NAME
static constexpr size_t SR_START_AFTER_LATCH
static std::string get_subrelation_label(size_t index)
static constexpr size_t SR_SEL_ON_START_OR_END
static constexpr std::array< size_t, 20 > SUBRELATION_PARTIAL_LENGTHS
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
static bool skip(const AllEntities &in)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:35
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.