From 84c890917432bb44699e4f8ef3aa00214a41c70c Mon Sep 17 00:00:00 2001
From: juanelas
bigint
Modular exponentiation b**e mod n. Currently using the right-to-left binary method
Promise
Promise
A probably-prime (Miller-Rabin), cryptographically-secure, random-number generator.
The browser version uses web workers to parallelise prime look up. Therefore, it does not lock the UI
main process, and it can be much faster (if several cores or cpu are available).
@@ -285,7 +285,7 @@ Modular exponentiation b**e mod n. Currently using the right-to-left binary meth
-## prime(bitLength, [iterations], sync) ⇒ Promise
+## prime(bitLength, [iterations]) ⇒ Promise
A probably-prime (Miller-Rabin), cryptographically-secure, random-number generator.
The browser version uses web workers to parallelise prime look up. Therefore, it does not lock the UI
main process, and it can be much faster (if several cores or cpu are available).
@@ -299,7 +299,6 @@ and can be enabled at runtime executing node --experimental-worker with node >=1
| --- | --- | --- | --- |
| bitLength | number
| | The required bit length for the generated prime |
| [iterations] | number
| 16
| The number of iterations for the Miller-Rabin Probabilistic Primality Test |
-| sync | boolean
| | NOT RECOMMENDED. Invoke the function synchronously. It won't use workers so it'll be slower and may freeze thw window in browser's javascript. |
diff --git a/build/build.rollup.js b/build/build.rollup.js
index 71acae9..4f9c7eb 100644
--- a/build/build.rollup.js
+++ b/build/build.rollup.js
@@ -27,24 +27,24 @@ const buildOptions = [
name: camelise(pkgJson.name)
}
},
- { // Browser minified
- input: {
- input: path.join(srcDir, 'main.js'),
- plugins: [
- replace({
- 'process.browser': true
- }),
- minify({
- 'comments': false
- })
- ],
- },
- output: {
- file: path.join(dstDir, `${pkgJson.name}-${pkgJson.version}.browser.min.js`),
- format: 'iife',
- name: camelise(pkgJson.name)
- }
- },
+ // { // Browser minified
+ // input: {
+ // input: path.join(srcDir, 'main.js'),
+ // plugins: [
+ // replace({
+ // 'process.browser': true
+ // }),
+ // minify({
+ // 'comments': false
+ // })
+ // ],
+ // },
+ // output: {
+ // file: path.join(dstDir, `${pkgJson.name}-${pkgJson.version}.browser.min.js`),
+ // format: 'iife',
+ // name: camelise(pkgJson.name)
+ // }
+ // },
{ // Browser esm
input: {
input: path.join(srcDir, 'main.js'),
diff --git a/dist/bigint-crypto-utils-latest.browser.js b/dist/bigint-crypto-utils-latest.browser.js
index acf5ae0..dede38f 100644
--- a/dist/bigint-crypto-utils-latest.browser.js
+++ b/dist/bigint-crypto-utils-latest.browser.js
@@ -257,7 +257,6 @@ var bigintCryptoUtils = (function (exports) {
*
* @param {number} bitLength The required bit length for the generated prime
* @param {number} [iterations = 16] The number of iterations for the Miller-Rabin Probabilistic Primality Test
- * @param {boolean} sync NOT RECOMMENDED. Invoke the function synchronously. It won't use workers so it'll be slower and may freeze thw window in browser's javascript.
*
* @returns {Promise} A promise that resolves to a bigint probable prime of bitLength bits.
*/
diff --git a/dist/bigint-crypto-utils-latest.browser.min.js b/dist/bigint-crypto-utils-latest.browser.min.js
deleted file mode 100644
index 688bfdf..0000000
--- a/dist/bigint-crypto-utils-latest.browser.min.js
+++ /dev/null
@@ -1 +0,0 @@
-var bigintCryptoUtils=function(a){'use strict';function c(b){return b=BigInt(b),b>=s?b:-b}function d(b){if(b=BigInt(b),b===t)return 1;let c=1;do c++;while((b>>=t)>t);return c}function e(c,d){if(c=BigInt(c),d=BigInt(d),c<=s|d<=s)return NaN;let e=s,f=t,g=t,h=s;for(;c!==s;){let a=d/c,b=d%c,i=e-g*a,j=f-h*a;d=c,c=b,e=g,f=h,g=i,h=j}return{b:d,x:e,y:f}}function f(d,e){if(d=c(d),e=c(e),d===s)return e;if(e===s)return d;let f=s;for(;!((d|e)&t);)d>>=t,e>>=t,f++;for(;!(d&t);)d>>=t;do{for(;!(e&t);)e>>=t;if(d>e){let a=d;d=e,e=a}e-=d}while(e);return d< min");const c=a-b;let e,f=d(c);do{let a=k(f);e=n(a)}while(e>c);return e+b}function k(a,b=!1){var c=Math.ceil;if(1>a)throw new RangeError(`bitLength MUST be > 0 and it is ${a}`);const d=c(a/8);let e=l(d,!1);if(e[0]&=2**(a%8)-1,b){let b=a%8?2**(a%8-1):128;e[0]|=b}return e}function l(a,b=!1){if(1>a)throw new RangeError(`byteLength MUST be > 0 and it is ${a}`);let c;return c=new Uint8Array(a),self.crypto.getRandomValues(c),b&&(c[0]|=128),c}function m(b,c){return(c=BigInt(c),0>=c)?NaN:(b=BigInt(b)%c,0>b?b+c:b)}function n(a){let b=s;for(let c of a.values()){let a=BigInt(c);b=(b<