parent
e7494788e7
commit
984a0d9e78
@ -561,13 +561,15 @@ function pqPrimeLeemon (what) {
|
|||||||
|
|
||||||
function bytesModPow (x, y, m) {
|
function bytesModPow (x, y, m) {
|
||||||
try {
|
try {
|
||||||
var xBigInt = str2bigInt(x, 64),
|
var xBigInt = str2bigInt(bytesToHex(x), 16),
|
||||||
yBigInt = str2bigInt(y, 64),
|
yBigInt = str2bigInt(bytesToHex(y), 16),
|
||||||
mBigInt = str2bigInt(bytesToHex(m), 16, 2),
|
mBigInt = str2bigInt(bytesToHex(m), 16, 2),
|
||||||
resBigInt = powMod(xBigInt, yBigInt, mBigInt);
|
resBigInt = powMod(xBigInt, yBigInt, mBigInt);
|
||||||
|
|
||||||
return bytesFromHex(bigInt2str(resBigInt, 16));
|
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)));
|
return bytesFromBigInt(new BigInteger(x).modPow(new BigInteger(y), new BigInteger(m)));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user