arnaucube
arnaucube/grapevine-sonobePublic Self-hosted repository
grapevine-sonobe/circom/node_modules/circomlib/circuits/sha256/t2.circom
circom/node_modules/circomlib/circuits/sha256/t2.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 "maj.circom";
24
25template T2() {
26    signal input a[32];
27    signal input b[32];
28    signal input c[32];
29    signal output out[32];
30    var k;
31
32    component bigsigma0 = BigSigma(2, 13, 22);
33    component maj = Maj_t(32);
34    for (k=0; k<32; k++) {
35        bigsigma0.in[k] <== a[k];
36        maj.a[k] <== a[k];
37        maj.b[k] <== b[k];
38        maj.c[k] <== c[k];
39    }
40
41    component sum = BinSum(32, 2);
42
43    for (k=0; k<32; k++) {
44        sum.in[0][k] <== bigsigma0.out[k];
45        sum.in[1][k] <== maj.out[k];
46    }
47
48    for (k=0; k<32; k++) {
49        out[k] <== sum.out[k];
50    }
51}