Revert "Other minor dependencies updates in 7.1.x patch"

This reverts commit 5a5f544a48.

Rationale: base64-js update in 5a5f544 causes 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 time 5a5f544 was committed.

The base64-js update in 5a5f544 is now deemed as
not wanted due to the extra base64-js version that
would need to be committed.

The other dependencies updates in 5a5f544
may 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 neither 5a5f544 nor this revert will
show up in the master branch.
This commit is contained in:
Christopher J. Brody
2018-11-22 22:18:32 -05:00
parent b7643a3712
commit 84cb08b23e
18 changed files with 242 additions and 406 deletions

View File

@@ -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;

File diff suppressed because one or more lines are too long

10
node_modules/big-integer/README.md generated vendored
View File

@@ -219,15 +219,15 @@ Returns `true` if the number is prime, `false` otherwise.
Returns `true` if the number is very likely to be prime, `false` otherwise.
Argument is optional and determines the amount of iterations of the test (default: `5`). The more iterations, the lower chance of getting a false positive.
This uses the [Miller Rabin test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test).
This uses the [Fermat primality test](https://en.wikipedia.org/wiki/Fermat_primality_test).
- `bigInt(5).isProbablePrime()` => `true`
- `bigInt(49).isProbablePrime()` => `false`
- `bigInt(1729).isProbablePrime()` => `false`
- `bigInt(1729).isProbablePrime(50)` => `false`
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same.
If the number is composite then the MillerRabin primality test declares the number probably prime with a probability at most `4` to the power `iterations`.
If the number is prime, this function always returns `true`.
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same. [Carmichael numbers](https://en.wikipedia.org/wiki/Carmichael_number) are particularly prone to give unreliable results.
For example, `bigInt(1729).isProbablePrime()` returns `false` about 76% of the time and `true` about 24% of the time. The correct result is `false`.
#### `isUnit()`

View File

@@ -1,29 +1,27 @@
{
"_from": "big-integer@1",
"_id": "big-integer@1.6.36",
"_from": "big-integer@^1.6.7",
"_id": "big-integer@1.6.32",
"_inBundle": false,
"_integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==",
"_integrity": "sha512-ljKJdR3wk9thHfLj4DtrNiOSTxvGFaMjWrG4pW75juXC4j7+XuKJVFdg4kgFMYp85PVkO05dFMj2dk2xVsH4xw==",
"_location": "/big-integer",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "big-integer@1",
"raw": "big-integer@^1.6.7",
"name": "big-integer",
"escapedName": "big-integer",
"rawSpec": "1",
"rawSpec": "^1.6.7",
"saveSpec": null,
"fetchSpec": "1"
"fetchSpec": "^1.6.7"
},
"_requiredBy": [
"#USER",
"/",
"/bplist-parser"
],
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz",
"_shasum": "78631076265d4ae3555c04f85e7d9d2f3a071a36",
"_spec": "big-integer@1",
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.32.tgz",
"_shasum": "5867458b25ecd5bcb36b627c30bb501a13c07e89",
"_spec": "big-integer@^1.6.7",
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/bplist-parser",
"author": {
"name": "Peter Olson",
"email": "peter.e.c.olson+npm@gmail.com"
@@ -78,5 +76,5 @@
"test": "tsc && karma start my.conf.js && node spec/tsDefinitions.js"
},
"typings": "./BigInteger.d.ts",
"version": "1.6.36"
"version": "1.6.32"
}