browser minified version removed due to a bug. More browser tests added.

This commit is contained in:
juanelas 2019-12-12 09:03:42 +01:00
parent 84dc8b29d6
commit 84c8909174
6 changed files with 20 additions and 25 deletions

View File

@ -116,7 +116,7 @@ iterations of Miller-Rabin Probabilistic Primality Test (FIPS 186-4 C.3.1)</p>
<dt><a href="#modPow">modPow(b, e, n)</a><code>bigint</code></dt>
<dd><p>Modular exponentiation b**e mod n. Currently using the right-to-left binary method</p>
</dd>
<dt><a href="#prime">prime(bitLength, [iterations], sync)</a><code>Promise</code></dt>
<dt><a href="#prime">prime(bitLength, [iterations])</a><code>Promise</code></dt>
<dd><p>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
<a name="prime"></a>
## prime(bitLength, [iterations], sync) ⇒ <code>Promise</code>
## prime(bitLength, [iterations]) ⇒ <code>Promise</code>
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 | <code>number</code> | | The required bit length for the generated prime |
| [iterations] | <code>number</code> | <code>16</code> | The number of iterations for the Miller-Rabin Probabilistic Primality Test |
| sync | <code>boolean</code> | | 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. |
<a name="primeSync"></a>

View File

@ -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'),

View File

@ -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.
*/

File diff suppressed because one or more lines are too long

View File

@ -254,7 +254,6 @@ function modPow(b, e, n) {
*
* @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.
*/

View File

@ -264,7 +264,6 @@ function modPow(b, e, n) {
*
* @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.
*/