Pedersen Hash done with tests

This commit is contained in:
Jordi Baylina
2018-11-13 10:57:54 +01:00
parent 9513ee2ff2
commit 4b147eca7f
9 changed files with 244497 additions and 208 deletions

122243
test/circuits/circuit.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,24 +0,0 @@
include "../../circuit/escalarmul.circom";
include "../../node_modules/circom/circuits/sha256/bitify.circom";
template Main() {
signal input in;
signal output out[2];
component n2b = Num2Bits(253);
component escalarMul = EscalarMul(253);
var i;
in ==> n2b.in;
for (i=0; i<253; i++) {
n2b.out[i] ==> escalarMul.in[i];
}
escalarMul.out[0] ==> out[0];
escalarMul.out[1] ==> out[1];
}
component main = Main();

View File

@@ -1,20 +0,0 @@
include "../../circuit/escalarmul.circom";
template Main() {
signal input in[256];
signal output out[2];
var i;
component escalarMul = EscalarMul(256);
for (i=0; i<256; i++) {
in[i] ==> escalarMul.in[i];
}
escalarMul.out[0] ==> out[0];
escalarMul.out[1] ==> out[1];
}
component main = Main();

View File

@@ -0,0 +1,29 @@
include "../../circuit/pedersen.circom";
include "../../node_modules/circom/circuits/bitify.circom";
template Main() {
signal input in[2];
signal output out[2];
component pedersen = Pedersen(253*2);
component n2b[2];
n2b[0] = Num2Bits(253);
n2b[1] = Num2Bits(253);
var i;
in[0] ==> n2b[0].in;
in[1] ==> n2b[1].in;
for (i=0; i<253; i++) {
n2b[0].out[i] ==> pedersen.in[i];
n2b[1].out[i] ==> pedersen.in[253+i];
}
pedersen.out[0] ==> out[0];
pedersen.out[1] ==> out[1];
}
component main = Main();