Poseidon for t=3

This commit is contained in:
Jordi Baylina
2020-02-25 05:41:51 -08:00
parent bdfb0fb928
commit 19bbada388
6 changed files with 81 additions and 25 deletions

View File

@@ -36,6 +36,8 @@ exports.getMatrix = (t, seed, nRounds) => {
if (typeof seed === "undefined") seed = SEED;
if (typeof nRounds === "undefined") nRounds = NROUNDSF + NROUNDSP;
if (typeof t === "undefined") t = T;
assert(t<=6); // Force the same matrix for all.
t=6;
let nonce = "0000";
let cmatrix = getPseudoRandom(seed+"_matrix_"+nonce, t*2);
while (!allDifferent(cmatrix)) {

View File

@@ -121,7 +121,7 @@ function createCode(t, nRoundsF, nRoundsP, seed) {
// We ignore the pointer and the length and just load 6 values to the state
// (Stack positions 0-5) If the array is shorter, we just set zeros.
for (let i=0; i<t; i++) {
C.push(0x44+(0x20*(5-i)));
C.push(0x44+(0x20*(t-1-i)));
C.calldataload();
}