Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
sha256.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 sha256Impl {
13 public:
14 using FF = FF_;
15
16 static constexpr std::array<size_t, 95> SUBRELATION_PARTIAL_LENGTHS = {
17 4, 3, 3, 3, 3, 3, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
18 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
19 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
20 };
21
22 template <typename AllEntities> inline static bool skip(const AllEntities& in)
23 {
24 using C = ColumnAndShifts;
25
26 return (in.get(C::sha256_sel)).is_zero();
27 }
28
29 template <typename ContainerOverSubrelations, typename AllEntities>
30 void static accumulate(ContainerOverSubrelations& evals,
31 const AllEntities& in,
32 [[maybe_unused]] const RelationParameters<FF>&,
33 [[maybe_unused]] const FF& scaling_factor);
34};
35
36template <typename FF> class sha256 : public Relation<sha256Impl<FF>> {
37 public:
38 static constexpr const std::string_view NAME = "sha256";
39
40 // Subrelation indices constants, to be used in tests.
41 static constexpr size_t SR_ROUNDS_REM_INIT = 4;
42 static constexpr size_t SR_ROUNDS_REM_DECREMENT = 5;
43 static constexpr size_t SR_PROPAGATE_INIT_A = 17;
44 static constexpr size_t SR_PROPAGATE_INIT_B = 18;
45 static constexpr size_t SR_PROPAGATE_INIT_C = 19;
46 static constexpr size_t SR_PROPAGATE_INIT_D = 20;
47 static constexpr size_t SR_PROPAGATE_INIT_E = 21;
48 static constexpr size_t SR_PROPAGATE_INIT_F = 22;
49 static constexpr size_t SR_PROPAGATE_INIT_G = 23;
50 static constexpr size_t SR_PROPAGATE_INIT_H = 24;
51
52 static std::string get_subrelation_label(size_t index)
53 {
54#ifdef AVM_INCLUDE_COLUMN_INFORMATION
55 switch (index) {
57 return "ROUNDS_REM_INIT";
59 return "ROUNDS_REM_DECREMENT";
61 return "PROPAGATE_INIT_A";
63 return "PROPAGATE_INIT_B";
65 return "PROPAGATE_INIT_C";
67 return "PROPAGATE_INIT_D";
69 return "PROPAGATE_INIT_E";
71 return "PROPAGATE_INIT_F";
73 return "PROPAGATE_INIT_G";
75 return "PROPAGATE_INIT_H";
76 }
77#endif
78 return std::to_string(index);
79 }
80};
81
82} // 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_PROPAGATE_INIT_H
Definition sha256.hpp:50
static constexpr size_t SR_PROPAGATE_INIT_E
Definition sha256.hpp:47
static constexpr size_t SR_ROUNDS_REM_DECREMENT
Definition sha256.hpp:42
static constexpr size_t SR_PROPAGATE_INIT_C
Definition sha256.hpp:45
static constexpr size_t SR_PROPAGATE_INIT_F
Definition sha256.hpp:48
static std::string get_subrelation_label(size_t index)
Definition sha256.hpp:52
static constexpr const std::string_view NAME
Definition sha256.hpp:38
static constexpr size_t SR_PROPAGATE_INIT_A
Definition sha256.hpp:43
static constexpr size_t SR_PROPAGATE_INIT_D
Definition sha256.hpp:46
static constexpr size_t SR_ROUNDS_REM_INIT
Definition sha256.hpp:41
static constexpr size_t SR_PROPAGATE_INIT_B
Definition sha256.hpp:44
static constexpr size_t SR_PROPAGATE_INIT_G
Definition sha256.hpp:49
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
static bool skip(const AllEntities &in)
Definition sha256.hpp:22
static constexpr std::array< size_t, 95 > SUBRELATION_PARTIAL_LENGTHS
Definition sha256.hpp:16
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.