Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
sha256_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void sha256Impl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto constants_AVM_BITWISE_AND_OP_ID = FF(1);
19 const auto constants_AVM_BITWISE_XOR_OP_ID = FF(4);
20 const auto sha256_SEL_NO_ERR = in.get(C::sha256_sel) * (FF(1) - in.get(C::sha256_err));
21 const auto sha256_NUM_ROUNDS = FF(64);
22 const auto sha256_COMPUTED_W =
23 in.get(C::sha256_helper_w0) + in.get(C::sha256_w_s_0) + in.get(C::sha256_helper_w9) + in.get(C::sha256_w_s_1);
24 const auto sha256_TMP_1 = in.get(C::sha256_h) + in.get(C::sha256_s_1) + in.get(C::sha256_ch) +
25 in.get(C::sha256_round_constant) + in.get(C::sha256_w);
26 const auto sha256_NEXT_A = in.get(C::sha256_s_0) + in.get(C::sha256_maj) + sha256_TMP_1;
27 const auto sha256_NEXT_E = in.get(C::sha256_d) + sha256_TMP_1;
28 const auto sha256_OUT_A = in.get(C::sha256_a) + in.get(C::sha256_init_a);
29 const auto sha256_OUT_B = in.get(C::sha256_b) + in.get(C::sha256_init_b);
30 const auto sha256_OUT_C = in.get(C::sha256_c) + in.get(C::sha256_init_c);
31 const auto sha256_OUT_D = in.get(C::sha256_d) + in.get(C::sha256_init_d);
32 const auto sha256_OUT_E = in.get(C::sha256_e) + in.get(C::sha256_init_e);
33 const auto sha256_OUT_F = in.get(C::sha256_f) + in.get(C::sha256_init_f);
34 const auto sha256_OUT_G = in.get(C::sha256_g) + in.get(C::sha256_init_g);
35 const auto sha256_OUT_H = in.get(C::sha256_h) + in.get(C::sha256_init_h);
36 const auto sha256_LATCH_CONDITION = in.get(C::sha256_latch) + in.get(C::precomputed_first_row);
37
38 {
39 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
40 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
41 (static_cast<View>(in.get(C::sha256_xor_op_id)) - CView(constants_AVM_BITWISE_XOR_OP_ID));
42 std::get<0>(evals) += (tmp * scaling_factor);
43 }
44 {
45 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
46 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
47 (static_cast<View>(in.get(C::sha256_and_op_id)) - CView(constants_AVM_BITWISE_AND_OP_ID));
48 std::get<1>(evals) += (tmp * scaling_factor);
49 }
50 {
51 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
52 auto tmp = (static_cast<View>(in.get(C::sha256_perform_round)) -
53 (FF(1) - CView(sha256_LATCH_CONDITION)) * CView(sha256_SEL_NO_ERR));
54 std::get<2>(evals) += (tmp * scaling_factor);
55 }
56 {
57 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
58 auto tmp = (static_cast<View>(in.get(C::sha256_last)) -
59 CView(sha256_SEL_NO_ERR) * static_cast<View>(in.get(C::sha256_latch)));
60 std::get<3>(evals) += (tmp * scaling_factor);
61 }
62 {
63 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
64 auto tmp = (static_cast<View>(in.get(C::sha256_start)) *
65 (static_cast<View>(in.get(C::sha256_rounds_remaining)) - CView(sha256_NUM_ROUNDS)) +
66 static_cast<View>(in.get(C::sha256_perform_round)) *
67 ((static_cast<View>(in.get(C::sha256_rounds_remaining)) -
68 static_cast<View>(in.get(C::sha256_rounds_remaining_shift))) -
69 FF(1)));
70 std::get<4>(evals) += (tmp * scaling_factor);
71 }
72 {
73 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
74 auto tmp = CView(sha256_SEL_NO_ERR) *
75 (static_cast<View>(in.get(C::sha256_round_count)) -
76 (CView(sha256_NUM_ROUNDS) - static_cast<View>(in.get(C::sha256_rounds_remaining))));
77 std::get<5>(evals) += (tmp * scaling_factor);
78 }
79 {
80 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
81 auto tmp =
82 CView(sha256_SEL_NO_ERR) * ((static_cast<View>(in.get(C::sha256_rounds_remaining)) *
83 (static_cast<View>(in.get(C::sha256_latch)) *
84 (FF(1) - static_cast<View>(in.get(C::sha256_rounds_remaining_inv))) +
85 static_cast<View>(in.get(C::sha256_rounds_remaining_inv))) -
86 FF(1)) +
87 static_cast<View>(in.get(C::sha256_latch)));
88 std::get<6>(evals) += (tmp * scaling_factor);
89 }
90 {
91 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
92 auto tmp = CView(sha256_SEL_NO_ERR) * (static_cast<View>(in.get(C::sha256_two_pow_32)) - FF(4294967296UL));
93 std::get<7>(evals) += (tmp * scaling_factor);
94 }
95 {
96 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
97 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
98 (static_cast<View>(in.get(C::sha256_a)) - static_cast<View>(in.get(C::sha256_init_a)));
99 std::get<8>(evals) += (tmp * scaling_factor);
100 }
101 {
102 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
103 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
104 (static_cast<View>(in.get(C::sha256_b)) - static_cast<View>(in.get(C::sha256_init_b)));
105 std::get<9>(evals) += (tmp * scaling_factor);
106 }
107 {
108 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
109 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
110 (static_cast<View>(in.get(C::sha256_c)) - static_cast<View>(in.get(C::sha256_init_c)));
111 std::get<10>(evals) += (tmp * scaling_factor);
112 }
113 {
114 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
115 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
116 (static_cast<View>(in.get(C::sha256_d)) - static_cast<View>(in.get(C::sha256_init_d)));
117 std::get<11>(evals) += (tmp * scaling_factor);
118 }
119 {
120 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
121 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
122 (static_cast<View>(in.get(C::sha256_e)) - static_cast<View>(in.get(C::sha256_init_e)));
123 std::get<12>(evals) += (tmp * scaling_factor);
124 }
125 {
126 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
127 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
128 (static_cast<View>(in.get(C::sha256_f)) - static_cast<View>(in.get(C::sha256_init_f)));
129 std::get<13>(evals) += (tmp * scaling_factor);
130 }
131 {
132 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
133 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
134 (static_cast<View>(in.get(C::sha256_g)) - static_cast<View>(in.get(C::sha256_init_g)));
135 std::get<14>(evals) += (tmp * scaling_factor);
136 }
137 {
138 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
139 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_err))) *
140 (static_cast<View>(in.get(C::sha256_h)) - static_cast<View>(in.get(C::sha256_init_h)));
141 std::get<15>(evals) += (tmp * scaling_factor);
142 }
143 { // PROPAGATE_INIT_A
144 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
145 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
146 (static_cast<View>(in.get(C::sha256_init_a_shift)) - static_cast<View>(in.get(C::sha256_init_a)));
147 std::get<16>(evals) += (tmp * scaling_factor);
148 }
149 { // PROPAGATE_INIT_B
150 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
151 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
152 (static_cast<View>(in.get(C::sha256_init_b_shift)) - static_cast<View>(in.get(C::sha256_init_b)));
153 std::get<17>(evals) += (tmp * scaling_factor);
154 }
155 { // PROPAGATE_INIT_C
156 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
157 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
158 (static_cast<View>(in.get(C::sha256_init_c_shift)) - static_cast<View>(in.get(C::sha256_init_c)));
159 std::get<18>(evals) += (tmp * scaling_factor);
160 }
161 { // PROPAGATE_INIT_D
162 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
163 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
164 (static_cast<View>(in.get(C::sha256_init_d_shift)) - static_cast<View>(in.get(C::sha256_init_d)));
165 std::get<19>(evals) += (tmp * scaling_factor);
166 }
167 { // PROPAGATE_INIT_E
168 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
169 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
170 (static_cast<View>(in.get(C::sha256_init_e_shift)) - static_cast<View>(in.get(C::sha256_init_e)));
171 std::get<20>(evals) += (tmp * scaling_factor);
172 }
173 { // PROPAGATE_INIT_F
174 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
175 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
176 (static_cast<View>(in.get(C::sha256_init_f_shift)) - static_cast<View>(in.get(C::sha256_init_f)));
177 std::get<21>(evals) += (tmp * scaling_factor);
178 }
179 { // PROPAGATE_INIT_G
180 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
181 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
182 (static_cast<View>(in.get(C::sha256_init_g_shift)) - static_cast<View>(in.get(C::sha256_init_g)));
183 std::get<22>(evals) += (tmp * scaling_factor);
184 }
185 { // PROPAGATE_INIT_H
186 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
187 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
188 (static_cast<View>(in.get(C::sha256_init_h_shift)) - static_cast<View>(in.get(C::sha256_init_h)));
189 std::get<23>(evals) += (tmp * scaling_factor);
190 }
191 {
192 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
193 auto tmp =
194 static_cast<View>(in.get(C::sha256_perform_round)) *
195 (static_cast<View>(in.get(C::sha256_helper_w0_shift)) - static_cast<View>(in.get(C::sha256_helper_w1)));
196 std::get<24>(evals) += (tmp * scaling_factor);
197 }
198 {
199 using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
200 auto tmp =
201 static_cast<View>(in.get(C::sha256_perform_round)) *
202 (static_cast<View>(in.get(C::sha256_helper_w1_shift)) - static_cast<View>(in.get(C::sha256_helper_w2)));
203 std::get<25>(evals) += (tmp * scaling_factor);
204 }
205 {
206 using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View;
207 auto tmp =
208 static_cast<View>(in.get(C::sha256_perform_round)) *
209 (static_cast<View>(in.get(C::sha256_helper_w2_shift)) - static_cast<View>(in.get(C::sha256_helper_w3)));
210 std::get<26>(evals) += (tmp * scaling_factor);
211 }
212 {
213 using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View;
214 auto tmp =
215 static_cast<View>(in.get(C::sha256_perform_round)) *
216 (static_cast<View>(in.get(C::sha256_helper_w3_shift)) - static_cast<View>(in.get(C::sha256_helper_w4)));
217 std::get<27>(evals) += (tmp * scaling_factor);
218 }
219 {
220 using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View;
221 auto tmp =
222 static_cast<View>(in.get(C::sha256_perform_round)) *
223 (static_cast<View>(in.get(C::sha256_helper_w4_shift)) - static_cast<View>(in.get(C::sha256_helper_w5)));
224 std::get<28>(evals) += (tmp * scaling_factor);
225 }
226 {
227 using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View;
228 auto tmp =
229 static_cast<View>(in.get(C::sha256_perform_round)) *
230 (static_cast<View>(in.get(C::sha256_helper_w5_shift)) - static_cast<View>(in.get(C::sha256_helper_w6)));
231 std::get<29>(evals) += (tmp * scaling_factor);
232 }
233 {
234 using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
235 auto tmp =
236 static_cast<View>(in.get(C::sha256_perform_round)) *
237 (static_cast<View>(in.get(C::sha256_helper_w6_shift)) - static_cast<View>(in.get(C::sha256_helper_w7)));
238 std::get<30>(evals) += (tmp * scaling_factor);
239 }
240 {
241 using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
242 auto tmp =
243 static_cast<View>(in.get(C::sha256_perform_round)) *
244 (static_cast<View>(in.get(C::sha256_helper_w7_shift)) - static_cast<View>(in.get(C::sha256_helper_w8)));
245 std::get<31>(evals) += (tmp * scaling_factor);
246 }
247 {
248 using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
249 auto tmp =
250 static_cast<View>(in.get(C::sha256_perform_round)) *
251 (static_cast<View>(in.get(C::sha256_helper_w8_shift)) - static_cast<View>(in.get(C::sha256_helper_w9)));
252 std::get<32>(evals) += (tmp * scaling_factor);
253 }
254 {
255 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
256 auto tmp =
257 static_cast<View>(in.get(C::sha256_perform_round)) *
258 (static_cast<View>(in.get(C::sha256_helper_w9_shift)) - static_cast<View>(in.get(C::sha256_helper_w10)));
259 std::get<33>(evals) += (tmp * scaling_factor);
260 }
261 {
262 using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
263 auto tmp =
264 static_cast<View>(in.get(C::sha256_perform_round)) *
265 (static_cast<View>(in.get(C::sha256_helper_w10_shift)) - static_cast<View>(in.get(C::sha256_helper_w11)));
266 std::get<34>(evals) += (tmp * scaling_factor);
267 }
268 {
269 using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
270 auto tmp =
271 static_cast<View>(in.get(C::sha256_perform_round)) *
272 (static_cast<View>(in.get(C::sha256_helper_w11_shift)) - static_cast<View>(in.get(C::sha256_helper_w12)));
273 std::get<35>(evals) += (tmp * scaling_factor);
274 }
275 {
276 using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
277 auto tmp =
278 static_cast<View>(in.get(C::sha256_perform_round)) *
279 (static_cast<View>(in.get(C::sha256_helper_w12_shift)) - static_cast<View>(in.get(C::sha256_helper_w13)));
280 std::get<36>(evals) += (tmp * scaling_factor);
281 }
282 {
283 using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
284 auto tmp =
285 static_cast<View>(in.get(C::sha256_perform_round)) *
286 (static_cast<View>(in.get(C::sha256_helper_w13_shift)) - static_cast<View>(in.get(C::sha256_helper_w14)));
287 std::get<37>(evals) += (tmp * scaling_factor);
288 }
289 {
290 using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
291 auto tmp =
292 static_cast<View>(in.get(C::sha256_perform_round)) *
293 (static_cast<View>(in.get(C::sha256_helper_w14_shift)) - static_cast<View>(in.get(C::sha256_helper_w15)));
294 std::get<38>(evals) += (tmp * scaling_factor);
295 }
296 {
297 using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
298 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
299 (static_cast<View>(in.get(C::sha256_helper_w15_shift)) - static_cast<View>(in.get(C::sha256_w)));
300 std::get<39>(evals) += (tmp * scaling_factor);
301 }
302 {
303 using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
304 auto tmp = (static_cast<View>(in.get(C::sha256_sel_compute_w)) -
305 static_cast<View>(in.get(C::sha256_perform_round)) *
306 (FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round))));
307 std::get<40>(evals) += (tmp * scaling_factor);
308 }
309 {
310 using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
311 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
312 ((static_cast<View>(in.get(C::sha256_computed_w_lhs)) * FF(4294967296UL) +
313 static_cast<View>(in.get(C::sha256_computed_w_rhs))) -
314 CView(sha256_COMPUTED_W));
315 std::get<41>(evals) += (tmp * scaling_factor);
316 }
317 {
318 using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View;
319 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
320 (static_cast<View>(in.get(C::sha256_w)) - static_cast<View>(in.get(C::sha256_computed_w_rhs)));
321 std::get<42>(evals) += (tmp * scaling_factor);
322 }
323 {
324 using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View;
325 auto tmp =
326 static_cast<View>(in.get(C::sha256_sel_compute_w)) *
327 (static_cast<View>(in.get(C::sha256_helper_w1)) -
328 (static_cast<View>(in.get(C::sha256_lhs_w_7)) * FF(128) + static_cast<View>(in.get(C::sha256_rhs_w_7))));
329 std::get<43>(evals) += (tmp * scaling_factor);
330 }
331 {
332 using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View;
333 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
334 (static_cast<View>(in.get(C::sha256_w_15_rotr_7)) -
335 (static_cast<View>(in.get(C::sha256_rhs_w_7)) * FF(33554432) +
336 static_cast<View>(in.get(C::sha256_lhs_w_7))));
337 std::get<44>(evals) += (tmp * scaling_factor);
338 }
339 {
340 using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View;
341 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
342 (static_cast<View>(in.get(C::sha256_two_pow_7)) - FF(128));
343 std::get<45>(evals) += (tmp * scaling_factor);
344 }
345 {
346 using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View;
347 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
348 (static_cast<View>(in.get(C::sha256_helper_w1)) -
349 (static_cast<View>(in.get(C::sha256_lhs_w_18)) * FF(262144) +
350 static_cast<View>(in.get(C::sha256_rhs_w_18))));
351 std::get<46>(evals) += (tmp * scaling_factor);
352 }
353 {
354 using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View;
355 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
356 (static_cast<View>(in.get(C::sha256_w_15_rotr_18)) -
357 (static_cast<View>(in.get(C::sha256_rhs_w_18)) * FF(16384) +
358 static_cast<View>(in.get(C::sha256_lhs_w_18))));
359 std::get<47>(evals) += (tmp * scaling_factor);
360 }
361 {
362 using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View;
363 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
364 (static_cast<View>(in.get(C::sha256_two_pow_18)) - FF(262144));
365 std::get<48>(evals) += (tmp * scaling_factor);
366 }
367 {
368 using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View;
369 auto tmp =
370 static_cast<View>(in.get(C::sha256_sel_compute_w)) *
371 (static_cast<View>(in.get(C::sha256_helper_w1)) -
372 (static_cast<View>(in.get(C::sha256_lhs_w_3)) * FF(8) + static_cast<View>(in.get(C::sha256_rhs_w_3))));
373 std::get<49>(evals) += (tmp * scaling_factor);
374 }
375 {
376 using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View;
377 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
378 (static_cast<View>(in.get(C::sha256_w_15_rshift_3)) - static_cast<View>(in.get(C::sha256_lhs_w_3)));
379 std::get<50>(evals) += (tmp * scaling_factor);
380 }
381 {
382 using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View;
383 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
384 (static_cast<View>(in.get(C::sha256_two_pow_3)) - FF(8));
385 std::get<51>(evals) += (tmp * scaling_factor);
386 }
387 {
388 using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View;
389 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
390 (static_cast<View>(in.get(C::sha256_helper_w14)) -
391 (static_cast<View>(in.get(C::sha256_lhs_w_17)) * FF(131072) +
392 static_cast<View>(in.get(C::sha256_rhs_w_17))));
393 std::get<52>(evals) += (tmp * scaling_factor);
394 }
395 {
396 using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View;
397 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
398 (static_cast<View>(in.get(C::sha256_w_2_rotr_17)) -
399 (static_cast<View>(in.get(C::sha256_rhs_w_17)) * FF(32768) +
400 static_cast<View>(in.get(C::sha256_lhs_w_17))));
401 std::get<53>(evals) += (tmp * scaling_factor);
402 }
403 {
404 using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View;
405 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
406 (static_cast<View>(in.get(C::sha256_two_pow_17)) - FF(131072));
407 std::get<54>(evals) += (tmp * scaling_factor);
408 }
409 {
410 using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View;
411 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
412 (static_cast<View>(in.get(C::sha256_helper_w14)) -
413 (static_cast<View>(in.get(C::sha256_lhs_w_19)) * FF(524288) +
414 static_cast<View>(in.get(C::sha256_rhs_w_19))));
415 std::get<55>(evals) += (tmp * scaling_factor);
416 }
417 {
418 using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View;
419 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
420 (static_cast<View>(in.get(C::sha256_w_2_rotr_19)) -
421 (static_cast<View>(in.get(C::sha256_rhs_w_19)) * FF(8192) +
422 static_cast<View>(in.get(C::sha256_lhs_w_19))));
423 std::get<56>(evals) += (tmp * scaling_factor);
424 }
425 {
426 using View = typename std::tuple_element_t<57, ContainerOverSubrelations>::View;
427 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
428 (static_cast<View>(in.get(C::sha256_two_pow_19)) - FF(524288));
429 std::get<57>(evals) += (tmp * scaling_factor);
430 }
431 {
432 using View = typename std::tuple_element_t<58, ContainerOverSubrelations>::View;
433 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
434 (static_cast<View>(in.get(C::sha256_helper_w14)) -
435 (static_cast<View>(in.get(C::sha256_lhs_w_10)) * FF(1024) +
436 static_cast<View>(in.get(C::sha256_rhs_w_10))));
437 std::get<58>(evals) += (tmp * scaling_factor);
438 }
439 {
440 using View = typename std::tuple_element_t<59, ContainerOverSubrelations>::View;
441 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
442 (static_cast<View>(in.get(C::sha256_w_2_rshift_10)) - static_cast<View>(in.get(C::sha256_lhs_w_10)));
443 std::get<59>(evals) += (tmp * scaling_factor);
444 }
445 {
446 using View = typename std::tuple_element_t<60, ContainerOverSubrelations>::View;
447 auto tmp = static_cast<View>(in.get(C::sha256_sel_compute_w)) *
448 (static_cast<View>(in.get(C::sha256_two_pow_10)) - FF(1024));
449 std::get<60>(evals) += (tmp * scaling_factor);
450 }
451 {
452 using View = typename std::tuple_element_t<61, ContainerOverSubrelations>::View;
453 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
454 (static_cast<View>(in.get(C::sha256_e)) - (static_cast<View>(in.get(C::sha256_lhs_e_6)) * FF(64) +
455 static_cast<View>(in.get(C::sha256_rhs_e_6))));
456 std::get<61>(evals) += (tmp * scaling_factor);
457 }
458 {
459 using View = typename std::tuple_element_t<62, ContainerOverSubrelations>::View;
460 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
461 (static_cast<View>(in.get(C::sha256_e_rotr_6)) -
462 (static_cast<View>(in.get(C::sha256_rhs_e_6)) * FF(67108864) +
463 static_cast<View>(in.get(C::sha256_lhs_e_6))));
464 std::get<62>(evals) += (tmp * scaling_factor);
465 }
466 {
467 using View = typename std::tuple_element_t<63, ContainerOverSubrelations>::View;
468 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
469 (static_cast<View>(in.get(C::sha256_two_pow_6)) - FF(64));
470 std::get<63>(evals) += (tmp * scaling_factor);
471 }
472 {
473 using View = typename std::tuple_element_t<64, ContainerOverSubrelations>::View;
474 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
475 (static_cast<View>(in.get(C::sha256_e)) - (static_cast<View>(in.get(C::sha256_lhs_e_11)) * FF(2048) +
476 static_cast<View>(in.get(C::sha256_rhs_e_11))));
477 std::get<64>(evals) += (tmp * scaling_factor);
478 }
479 {
480 using View = typename std::tuple_element_t<65, ContainerOverSubrelations>::View;
481 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
482 (static_cast<View>(in.get(C::sha256_e_rotr_11)) -
483 (static_cast<View>(in.get(C::sha256_rhs_e_11)) * FF(2097152) +
484 static_cast<View>(in.get(C::sha256_lhs_e_11))));
485 std::get<65>(evals) += (tmp * scaling_factor);
486 }
487 {
488 using View = typename std::tuple_element_t<66, ContainerOverSubrelations>::View;
489 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
490 (static_cast<View>(in.get(C::sha256_two_pow_11)) - FF(2048));
491 std::get<66>(evals) += (tmp * scaling_factor);
492 }
493 {
494 using View = typename std::tuple_element_t<67, ContainerOverSubrelations>::View;
495 auto tmp =
496 static_cast<View>(in.get(C::sha256_perform_round)) *
497 (static_cast<View>(in.get(C::sha256_e)) - (static_cast<View>(in.get(C::sha256_lhs_e_25)) * FF(33554432) +
498 static_cast<View>(in.get(C::sha256_rhs_e_25))));
499 std::get<67>(evals) += (tmp * scaling_factor);
500 }
501 {
502 using View = typename std::tuple_element_t<68, ContainerOverSubrelations>::View;
503 auto tmp =
504 static_cast<View>(in.get(C::sha256_perform_round)) *
505 (static_cast<View>(in.get(C::sha256_e_rotr_25)) -
506 (static_cast<View>(in.get(C::sha256_rhs_e_25)) * FF(128) + static_cast<View>(in.get(C::sha256_lhs_e_25))));
507 std::get<68>(evals) += (tmp * scaling_factor);
508 }
509 {
510 using View = typename std::tuple_element_t<69, ContainerOverSubrelations>::View;
511 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
512 (static_cast<View>(in.get(C::sha256_two_pow_25)) - FF(33554432));
513 std::get<69>(evals) += (tmp * scaling_factor);
514 }
515 {
516 using View = typename std::tuple_element_t<70, ContainerOverSubrelations>::View;
517 auto tmp =
518 static_cast<View>(in.get(C::sha256_perform_round)) *
519 ((static_cast<View>(in.get(C::sha256_e)) + static_cast<View>(in.get(C::sha256_not_e))) - FF(4294967295UL));
520 std::get<70>(evals) += (tmp * scaling_factor);
521 }
522 {
523 using View = typename std::tuple_element_t<71, ContainerOverSubrelations>::View;
524 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
525 (static_cast<View>(in.get(C::sha256_a)) - (static_cast<View>(in.get(C::sha256_lhs_a_2)) * FF(4) +
526 static_cast<View>(in.get(C::sha256_rhs_a_2))));
527 std::get<71>(evals) += (tmp * scaling_factor);
528 }
529 {
530 using View = typename std::tuple_element_t<72, ContainerOverSubrelations>::View;
531 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
532 (static_cast<View>(in.get(C::sha256_a_rotr_2)) -
533 (static_cast<View>(in.get(C::sha256_rhs_a_2)) * FF(1073741824) +
534 static_cast<View>(in.get(C::sha256_lhs_a_2))));
535 std::get<72>(evals) += (tmp * scaling_factor);
536 }
537 {
538 using View = typename std::tuple_element_t<73, ContainerOverSubrelations>::View;
539 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
540 (static_cast<View>(in.get(C::sha256_two_pow_2)) - FF(4));
541 std::get<73>(evals) += (tmp * scaling_factor);
542 }
543 {
544 using View = typename std::tuple_element_t<74, ContainerOverSubrelations>::View;
545 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
546 (static_cast<View>(in.get(C::sha256_a)) - (static_cast<View>(in.get(C::sha256_lhs_a_13)) * FF(8192) +
547 static_cast<View>(in.get(C::sha256_rhs_a_13))));
548 std::get<74>(evals) += (tmp * scaling_factor);
549 }
550 {
551 using View = typename std::tuple_element_t<75, ContainerOverSubrelations>::View;
552 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
553 (static_cast<View>(in.get(C::sha256_a_rotr_13)) -
554 (static_cast<View>(in.get(C::sha256_rhs_a_13)) * FF(524288) +
555 static_cast<View>(in.get(C::sha256_lhs_a_13))));
556 std::get<75>(evals) += (tmp * scaling_factor);
557 }
558 {
559 using View = typename std::tuple_element_t<76, ContainerOverSubrelations>::View;
560 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
561 (static_cast<View>(in.get(C::sha256_two_pow_13)) - FF(8192));
562 std::get<76>(evals) += (tmp * scaling_factor);
563 }
564 {
565 using View = typename std::tuple_element_t<77, ContainerOverSubrelations>::View;
566 auto tmp =
567 static_cast<View>(in.get(C::sha256_perform_round)) *
568 (static_cast<View>(in.get(C::sha256_a)) - (static_cast<View>(in.get(C::sha256_lhs_a_22)) * FF(4194304) +
569 static_cast<View>(in.get(C::sha256_rhs_a_22))));
570 std::get<77>(evals) += (tmp * scaling_factor);
571 }
572 {
573 using View = typename std::tuple_element_t<78, ContainerOverSubrelations>::View;
574 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
575 (static_cast<View>(in.get(C::sha256_a_rotr_22)) -
576 (static_cast<View>(in.get(C::sha256_rhs_a_22)) * FF(1024) +
577 static_cast<View>(in.get(C::sha256_lhs_a_22))));
578 std::get<78>(evals) += (tmp * scaling_factor);
579 }
580 {
581 using View = typename std::tuple_element_t<79, ContainerOverSubrelations>::View;
582 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
583 (static_cast<View>(in.get(C::sha256_two_pow_22)) - FF(4194304));
584 std::get<79>(evals) += (tmp * scaling_factor);
585 }
586 {
587 using View = typename std::tuple_element_t<80, ContainerOverSubrelations>::View;
588 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
589 ((static_cast<View>(in.get(C::sha256_next_a_lhs)) * FF(4294967296UL) +
590 static_cast<View>(in.get(C::sha256_next_a_rhs))) -
591 CView(sha256_NEXT_A));
592 std::get<80>(evals) += (tmp * scaling_factor);
593 }
594 {
595 using View = typename std::tuple_element_t<81, ContainerOverSubrelations>::View;
596 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
597 ((static_cast<View>(in.get(C::sha256_next_e_lhs)) * FF(4294967296UL) +
598 static_cast<View>(in.get(C::sha256_next_e_rhs))) -
599 CView(sha256_NEXT_E));
600 std::get<81>(evals) += (tmp * scaling_factor);
601 }
602 {
603 using View = typename std::tuple_element_t<82, ContainerOverSubrelations>::View;
604 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
605 (static_cast<View>(in.get(C::sha256_a_shift)) - static_cast<View>(in.get(C::sha256_next_a_rhs)));
606 std::get<82>(evals) += (tmp * scaling_factor);
607 }
608 {
609 using View = typename std::tuple_element_t<83, ContainerOverSubrelations>::View;
610 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
611 (static_cast<View>(in.get(C::sha256_b_shift)) - static_cast<View>(in.get(C::sha256_a)));
612 std::get<83>(evals) += (tmp * scaling_factor);
613 }
614 {
615 using View = typename std::tuple_element_t<84, ContainerOverSubrelations>::View;
616 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
617 (static_cast<View>(in.get(C::sha256_c_shift)) - static_cast<View>(in.get(C::sha256_b)));
618 std::get<84>(evals) += (tmp * scaling_factor);
619 }
620 {
621 using View = typename std::tuple_element_t<85, ContainerOverSubrelations>::View;
622 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
623 (static_cast<View>(in.get(C::sha256_d_shift)) - static_cast<View>(in.get(C::sha256_c)));
624 std::get<85>(evals) += (tmp * scaling_factor);
625 }
626 {
627 using View = typename std::tuple_element_t<86, ContainerOverSubrelations>::View;
628 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
629 (static_cast<View>(in.get(C::sha256_e_shift)) - static_cast<View>(in.get(C::sha256_next_e_rhs)));
630 std::get<86>(evals) += (tmp * scaling_factor);
631 }
632 {
633 using View = typename std::tuple_element_t<87, ContainerOverSubrelations>::View;
634 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
635 (static_cast<View>(in.get(C::sha256_f_shift)) - static_cast<View>(in.get(C::sha256_e)));
636 std::get<87>(evals) += (tmp * scaling_factor);
637 }
638 {
639 using View = typename std::tuple_element_t<88, ContainerOverSubrelations>::View;
640 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
641 (static_cast<View>(in.get(C::sha256_g_shift)) - static_cast<View>(in.get(C::sha256_f)));
642 std::get<88>(evals) += (tmp * scaling_factor);
643 }
644 {
645 using View = typename std::tuple_element_t<89, ContainerOverSubrelations>::View;
646 auto tmp = static_cast<View>(in.get(C::sha256_perform_round)) *
647 (static_cast<View>(in.get(C::sha256_h_shift)) - static_cast<View>(in.get(C::sha256_g)));
648 std::get<89>(evals) += (tmp * scaling_factor);
649 }
650 {
651 using View = typename std::tuple_element_t<90, ContainerOverSubrelations>::View;
652 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
653 (CView(sha256_OUT_A) - (static_cast<View>(in.get(C::sha256_output_a_lhs)) * FF(4294967296UL) +
654 static_cast<View>(in.get(C::sha256_output_a_rhs))));
655 std::get<90>(evals) += (tmp * scaling_factor);
656 }
657 {
658 using View = typename std::tuple_element_t<91, ContainerOverSubrelations>::View;
659 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
660 (CView(sha256_OUT_B) - (static_cast<View>(in.get(C::sha256_output_b_lhs)) * FF(4294967296UL) +
661 static_cast<View>(in.get(C::sha256_output_b_rhs))));
662 std::get<91>(evals) += (tmp * scaling_factor);
663 }
664 {
665 using View = typename std::tuple_element_t<92, ContainerOverSubrelations>::View;
666 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
667 (CView(sha256_OUT_C) - (static_cast<View>(in.get(C::sha256_output_c_lhs)) * FF(4294967296UL) +
668 static_cast<View>(in.get(C::sha256_output_c_rhs))));
669 std::get<92>(evals) += (tmp * scaling_factor);
670 }
671 {
672 using View = typename std::tuple_element_t<93, ContainerOverSubrelations>::View;
673 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
674 (CView(sha256_OUT_D) - (static_cast<View>(in.get(C::sha256_output_d_lhs)) * FF(4294967296UL) +
675 static_cast<View>(in.get(C::sha256_output_d_rhs))));
676 std::get<93>(evals) += (tmp * scaling_factor);
677 }
678 {
679 using View = typename std::tuple_element_t<94, ContainerOverSubrelations>::View;
680 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
681 (CView(sha256_OUT_E) - (static_cast<View>(in.get(C::sha256_output_e_lhs)) * FF(4294967296UL) +
682 static_cast<View>(in.get(C::sha256_output_e_rhs))));
683 std::get<94>(evals) += (tmp * scaling_factor);
684 }
685 {
686 using View = typename std::tuple_element_t<95, ContainerOverSubrelations>::View;
687 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
688 (CView(sha256_OUT_F) - (static_cast<View>(in.get(C::sha256_output_f_lhs)) * FF(4294967296UL) +
689 static_cast<View>(in.get(C::sha256_output_f_rhs))));
690 std::get<95>(evals) += (tmp * scaling_factor);
691 }
692 {
693 using View = typename std::tuple_element_t<96, ContainerOverSubrelations>::View;
694 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
695 (CView(sha256_OUT_G) - (static_cast<View>(in.get(C::sha256_output_g_lhs)) * FF(4294967296UL) +
696 static_cast<View>(in.get(C::sha256_output_g_rhs))));
697 std::get<96>(evals) += (tmp * scaling_factor);
698 }
699 {
700 using View = typename std::tuple_element_t<97, ContainerOverSubrelations>::View;
701 auto tmp = static_cast<View>(in.get(C::sha256_last)) *
702 (CView(sha256_OUT_H) - (static_cast<View>(in.get(C::sha256_output_h_lhs)) * FF(4294967296UL) +
703 static_cast<View>(in.get(C::sha256_output_h_rhs))));
704 std::get<97>(evals) += (tmp * scaling_factor);
705 }
706}
707
708} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.