browser minified version removed due to a bug. More browser tests added.
This commit is contained in:
parent
84dc8b29d6
commit
84c8909174
|
@ -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>
|
<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><p>Modular exponentiation b**e mod n. Currently using the right-to-left binary method</p>
|
||||||
</dd>
|
</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.
|
<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
|
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).
|
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>
|
<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.
|
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
|
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).
|
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 |
|
| 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 |
|
| [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>
|
<a name="primeSync"></a>
|
||||||
|
|
||||||
|
|
|
@ -27,24 +27,24 @@ const buildOptions = [
|
||||||
name: camelise(pkgJson.name)
|
name: camelise(pkgJson.name)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ // Browser minified
|
// { // Browser minified
|
||||||
input: {
|
// input: {
|
||||||
input: path.join(srcDir, 'main.js'),
|
// input: path.join(srcDir, 'main.js'),
|
||||||
plugins: [
|
// plugins: [
|
||||||
replace({
|
// replace({
|
||||||
'process.browser': true
|
// 'process.browser': true
|
||||||
}),
|
// }),
|
||||||
minify({
|
// minify({
|
||||||
'comments': false
|
// 'comments': false
|
||||||
})
|
// })
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
output: {
|
// output: {
|
||||||
file: path.join(dstDir, `${pkgJson.name}-${pkgJson.version}.browser.min.js`),
|
// file: path.join(dstDir, `${pkgJson.name}-${pkgJson.version}.browser.min.js`),
|
||||||
format: 'iife',
|
// format: 'iife',
|
||||||
name: camelise(pkgJson.name)
|
// name: camelise(pkgJson.name)
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
{ // Browser esm
|
{ // Browser esm
|
||||||
input: {
|
input: {
|
||||||
input: path.join(srcDir, 'main.js'),
|
input: path.join(srcDir, 'main.js'),
|
||||||
|
|
|
@ -257,7 +257,6 @@ var bigintCryptoUtils = (function (exports) {
|
||||||
*
|
*
|
||||||
* @param {number} bitLength The required bit length for the generated prime
|
* @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 {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.
|
* @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
|
@ -254,7 +254,6 @@ function modPow(b, e, n) {
|
||||||
*
|
*
|
||||||
* @param {number} bitLength The required bit length for the generated prime
|
* @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 {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.
|
* @returns {Promise} A promise that resolves to a bigint probable prime of bitLength bits.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -264,7 +264,6 @@ function modPow(b, e, n) {
|
||||||
*
|
*
|
||||||
* @param {number} bitLength The required bit length for the generated prime
|
* @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 {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.
|
* @returns {Promise} A promise that resolves to a bigint probable prime of bitLength bits.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue