arnaucube
arnaucube/circomPublic Self-hosted repository
circom/circuits/sha256/sigmaplus.circom
circuits/sha256/sigmaplus.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"
22
23template SigmaPlus() {
24    signal input in2[32];
25    signal input in7[32];
26    signal input in15[32];
27    signal input in16[32];
28    signal output out[32];
29
30    component sum = BinSum(32, 4);
31    component sigma1 = SmallSigma(17,19,10);
32    component sigma0 = SmallSigma(7, 18, 3);
33
34    for (var k=0; k<32; k++) {
35        sigma1.in[k] <== in2[k];
36        sigma0.in[k] <== in15[k];
37
38        sum.in[0][k] <== sigma1.out[k];
39        sum.in[1][k] <== in7[k];
40        sum.in[2][k] <== sigma0.out[k];
41        sum.in[3][k] <== in16[k];
42
43        out[k] <== sum.out[k];
44    }
45}