Browse Source

Fixed modPow leemon

Fixed key generation on BB. Closes #393
master
Igor Zhukov 10 years ago
parent
commit
984a0d9e78
  1. 8
      app/js/lib/bin_utils.js

8
app/js/lib/bin_utils.js

@ -561,13 +561,15 @@ function pqPrimeLeemon (what) { @@ -561,13 +561,15 @@ function pqPrimeLeemon (what) {
function bytesModPow (x, y, m) {
try {
var xBigInt = str2bigInt(x, 64),
yBigInt = str2bigInt(y, 64),
var xBigInt = str2bigInt(bytesToHex(x), 16),
yBigInt = str2bigInt(bytesToHex(y), 16),
mBigInt = str2bigInt(bytesToHex(m), 16, 2),
resBigInt = powMod(xBigInt, yBigInt, mBigInt);
return bytesFromHex(bigInt2str(resBigInt, 16));
} catch (e) {}
} catch (e) {
console.error('mod pow error', e);
}
return bytesFromBigInt(new BigInteger(x).modPow(new BigInteger(y), new BigInteger(m)));
}

Loading…
Cancel
Save