pedersen2 adapted

This commit is contained in:
Jordi Baylina
2019-12-13 19:05:20 +01:00
parent 4117ebc64a
commit a8107abbe9
6 changed files with 22435 additions and 45 deletions

View File

@@ -31,18 +31,18 @@ function pedersenHash(msg) {
let acc = bigInt.one;
for (let b=0; ((b<windowSize-1)&&(o<bits.length)) ; b++) {
if (bits[o]) {
acc = acc.add( bigInt.one.shl(b) );
acc = acc.add( bigInt.one.shiftLeft(b) );
}
o++;
}
if (o<bits.length) {
if (bits[o]) {
acc = acc.neg();
acc = bigInt.zero.minus(acc);
}
o++;
}
escalar = escalar.add(acc.mul(exp));
exp = exp.shl(windowSize+1);
escalar = escalar.add(acc.times(exp));
exp = exp.shiftLeft(windowSize+1);
}
if (escalar.lesser(bigInt.zero)) {