mirror of
https://github.com/arnaucube/circomlib.git
synced 2026-02-06 18:56:43 +01:00
first commit
This commit is contained in:
3
test/circuits/babyadd_tester.circom
Normal file
3
test/circuits/babyadd_tester.circom
Normal file
@@ -0,0 +1,3 @@
|
||||
include "../../circuit/babyjub.circom";
|
||||
|
||||
component main = BabyAdd();
|
||||
24
test/circuits/exp_test.circom
Normal file
24
test/circuits/exp_test.circom
Normal file
@@ -0,0 +1,24 @@
|
||||
include "../../circuit/exp.circom";
|
||||
include "../../node_modules/circom/circuits/sha256/bitify.circom";
|
||||
|
||||
|
||||
template Main() {
|
||||
signal input in;
|
||||
signal output out[2];
|
||||
|
||||
component n2b = Num2Bits(253);
|
||||
component exp = Exp(253);
|
||||
|
||||
var i;
|
||||
|
||||
in ==> n2b.in;
|
||||
|
||||
for (i=0; i<253; i++) {
|
||||
n2b.out[i] ==> exp.in[i];
|
||||
}
|
||||
|
||||
exp.out[0] ==> out[0];
|
||||
exp.out[1] ==> out[1];
|
||||
}
|
||||
|
||||
component main = Main();
|
||||
20
test/circuits/exp_test_min.circom
Normal file
20
test/circuits/exp_test_min.circom
Normal file
@@ -0,0 +1,20 @@
|
||||
include "../../circuit/exp.circom";
|
||||
|
||||
|
||||
template Main() {
|
||||
signal input in[256];
|
||||
signal output out[2];
|
||||
|
||||
var i;
|
||||
|
||||
component exp = Exp(256);
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
in[i] ==> exp.in[i];
|
||||
}
|
||||
|
||||
exp.out[0] ==> out[0];
|
||||
exp.out[1] ==> out[1];
|
||||
}
|
||||
|
||||
component main = Main();
|
||||
3
test/circuits/expw4table_test.circom
Normal file
3
test/circuits/expw4table_test.circom
Normal file
@@ -0,0 +1,3 @@
|
||||
include "../../circuit/ExpW4Table.circom";
|
||||
|
||||
component main = ExpW4Table(0);
|
||||
3
test/circuits/expw4table_test3.circom
Normal file
3
test/circuits/expw4table_test3.circom
Normal file
@@ -0,0 +1,3 @@
|
||||
include "../../circuit/ExpW4Table.circom";
|
||||
|
||||
component main = ExpW4Table(3);
|
||||
54
test/circuits/mux4_1.circom
Normal file
54
test/circuits/mux4_1.circom
Normal file
@@ -0,0 +1,54 @@
|
||||
include "../../circuit/mux4.circom";
|
||||
include "../../node_modules/circom/circuits/sha256/bitify.circom";
|
||||
|
||||
|
||||
template Constants() {
|
||||
var i;
|
||||
signal output out[16];
|
||||
|
||||
out[0] <== 123;
|
||||
out[1] <== 456;
|
||||
out[2] <== 789;
|
||||
out[3] <== 012;
|
||||
out[4] <== 111;
|
||||
out[5] <== 222;
|
||||
out[6] <== 333;
|
||||
out[7] <== 4546;
|
||||
out[8] <== 134523;
|
||||
out[9] <== 44356;
|
||||
out[10] <== 15623;
|
||||
out[11] <== 4566;
|
||||
out[12] <== 1223;
|
||||
out[13] <== 4546;
|
||||
out[14] <== 4256;
|
||||
out[15] <== 4456;
|
||||
|
||||
/*
|
||||
for (i=0;i<16; i++) {
|
||||
out[i] <== i*2+100;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
template Main() {
|
||||
var i;
|
||||
signal private input selector;
|
||||
signal output out;
|
||||
|
||||
component mux = Mux4();
|
||||
component n2b = Num2Bits(4);
|
||||
component cst = Constants();
|
||||
|
||||
selector ==> n2b.in;
|
||||
for (i=0; i<4; i++) {
|
||||
n2b.out[i] ==> mux.s[i];
|
||||
}
|
||||
for (i=0; i<16; i++) {
|
||||
cst.out[i] ==> mux.c[i];
|
||||
}
|
||||
|
||||
mux.out ==> out;
|
||||
}
|
||||
|
||||
component main = Main();
|
||||
Reference in New Issue
Block a user