diff --git a/README.hbs b/README.hbs index c1b1a9b..cb09ca8 100644 --- a/README.hbs +++ b/README.hbs @@ -5,7 +5,7 @@ Utils for working with cryptography using native JS (stage 3) implementation of _The operations supported on BigInts are not constant time. BigInt can be therefore **[unsuitable for use in cryptography](https://www.chosenplaintext.ca/articles/beginners-guide-constant-time-cryptography.html).** Many platforms provide native support for cryptography, such as [Web Cryptography API](https://w3c.github.io/webcrypto/) or [Node.js Crypto](https://nodejs.org/dist/latest/docs/api/crypto.html)._ ## Installation -bigint-crypto-utils is distributed for [web browsers supporting BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#Browser_compatibility) as an ES6 module or a IIFE file, and for Node.js (>=10.4.0) as a CJS module. +bigint-crypto-utils is distributed for [web browsers and/or webviews supporting BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#Browser_compatibility) as an ES6 module or an IIFE file; and for Node.js (>=10.4.0), as a CJS module. bigint-crypto-utils can be imported to your project with `npm`: ```bash @@ -21,8 +21,12 @@ With node js: ```javascript const bigintCryptoUtils = require('bigint-crypto-utils'); -// Stage 3 BigInts with value 666 can be declared as BigInt('666') -// or the shorter new no-so-linter-friendly syntax 666n +/* Stage 3 BigInts with value 666 can be declared as BigInt('666') + or the shorter new no-so-linter-friendly syntax 666n. + Notice that you can also pass a number, e.g. BigInt(666), but it is not + recommended since values over 2**53 - 1 won't be safe but no warning will + be raised. +*/ let a = BigInt('5'); let b = BigInt('2'); let n = BigInt('19'); diff --git a/README.md b/README.md index a2e898f..bbd6784 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Utils for working with cryptography using native JS (stage 3) implementation of _The operations supported on BigInts are not constant time. BigInt can be therefore **[unsuitable for use in cryptography](https://www.chosenplaintext.ca/articles/beginners-guide-constant-time-cryptography.html).** Many platforms provide native support for cryptography, such as [Web Cryptography API](https://w3c.github.io/webcrypto/) or [Node.js Crypto](https://nodejs.org/dist/latest/docs/api/crypto.html)._ ## Installation -bigint-crypto-utils is distributed for [web browsers supporting BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#Browser_compatibility) as an ES6 module or a IIFE file, and for Node.js (>=10.4.0) as a CJS module. +bigint-crypto-utils is distributed for [web browsers and/or webviews supporting BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#Browser_compatibility) as an ES6 module or an IIFE file; and for Node.js (>=10.4.0), as a CJS module. bigint-crypto-utils can be imported to your project with `npm`: ```bash @@ -21,8 +21,12 @@ With node js: ```javascript const bigintCryptoUtils = require('bigint-crypto-utils'); -// Stage 3 BigInts with value 666 can be declared as BigInt('666') -// or the shorter new no-so-linter-friendly syntax 666n +/* Stage 3 BigInts with value 666 can be declared as BigInt('666') + or the shorter new no-so-linter-friendly syntax 666n. + Notice that you can also pass a number, e.g. BigInt(666), but it is not + recommended since values over 2**53 - 1 won't be safe but no warning will + be raised. +*/ let a = BigInt('5'); let b = BigInt('2'); let n = BigInt('19'); @@ -108,7 +112,7 @@ iterations of Miller-Rabin Probabilistic Primality Test (FIPS 186-4 C.3.1)
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). The node version can also use worker_threads if they are available (enabled by default with Node 11 and -and can be enabled at runtime executing node --experimental-worker with node >=10.5.0) +and can be enabled at runtime executing node --experimental-worker with node >=10.5.0).Promise
Returns a cryptographically secure random integer between [min,max]
@@ -231,7 +235,7 @@ A probably-prime (Miller-Rabin), cryptographically-secure, random-number generat 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). The node version can also use worker_threads if they are available (enabled by default with Node 11 and -and can be enabled at runtime executing node --experimental-worker with node >=10.5.0) +and can be enabled at runtime executing node --experimental-worker with node >=10.5.0). **Kind**: global function **Returns**:Promise
- A promise that resolves to a bigint probable prime of bitLength bits
diff --git a/dist/bigint-crypto-utils-latest.browser.js b/dist/bigint-crypto-utils-latest.browser.js
index 884c3a9..f7f8130 100644
--- a/dist/bigint-crypto-utils-latest.browser.js
+++ b/dist/bigint-crypto-utils-latest.browser.js
@@ -185,7 +185,7 @@ var bigintCryptoUtils = (function (exports) {
* 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).
* The node version can also use worker_threads if they are available (enabled by default with Node 11 and
- * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0)
+ * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0).
*
* @param {number} bitLength The required bit length for the generated prime
* @param {number} iterations The number of iterations for the Miller-Rabin Probabilistic Primality Test
diff --git a/dist/bigint-crypto-utils-latest.browser.mod.js b/dist/bigint-crypto-utils-latest.browser.mod.js
index 155e8f7..3ffaeef 100644
--- a/dist/bigint-crypto-utils-latest.browser.mod.js
+++ b/dist/bigint-crypto-utils-latest.browser.mod.js
@@ -182,7 +182,7 @@ function modPow(a, b, n) {
* 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).
* The node version can also use worker_threads if they are available (enabled by default with Node 11 and
- * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0)
+ * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0).
*
* @param {number} bitLength The required bit length for the generated prime
* @param {number} iterations The number of iterations for the Miller-Rabin Probabilistic Primality Test
diff --git a/dist/bigint-crypto-utils-latest.node.js b/dist/bigint-crypto-utils-latest.node.js
index 3b1035f..5f4bfb6 100644
--- a/dist/bigint-crypto-utils-latest.node.js
+++ b/dist/bigint-crypto-utils-latest.node.js
@@ -190,7 +190,7 @@ function modPow(a, b, n) {
* 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).
* The node version can also use worker_threads if they are available (enabled by default with Node 11 and
- * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0)
+ * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0).
*
* @param {number} bitLength The required bit length for the generated prime
* @param {number} iterations The number of iterations for the Miller-Rabin Probabilistic Primality Test
diff --git a/src/main.js b/src/main.js
index bf5d300..24d6b57 100644
--- a/src/main.js
+++ b/src/main.js
@@ -207,7 +207,7 @@ export function modPow(a, b, n) {
* 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).
* The node version can also use worker_threads if they are available (enabled by default with Node 11 and
- * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0)
+ * and can be enabled at runtime executing node --experimental-worker with node >=10.5.0).
*
* @param {number} bitLength The required bit length for the generated prime
* @param {number} iterations The number of iterations for the Miller-Rabin Probabilistic Primality Test