starkshield 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +101 -0
  2. package/bin/circom +0 -0
  3. package/bin/cli.js +36 -0
  4. package/bin/index.js +13 -0
  5. package/circomlib/.vscode/launch.json +63 -0
  6. package/circomlib/README.md +18 -0
  7. package/circomlib/circuits/README.md +830 -0
  8. package/circomlib/circuits/aliascheck.circom +33 -0
  9. package/circomlib/circuits/babyjub.circom +107 -0
  10. package/circomlib/circuits/binsub.circom +74 -0
  11. package/circomlib/circuits/binsum.circom +101 -0
  12. package/circomlib/circuits/bitify.circom +106 -0
  13. package/circomlib/circuits/comparators.circom +141 -0
  14. package/circomlib/circuits/compconstant.circom +74 -0
  15. package/circomlib/circuits/eddsa.circom +139 -0
  16. package/circomlib/circuits/eddsamimc.circom +124 -0
  17. package/circomlib/circuits/eddsamimcsponge.circom +124 -0
  18. package/circomlib/circuits/eddsaposeidon.circom +123 -0
  19. package/circomlib/circuits/escalarmul.circom +166 -0
  20. package/circomlib/circuits/escalarmulany.circom +197 -0
  21. package/circomlib/circuits/escalarmulfix.circom +299 -0
  22. package/circomlib/circuits/escalarmulw4table.circom +52 -0
  23. package/circomlib/circuits/gates.circom +96 -0
  24. package/circomlib/circuits/mimc.circom +156 -0
  25. package/circomlib/circuits/mimcsponge.circom +293 -0
  26. package/circomlib/circuits/montgomery.circom +142 -0
  27. package/circomlib/circuits/multiplexer.circom +115 -0
  28. package/circomlib/circuits/mux1.circom +48 -0
  29. package/circomlib/circuits/mux2.circom +63 -0
  30. package/circomlib/circuits/mux3.circom +75 -0
  31. package/circomlib/circuits/mux4.circom +119 -0
  32. package/circomlib/circuits/pedersen.circom +257 -0
  33. package/circomlib/circuits/pedersen_old.circom +68 -0
  34. package/circomlib/circuits/pointbits.circom +164 -0
  35. package/circomlib/circuits/poseidon.circom +208 -0
  36. package/circomlib/circuits/poseidon_constants.circom +24959 -0
  37. package/circomlib/circuits/poseidon_constants_old.circom +252 -0
  38. package/circomlib/circuits/poseidon_old.circom +97 -0
  39. package/circomlib/circuits/sha256/ch.circom +47 -0
  40. package/circomlib/circuits/sha256/constants.circom +53 -0
  41. package/circomlib/circuits/sha256/main.circom +35 -0
  42. package/circomlib/circuits/sha256/maj.circom +45 -0
  43. package/circomlib/circuits/sha256/rotate.circom +28 -0
  44. package/circomlib/circuits/sha256/sha256.circom +81 -0
  45. package/circomlib/circuits/sha256/sha256_2.circom +91 -0
  46. package/circomlib/circuits/sha256/sha256compression.circom +166 -0
  47. package/circomlib/circuits/sha256/sha256compression_function.circom +112 -0
  48. package/circomlib/circuits/sha256/shift.circom +33 -0
  49. package/circomlib/circuits/sha256/sigma.circom +77 -0
  50. package/circomlib/circuits/sha256/sigmaplus.circom +50 -0
  51. package/circomlib/circuits/sha256/t1.circom +58 -0
  52. package/circomlib/circuits/sha256/t2.circom +51 -0
  53. package/circomlib/circuits/sha256/xor3.circom +45 -0
  54. package/circomlib/circuits/sign.circom +36 -0
  55. package/circomlib/circuits/smt/smthash_mimc.circom +58 -0
  56. package/circomlib/circuits/smt/smthash_poseidon.circom +57 -0
  57. package/circomlib/circuits/smt/smtlevins.circom +103 -0
  58. package/circomlib/circuits/smt/smtprocessor.circom +261 -0
  59. package/circomlib/circuits/smt/smtprocessorlevel.circom +95 -0
  60. package/circomlib/circuits/smt/smtprocessorsm.circom +165 -0
  61. package/circomlib/circuits/smt/smtverifier.circom +138 -0
  62. package/circomlib/circuits/smt/smtverifierlevel.circom +71 -0
  63. package/circomlib/circuits/smt/smtverifiersm.circom +106 -0
  64. package/circomlib/circuits/switcher.circom +42 -0
  65. package/circomlib/doc/root_transfer.monopic +0 -0
  66. package/circomlib/doc/smt_diagram_0.monopic +0 -0
  67. package/circomlib/doc/smt_diagram_1.monopic +0 -0
  68. package/circomlib/doc/smt_hash.monopic +0 -0
  69. package/circomlib/doc/smt_levins.monopic +0 -0
  70. package/circomlib/doc/smt_sm.monopic +0 -0
  71. package/circomlib/doc/smt_verifier_sm.monopic +0 -0
  72. package/circomlib/doc/voting.monopic +0 -0
  73. package/circomlib/doc/window.monopic +0 -0
  74. package/circomlib/doc/window_chain.monopic +0 -0
  75. package/circomlib/index.js +2 -0
  76. package/circomlib/package.json +33 -0
  77. package/circomlib/test/aliascheck.js +77 -0
  78. package/circomlib/test/babyjub.js +118 -0
  79. package/circomlib/test/binsub.js +52 -0
  80. package/circomlib/test/binsum.js +38 -0
  81. package/circomlib/test/circuits/aliascheck_test.circom +4 -0
  82. package/circomlib/test/circuits/babyadd_tester.circom +4 -0
  83. package/circomlib/test/circuits/babycheck_test.circom +4 -0
  84. package/circomlib/test/circuits/babypbk_test.circom +4 -0
  85. package/circomlib/test/circuits/binsub_test.circom +33 -0
  86. package/circomlib/test/circuits/constants_test.circom +20 -0
  87. package/circomlib/test/circuits/eddsa_test.circom +5 -0
  88. package/circomlib/test/circuits/eddsamimc_test.circom +5 -0
  89. package/circomlib/test/circuits/eddsaposeidon_test.circom +5 -0
  90. package/circomlib/test/circuits/edwards2montgomery.circom +5 -0
  91. package/circomlib/test/circuits/escalarmul_min_test.circom +27 -0
  92. package/circomlib/test/circuits/escalarmul_test.circom +33 -0
  93. package/circomlib/test/circuits/escalarmul_test_min.circom +28 -0
  94. package/circomlib/test/circuits/escalarmulany_test.circom +30 -0
  95. package/circomlib/test/circuits/escalarmulfix_test.circom +31 -0
  96. package/circomlib/test/circuits/escalarmulw4table.circom +20 -0
  97. package/circomlib/test/circuits/escalarmulw4table_test.circom +19 -0
  98. package/circomlib/test/circuits/escalarmulw4table_test3.circom +19 -0
  99. package/circomlib/test/circuits/greatereqthan.circom +5 -0
  100. package/circomlib/test/circuits/greaterthan.circom +5 -0
  101. package/circomlib/test/circuits/isequal.circom +5 -0
  102. package/circomlib/test/circuits/iszero.circom +5 -0
  103. package/circomlib/test/circuits/lesseqthan.circom +5 -0
  104. package/circomlib/test/circuits/lessthan.circom +5 -0
  105. package/circomlib/test/circuits/mimc_sponge_hash_test.circom +5 -0
  106. package/circomlib/test/circuits/mimc_sponge_test.circom +5 -0
  107. package/circomlib/test/circuits/mimc_test.circom +5 -0
  108. package/circomlib/test/circuits/montgomery2edwards.circom +5 -0
  109. package/circomlib/test/circuits/montgomeryadd.circom +5 -0
  110. package/circomlib/test/circuits/montgomerydouble.circom +5 -0
  111. package/circomlib/test/circuits/mux1_1.circom +33 -0
  112. package/circomlib/test/circuits/mux2_1.circom +37 -0
  113. package/circomlib/test/circuits/mux3_1.circom +41 -0
  114. package/circomlib/test/circuits/mux4_1.circom +56 -0
  115. package/circomlib/test/circuits/pedersen2_test.circom +34 -0
  116. package/circomlib/test/circuits/pedersen_test.circom +31 -0
  117. package/circomlib/test/circuits/pointbits_loopback.circom +25 -0
  118. package/circomlib/test/circuits/poseidon3_test.circom +5 -0
  119. package/circomlib/test/circuits/poseidon6_test.circom +5 -0
  120. package/circomlib/test/circuits/poseidonex_test.circom +5 -0
  121. package/circomlib/test/circuits/sha256_2_test.circom +17 -0
  122. package/circomlib/test/circuits/sha256_test448.circom +5 -0
  123. package/circomlib/test/circuits/sha256_test512.circom +5 -0
  124. package/circomlib/test/circuits/sign_test.circom +5 -0
  125. package/circomlib/test/circuits/smtprocessor10_test.circom +5 -0
  126. package/circomlib/test/circuits/smtverifier10_test.circom +5 -0
  127. package/circomlib/test/circuits/sum_test.circom +33 -0
  128. package/circomlib/test/comparators.js +187 -0
  129. package/circomlib/test/eddsa.js +75 -0
  130. package/circomlib/test/eddsamimc.js +102 -0
  131. package/circomlib/test/eddsaposeidon.js +103 -0
  132. package/circomlib/test/escalarmul.js +121 -0
  133. package/circomlib/test/escalarmulany.js +51 -0
  134. package/circomlib/test/escalarmulfix.js +95 -0
  135. package/circomlib/test/helpers/printsignal.js +22 -0
  136. package/circomlib/test/helpers/sha256.js +178 -0
  137. package/circomlib/test/mimccircuit.js +27 -0
  138. package/circomlib/test/mimcspongecircuit.js +47 -0
  139. package/circomlib/test/montgomery.js +101 -0
  140. package/circomlib/test/multiplexer.js +101 -0
  141. package/circomlib/test/pedersen.js +83 -0
  142. package/circomlib/test/pedersen2.js +56 -0
  143. package/circomlib/test/point2bits.js +30 -0
  144. package/circomlib/test/poseidoncircuit.js +80 -0
  145. package/circomlib/test/sha256.js +118 -0
  146. package/circomlib/test/sign.js +82 -0
  147. package/circomlib/test/smtprocessor.js +219 -0
  148. package/circomlib/test/smtverifier.js +141 -0
  149. package/lib/compile.js +82 -0
  150. package/lib/deploy.js +391 -0
  151. package/lib/test.js +47 -0
  152. package/lib/verify.js +153 -0
  153. package/package.json +43 -0
  154. package/pot12_0000.ptau +0 -0
  155. package/pot12_0001.ptau +0 -0
  156. package/ptau/pot12_final.ptau +0 -0
@@ -0,0 +1,27 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmul.circom";
4
+
5
+
6
+ template Main() {
7
+ signal input in[256];
8
+ signal output out[2];
9
+
10
+ var i;
11
+
12
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203];
13
+
14
+ component escalarMul = EscalarMul(256, base);
15
+
16
+ escalarMul.inp[0] <== 0;
17
+ escalarMul.inp[1] <== 1;
18
+
19
+ for (i=0; i<256; i++) {
20
+ in[i] ==> escalarMul.in[i];
21
+ }
22
+
23
+ escalarMul.out[0] ==> out[0];
24
+ escalarMul.out[1] ==> out[1];
25
+ }
26
+
27
+ component main = Main();
@@ -0,0 +1,33 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmul.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Main() {
8
+ signal input in;
9
+ signal output out[2];
10
+
11
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553,
12
+ 16950150798460657717958625567821834550301663161624707787222815936182638968203];
13
+
14
+
15
+ component n2b = Num2Bits(253);
16
+ component escalarMul = EscalarMul(253, base);
17
+
18
+ escalarMul.inp[0] <== 0;
19
+ escalarMul.inp[1] <== 1;
20
+
21
+ var i;
22
+
23
+ in ==> n2b.in;
24
+
25
+ for (i=0; i<253; i++) {
26
+ n2b.out[i] ==> escalarMul.in[i];
27
+ }
28
+
29
+ escalarMul.out[0] ==> out[0];
30
+ escalarMul.out[1] ==> out[1];
31
+ }
32
+
33
+ component main = Main();
@@ -0,0 +1,28 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmul.circom";
4
+
5
+
6
+ template Main() {
7
+ signal input in[256];
8
+ signal output out[2];
9
+
10
+ var i;
11
+
12
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553,
13
+ 16950150798460657717958625567821834550301663161624707787222815936182638968203];
14
+
15
+ component escalarMul = EscalarMul(256, base);
16
+
17
+ escalarMul.inp[0] <== 0;
18
+ escalarMul.inp[1] <== 1;
19
+
20
+ for (i=0; i<256; i++) {
21
+ in[i] ==> escalarMul.in[i];
22
+ }
23
+
24
+ escalarMul.out[0] ==> out[0];
25
+ escalarMul.out[1] ==> out[1];
26
+ }
27
+
28
+ component main = Main();
@@ -0,0 +1,30 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmulany.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+ template Main() {
7
+ signal input e;
8
+ signal input p[2];
9
+ signal output out[2];
10
+
11
+ component n2b = Num2Bits(253);
12
+ component escalarMulAny = EscalarMulAny(253);
13
+
14
+ escalarMulAny.p[0] <== p[0];
15
+ escalarMulAny.p[1] <== p[1];
16
+
17
+ var i;
18
+
19
+ e ==> n2b.in;
20
+
21
+ for (i=0; i<253; i++) {
22
+ n2b.out[i] ==> escalarMulAny.e[i];
23
+ }
24
+
25
+ escalarMulAny.out[0] ==> out[0];
26
+ escalarMulAny.out[1] ==> out[1];
27
+ }
28
+
29
+ component main = Main();
30
+
@@ -0,0 +1,31 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmulfix.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Main() {
8
+ signal input e;
9
+ signal output out[2];
10
+
11
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553,
12
+ 16950150798460657717958625567821834550301663161624707787222815936182638968203];
13
+
14
+
15
+ component n2b = Num2Bits(253);
16
+ component escalarMul = EscalarMulFix(253, base);
17
+
18
+ var i;
19
+
20
+ e ==> n2b.in;
21
+
22
+ for (i=0; i<253; i++) {
23
+ n2b.out[i] ==> escalarMul.e[i];
24
+ }
25
+
26
+ escalarMul.out[0] ==> out[0];
27
+ escalarMul.out[1] ==> out[1];
28
+ }
29
+
30
+ component main = Main();
31
+
@@ -0,0 +1,20 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmulw4table.circom";
4
+
5
+
6
+
7
+
8
+ template Main() {
9
+ signal output out[16][2];
10
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553,
11
+ 16950150798460657717958625567821834550301663161624707787222815936182638968203];
12
+
13
+ var escalarMul[16][2] = EscalarMulW4Table(base, 0);
14
+ for (var i=0; i<16; i++) {
15
+ out[i][0] <== escalarMul[i][0];
16
+ out[i][1] <== escalarMul[i][1];
17
+ }
18
+ }
19
+
20
+ component main = Main();
@@ -0,0 +1,19 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmulw4table.circom";
4
+
5
+
6
+ template Main() {
7
+ signal input in;
8
+ signal output out[16][2];
9
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553,
10
+ 16950150798460657717958625567821834550301663161624707787222815936182638968203];
11
+
12
+ var escalarMul[16][2] = EscalarMulW4Table(base, 0);
13
+ for (var i=0; i<16; i++) {
14
+ out[i][0] <== escalarMul[i][0]*in;
15
+ out[i][1] <== escalarMul[i][1]*in;
16
+ }
17
+ }
18
+
19
+ component main = Main();
@@ -0,0 +1,19 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/escalarmulw4table.circom";
4
+
5
+
6
+ template Main() {
7
+ signal input in;
8
+ signal output out[16][2];
9
+ var base[2] = [5299619240641551281634865583518297030282874472190772894086521144482721001553,
10
+ 16950150798460657717958625567821834550301663161624707787222815936182638968203];
11
+
12
+ var escalarMul[16][2] = EscalarMulW4Table(base, 3);
13
+ for (var i=0; i<16; i++) {
14
+ out[i][0] <== escalarMul[i][0]*in;
15
+ out[i][1] <== escalarMul[i][1]*in;
16
+ }
17
+ }
18
+
19
+ component main = Main();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/comparators.circom";
4
+
5
+ component main = GreaterEqThan(32);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/comparators.circom";
4
+
5
+ component main = GreaterThan(32);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/comparators.circom";
4
+
5
+ component main = IsEqual();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/comparators.circom";
4
+
5
+ component main = IsZero();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/comparators.circom";
4
+
5
+ component main = LessEqThan(32);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/comparators.circom";
4
+
5
+ component main = LessThan(32);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mimcsponge.circom";
4
+
5
+ component main = MiMCSponge(2, 220, 3);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mimcsponge.circom";
4
+
5
+ component main = MiMCFeistel(220);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mimc.circom";
4
+
5
+ component main = MiMC7(91);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/montgomery.circom";
4
+
5
+ component main = Montgomery2Edwards();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/montgomery.circom";
4
+
5
+ component main = MontgomeryAdd();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/montgomery.circom";
4
+
5
+ component main = MontgomeryDouble();
@@ -0,0 +1,33 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mux1.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Constants() {
8
+ var i;
9
+ signal output out[2];
10
+
11
+ out[0] <== 37;
12
+ out[1] <== 47;
13
+ }
14
+
15
+ template Main() {
16
+ var i;
17
+ signal input selector;//private
18
+ signal output out;
19
+
20
+ component mux = Mux1();
21
+ component n2b = Num2Bits(1);
22
+ component cst = Constants();
23
+
24
+ selector ==> n2b.in;
25
+ n2b.out[0] ==> mux.s;
26
+ for (i=0; i<2; i++) {
27
+ cst.out[i] ==> mux.c[i];
28
+ }
29
+
30
+ mux.out ==> out;
31
+ }
32
+
33
+ component main = Main();
@@ -0,0 +1,37 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mux2.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Constants() {
8
+ var i;
9
+ signal output out[4];
10
+
11
+ out[0] <== 37;
12
+ out[1] <== 47;
13
+ out[2] <== 53;
14
+ out[3] <== 71;
15
+ }
16
+
17
+ template Main() {
18
+ var i;
19
+ signal input selector;//private
20
+ signal output out;
21
+
22
+ component mux = Mux2();
23
+ component n2b = Num2Bits(2);
24
+ component cst = Constants();
25
+
26
+ selector ==> n2b.in;
27
+ for (i=0; i<2; i++) {
28
+ n2b.out[i] ==> mux.s[i];
29
+ }
30
+ for (i=0; i<4; i++) {
31
+ cst.out[i] ==> mux.c[i];
32
+ }
33
+
34
+ mux.out ==> out;
35
+ }
36
+
37
+ component main = Main();
@@ -0,0 +1,41 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mux3.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Constants() {
8
+ var i;
9
+ signal output out[8];
10
+
11
+ out[0] <== 37;
12
+ out[1] <== 47;
13
+ out[2] <== 53;
14
+ out[3] <== 71;
15
+ out[4] <== 89;
16
+ out[5] <== 107;
17
+ out[6] <== 163;
18
+ out[7] <== 191;
19
+ }
20
+
21
+ template Main() {
22
+ var i;
23
+ signal input selector;//private
24
+ signal output out;
25
+
26
+ component mux = Mux3();
27
+ component n2b = Num2Bits(3);
28
+ component cst = Constants();
29
+
30
+ selector ==> n2b.in;
31
+ for (i=0; i<3; i++) {
32
+ n2b.out[i] ==> mux.s[i];
33
+ }
34
+ for (i=0; i<8; i++) {
35
+ cst.out[i] ==> mux.c[i];
36
+ }
37
+
38
+ mux.out ==> out;
39
+ }
40
+
41
+ component main = Main();
@@ -0,0 +1,56 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/mux4.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Constants() {
8
+ var i;
9
+ signal output out[16];
10
+
11
+ out[0] <== 123;
12
+ out[1] <== 456;
13
+ out[2] <== 789;
14
+ out[3] <== 012;
15
+ out[4] <== 111;
16
+ out[5] <== 222;
17
+ out[6] <== 333;
18
+ out[7] <== 4546;
19
+ out[8] <== 134523;
20
+ out[9] <== 44356;
21
+ out[10] <== 15623;
22
+ out[11] <== 4566;
23
+ out[12] <== 1223;
24
+ out[13] <== 4546;
25
+ out[14] <== 4256;
26
+ out[15] <== 4456;
27
+
28
+ /*
29
+ for (i=0;i<16; i++) {
30
+ out[i] <== i*2+100;
31
+ }
32
+ */
33
+
34
+ }
35
+
36
+ template Main() {
37
+ var i;
38
+ signal input selector;//private
39
+ signal output out;
40
+
41
+ component mux = Mux4();
42
+ component n2b = Num2Bits(4);
43
+ component cst = Constants();
44
+
45
+ selector ==> n2b.in;
46
+ for (i=0; i<4; i++) {
47
+ n2b.out[i] ==> mux.s[i];
48
+ }
49
+ for (i=0; i<16; i++) {
50
+ cst.out[i] ==> mux.c[i];
51
+ }
52
+
53
+ mux.out ==> out;
54
+ }
55
+
56
+ component main = Main();
@@ -0,0 +1,34 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/pedersen.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Main() {
8
+ signal input in;
9
+ signal output out[2];
10
+
11
+ component pedersen = Pedersen(256);
12
+
13
+ component n2b;
14
+ n2b = Num2Bits(253);
15
+
16
+ var i;
17
+
18
+ in ==> n2b.in;
19
+
20
+ for (i=0; i<253; i++) {
21
+ pedersen.in[i] <== n2b.out[i];
22
+ }
23
+
24
+ for (i=253; i<256; i++) {
25
+ pedersen.in[i] <== 0;
26
+ }
27
+
28
+ pedersen.out[0] ==> out[0];
29
+ pedersen.out[1] ==> out[1];
30
+ }
31
+
32
+ component main = Main();
33
+
34
+
@@ -0,0 +1,31 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/pedersen_old.circom";
4
+ include "../../circuits/bitify.circom";
5
+
6
+
7
+ template Main() {
8
+ signal input in[2];
9
+ signal output out[2];
10
+
11
+ component pedersen = Pedersen(250*2);
12
+
13
+ component n2b[2];
14
+ n2b[0] = Num2Bits(250);
15
+ n2b[1] = Num2Bits(250);
16
+
17
+ var i;
18
+
19
+ in[0] ==> n2b[0].in;
20
+ in[1] ==> n2b[1].in;
21
+
22
+ for (i=0; i<250; i++) {
23
+ n2b[0].out[i] ==> pedersen.in[i];
24
+ n2b[1].out[i] ==> pedersen.in[250+i];
25
+ }
26
+
27
+ pedersen.out[0] ==> out[0];
28
+ pedersen.out[1] ==> out[1];
29
+ }
30
+
31
+ component main = Main();
@@ -0,0 +1,25 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/pointbits.circom";
4
+
5
+
6
+ template Main() {
7
+ signal input in[2];
8
+
9
+ var i;
10
+
11
+ component p2b = Point2Bits_Strict();
12
+ component b2p = Bits2Point_Strict();
13
+
14
+ p2b.in[0] <== in[0];
15
+ p2b.in[1] <== in[1];
16
+
17
+ for (i=0; i<256; i++) {
18
+ b2p.in[i] <== p2b.out[i];
19
+ }
20
+
21
+ b2p.out[0] === in[0];
22
+ b2p.out[1] === in[1];
23
+ }
24
+
25
+ component main = Main();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/poseidon.circom";
4
+
5
+ component main = Poseidon(2);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/poseidon.circom";
4
+
5
+ component main = Poseidon(5);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/poseidon.circom";
4
+
5
+ component main = PoseidonEx(16, 17);
@@ -0,0 +1,17 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/sha256/sha256_2.circom";
4
+
5
+ template Main() {
6
+ signal input a; //private
7
+ signal input b; //private
8
+ signal output out;
9
+
10
+ component sha256_2 = Sha256_2();
11
+
12
+ sha256_2.a <== a;
13
+ sha256_2.b <== b;
14
+ out <== sha256_2.out;
15
+ }
16
+
17
+ component main = Main();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/sha256/sha256.circom";
4
+
5
+ component main = Sha256(448);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/sha256/sha256.circom";
4
+
5
+ component main = Sha256(512);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/sign.circom";
4
+
5
+ component main = Sign();
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/smt/smtprocessor.circom";
4
+
5
+ component main = SMTProcessor(10);
@@ -0,0 +1,5 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/smt/smtverifier.circom";
4
+
5
+ component main = SMTVerifier(10);
@@ -0,0 +1,33 @@
1
+ pragma circom 2.0.0;
2
+
3
+ include "../../circuits/bitify.circom";
4
+ include "../../circuits/binsum.circom";
5
+
6
+ template A() {
7
+ signal input a; //private
8
+ signal input b;
9
+ signal output out;
10
+
11
+ var i;
12
+
13
+ component n2ba = Num2Bits(32);
14
+ component n2bb = Num2Bits(32);
15
+ component sum = BinSum(32,2);
16
+ component b2n = Bits2Num(32);
17
+
18
+ n2ba.in <== a;
19
+ n2bb.in <== b;
20
+
21
+ for (i=0; i<32; i++) {
22
+ sum.in[0][i] <== n2ba.out[i];
23
+ sum.in[1][i] <== n2bb.out[i];
24
+ }
25
+
26
+ for (i=0; i<32; i++) {
27
+ b2n.in[i] <== sum.out[i];
28
+ }
29
+
30
+ out <== b2n.out;
31
+ }
32
+
33
+ component main = A();