From 29e162383df709c2902a7454ef074fc8844ea13d Mon Sep 17 00:00:00 2001 From: Jordi Baylina Date: Sat, 7 Sep 2019 20:22:44 +0200 Subject: [PATCH] Allow full poseidnon fix handle enable in the sigposeidon --- circuits/eddsaposeidon.circom | 4 ++-- index.js | 2 ++ src/poseidon.js | 2 +- src/smt.js | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/circuits/eddsaposeidon.circom b/circuits/eddsaposeidon.circom index 6674747..0d9faa0 100644 --- a/circuits/eddsaposeidon.circom +++ b/circuits/eddsaposeidon.circom @@ -47,7 +47,7 @@ template EdDSAPoseidonVerifier() { snum2bits.out[i] ==> compConstant.in[i]; } compConstant.in[253] <== 0; - compConstant.out === 0; + compConstant.out*enabled === 0; // Calculate the h = H(R,A, msg) @@ -79,7 +79,7 @@ template EdDSAPoseidonVerifier() { // We check that A is not zero. component isZero = IsZero(); isZero.in <== dbl3.x; - isZero.out === 0; + isZero.out*enabled === 0; component mulAny = EscalarMulAny(254); for (i=0; i<254; i++) { diff --git a/index.js b/index.js index 66861b6..aac370e 100644 --- a/index.js +++ b/index.js @@ -4,3 +4,5 @@ exports.mimc7 = require("./src/mimc7"); exports.mimcsponge = require("./src/mimcsponge"); exports.babyJub = require("./src/babyjub"); exports.pedersenHash = require("./src/pedersenHash"); +exports.SMT = require("./src/smt"); +exports.poseidon = require("./src/poseidon"); diff --git a/src/poseidon.js b/src/poseidon.js index 0533154..71fee67 100644 --- a/src/poseidon.js +++ b/src/poseidon.js @@ -95,7 +95,7 @@ exports.createHash = (t, nRoundsF, nRoundsP, seed) => { const M = exports.getMatrix(t, seed, nRoundsF + nRoundsP); return function(inputs) { let state = []; - assert(inputs.length < t); + assert(inputs.length <= t); assert(inputs.length > 0); for (let i=0; i