arnaucube
arnaucube/circomPublic Self-hosted repository
circom/circuits/sha256/main.circom
circuits/sha256/main.circomRaw
 1
 2/*
 3include "sha256_2.jaz";
 4
 5component main = SHA256_2();
 6*/
 7
 8/*
 9include "constants.jaz"
10
11template A() {
12    signal input in;
13    component h0;
14    h0 = K(8);
15
16    var lc = 0;
17    var e = 1;
18    for (var i=0; i<32; i++) {
19        lc = lc + e*h0.out[i];
20        e *= 2;
21    }
22
23    lc === in;
24}
25
26component main = A();
27*/
28
29include "bitify.jaz"
30
31template A() {
32    signal input in;
33    signal output out;
34
35    component n2b;
36    component b2n;
37
38    n2b = Num2Bits(216);
39    b2n = Bits2Num(216);
40
41    n2b.in <== in;
42
43    for (var i=0; i<216; i++) {
44        b2n.in[i] <== n2b.out[i];
45    }
46
47    out <== b2n.out;
48}
49
50component main = A();