grapevine-sonobe/circom/node_modules/circomlib/circuits/sha256/t1.circom
circom/node_modules/circomlib/circuits/sha256/t1.circomRaw
1/*
2 Copyright 2018 0KIMS association.
3
4 This file is part of circom (Zero Knowledge Circuit Compiler).
5
6 circom is a free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 circom is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with circom. If not, see <https://www.gnu.org/licenses/>.
18*/
19pragma circom 2.0.0;
20
21include "../binsum.circom";
22include "sigma.circom";
23include "ch.circom";
24
25template T1() {
26 signal input h[32];
27 signal input e[32];
28 signal input f[32];
29 signal input g[32];
30 signal input k[32];
31 signal input w[32];
32 signal output out[32];
33
34 var ki;
35
36 component ch = Ch_t(32);
37 component bigsigma1 = BigSigma(6, 11, 25);
38
39 for (ki=0; ki<32; ki++) {
40 bigsigma1.in[ki] <== e[ki];
41 ch.a[ki] <== e[ki];
42 ch.b[ki] <== f[ki];
43 ch.c[ki] <== g[ki];
44 }
45
46 component sum = BinSum(32, 5);
47 for (ki=0; ki<32; ki++) {
48 sum.in[0][ki] <== h[ki];
49 sum.in[1][ki] <== bigsigma1.out[ki];
50 sum.in[2][ki] <== ch.out[ki];
51 sum.in[3][ki] <== k[ki];
52 sum.in[4][ki] <== w[ki];
53 }
54
55 for (ki=0; ki<32; ki++) {
56 out[ki] <== sum.out[ki];
57 }
58}