arnaucube
arnaucube/circomPublic Self-hosted repository
circom/circuits/sha256/t1.circom
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*/
19
20include "../binsum.circom";
21include "sigma.circom";
22include "ch.circom";
23
24template T1() {
25    signal input h[32];
26    signal input e[32];
27    signal input f[32];
28    signal input g[32];
29    signal input k[32];
30    signal input w[32];
31    signal output out[32];
32
33    component sum = BinSum(32, 5);
34    component ch = Ch(32);
35
36    component bigsigma1 = BigSigma(6, 11, 25);
37
38    for (var ki=0; ki<32; ki++) {
39        bigsigma1.in[ki] <== e[ki];
40        ch.a[ki] <== e[ki];
41        ch.b[ki] <== f[ki];
42        ch.c[ki] <== g[ki]
43
44        sum.in[0][ki] <== h[ki];
45        sum.in[1][ki] <== bigsigma1.out[ki];
46        sum.in[2][ki] <== ch.out[ki];
47        sum.in[3][ki] <== k[ki];
48        sum.in[4][ki] <== w[ki];
49
50        out[ki] <== sum.out[ki];
51    }
52}