Skip to content

Commit

Permalink
Fix circuit Zero linearhashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaylina committed Sep 7, 2022
1 parent 401b3fb commit 62d7a25
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions circuits.bn128/linearhash.circom
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ template LinearHash(nInputs, eSize) {
nHashes = (nElements256 - 1)\16 +1;
}

component hash[nHashes-1];
var nLastHash = nElements256 - (nHashes - 1)*16;
component lastHash = PoseidonEx(nLastHash, 1);
component hash[nHashes>0 ? nHashes-1 : 0];
var nLastHash;
component lastHash;


for (var i=0; i<nHashes-1; i++) {
hash[i] = PoseidonEx(16, 1);
}

if (nHashes>0) {
nLastHash = nElements256 - (nHashes - 1)*16;
lastHash = PoseidonEx(nLastHash, 1);
}

var curHash =0;
var curHashIdx = 0;

Expand Down

0 comments on commit 62d7a25

Please sign in to comment.