arnaucube
arnaucube/circomPublic Self-hosted repository
circom/circuits/sha256/sigma.circom
circuits/sha256/sigma.circomRaw
 1include "xor3.circom";
 2include "rotate.circom";
 3
 4template Sigma(ra, rb, rc) {
 5    signal input in[32];
 6    signal output out;
 7
 8    component xor3 = Xor3(32);
 9
10    component rota = RotR(32, ra);
11    component rotb = RotR(32, rb);
12    component rotc = RotR(32, rc);
13
14    for (var k=0; k<32; k++) {
15        rota.in[k] <== in[k];
16        rotb.in[k] <== in[k];
17        rotc.in[k] <== in[k];
18
19        xor3.a[k] <== rota.out[k];
20        xor3.b[k] <== rotb.out[k];
21        xor3.c[k] <== rotc.out[k];
22
23        out[k] <== xor3.out[k];
24    }
25}