mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Revert "Other minor dependencies updates in 7.1.x patch"
This reverts commit5a5f544a48. Rationale: base64-js update in5a5f544causes extra base64-js version to be installed under plist (node_modules/plist/node_modules/base64-js), which would need to be committed to satisfy the needs of the deprecated Node.js 4 version. The extra base64-js version in node_modules/plist/node_modules/base64-js was missed at the time5a5f544was committed. The base64-js update in5a5f544is now deemed as not wanted due to the extra base64-js version that would need to be committed. The other dependencies updates in5a5f544may be nice to have but not considered necessary for the patch release. Reverting now to unblock the upcoming 7.1.4 patch release. Note that neither5a5f544nor this revert will show up in the master branch.
This commit is contained in:
+23
-36
@@ -785,44 +785,29 @@ var bigInt = (function (undefined) {
|
||||
if (n.isUnit()) return false;
|
||||
if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
|
||||
if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
|
||||
if (n.lesser(49)) return true;
|
||||
if (n.lesser(25)) return true;
|
||||
// we don't know if it's prime: let the other functions figure it out
|
||||
}
|
||||
|
||||
function millerRabinTest(n, a) {
|
||||
var nPrev = n.prev(),
|
||||
b = nPrev,
|
||||
r = 0,
|
||||
d, t, i, x;
|
||||
while (b.isEven()) b = b.divide(2), r++;
|
||||
next : for (i = 0; i < a.length; i++) {
|
||||
if (n.lesser(a[i])) continue;
|
||||
x = bigInt(a[i]).modPow(b, n);
|
||||
if (x.equals(Integer[1]) || x.equals(nPrev)) continue;
|
||||
for (d = r - 1; d != 0; d--) {
|
||||
x = x.square().mod(n);
|
||||
if (x.isUnit()) return false;
|
||||
if (x.equals(nPrev)) continue next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2
|
||||
BigInteger.prototype.isPrime = function (strict) {
|
||||
|
||||
BigInteger.prototype.isPrime = function () {
|
||||
var isPrime = isBasicPrime(this);
|
||||
if (isPrime !== undefined) return isPrime;
|
||||
var n = this.abs();
|
||||
var bits = n.bitLength();
|
||||
if(bits <= 64)
|
||||
return millerRabinTest(n, [2, 325, 9375, 28178, 450775, 9780504, 1795265022]);
|
||||
var logN = Math.log(2) * bits;
|
||||
var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN);
|
||||
for (var a = [], i = 0; i < t; i++) {
|
||||
a.push(bigInt(i + 2));
|
||||
var n = this.abs(),
|
||||
nPrev = n.prev();
|
||||
var a = [2, 3, 5, 7, 11, 13, 17, 19],
|
||||
b = nPrev,
|
||||
d, t, i, x;
|
||||
while (b.isEven()) b = b.divide(2);
|
||||
for (i = 0; i < a.length; i++) {
|
||||
x = bigInt(a[i]).modPow(b, n);
|
||||
if (x.equals(Integer[1]) || x.equals(nPrev)) continue;
|
||||
for (t = true, d = b; t && d.lesser(nPrev); d = d.multiply(2)) {
|
||||
x = x.square().mod(n);
|
||||
if (x.equals(nPrev)) t = false;
|
||||
}
|
||||
if (t) return false;
|
||||
}
|
||||
return millerRabinTest(n, a);
|
||||
return true;
|
||||
};
|
||||
SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
|
||||
|
||||
@@ -831,10 +816,12 @@ var bigInt = (function (undefined) {
|
||||
if (isPrime !== undefined) return isPrime;
|
||||
var n = this.abs();
|
||||
var t = iterations === undefined ? 5 : iterations;
|
||||
for (var a = [], i = 0; i < t; i++) {
|
||||
a.push(bigInt.randBetween(2, n.minus(2)));
|
||||
// use the Fermat primality test
|
||||
for (var i = 0; i < t; i++) {
|
||||
var a = bigInt.randBetween(2, n.minus(2));
|
||||
if (!a.modPow(n.prev(), n).isUnit()) return false; // definitely composite
|
||||
}
|
||||
return millerRabinTest(n, a);
|
||||
return true; // large chance of being prime
|
||||
};
|
||||
SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user