fixed issues/typos with docs
This commit is contained in:
parent
fe7a8fe3fc
commit
6fda498df6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
65
docs/API.md
65
docs/API.md
|
@ -82,7 +82,7 @@ Take positive integers a, b as input, and return a triple (g, x, y), such that a
|
|||
|
||||
**`Throws`**
|
||||
|
||||
This excepction is thrown if a or b are less than 0
|
||||
RangeError if a or b are <= 0
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -99,7 +99,7 @@ A triple (g, x, y), such that ax + by = g = gcd(a, b).
|
|||
|
||||
#### Defined in
|
||||
|
||||
node_modules/bigint-mod-arith/types/egcd.d.ts:18
|
||||
node_modules/bigint-mod-arith/types/egcd.d.ts:17
|
||||
|
||||
___
|
||||
|
||||
|
@ -107,7 +107,7 @@ ___
|
|||
|
||||
▸ **gcd**(`a`, `b`): `bigint`
|
||||
|
||||
Greatest-common divisor of two integers based on the iterative binary algorithm.
|
||||
Greatest common divisor of two integers based on the iterative binary algorithm.
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -137,14 +137,14 @@ iterations of Miller-Rabin Probabilistic Primality Test (FIPS 186-4 C.3.1)
|
|||
|
||||
**`Throws`**
|
||||
|
||||
w MUST be >= 0
|
||||
RangeError if w<0
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `w` | `number` \| `bigint` | `undefined` | A positive integer to be tested for primality |
|
||||
| `iterations` | `number` | `16` | The number of iterations for the primality test. The value shall be consistent with Table C.1, C.2 or C.3 |
|
||||
| `iterations` | `number` | `16` | The number of iterations for the primality test. The value shall be consistent with Table C.1, C.2 or C.3 of FIPS 186-4 |
|
||||
| `disableWorkers` | `boolean` | `false` | Disable the use of workers for the primality test |
|
||||
|
||||
#### Returns
|
||||
|
@ -155,7 +155,7 @@ A promise that resolves to a boolean that is either true (a probably prime numbe
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/isProbablyPrime.ts:21](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/isProbablyPrime.ts#L21)
|
||||
[src/ts/isProbablyPrime.ts:20](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/isProbablyPrime.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
|
@ -188,7 +188,7 @@ ___
|
|||
|
||||
▸ **max**(`a`, `b`): `number` \| `bigint`
|
||||
|
||||
Maximum. max(a,b)==a if a>=b. max(a,b)==b if a<=b
|
||||
Maximum. max(a,b)==a if a>=b. max(a,b)==b if a<b
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -213,7 +213,7 @@ ___
|
|||
|
||||
▸ **min**(`a`, `b`): `number` \| `bigint`
|
||||
|
||||
Minimum. min(a,b)==b if a>=b. min(a,b)==a if a<=b
|
||||
Minimum. min(a,b)==b if a>=b. min(a,b)==a if a<b
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -242,7 +242,7 @@ Modular inverse.
|
|||
|
||||
**`Throws`**
|
||||
|
||||
Excpeption thorwn when a does not have inverse modulo n
|
||||
RangeError if a does not have inverse modulo n
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -259,7 +259,7 @@ The inverse modulo n
|
|||
|
||||
#### Defined in
|
||||
|
||||
node_modules/bigint-mod-arith/types/modInv.d.ts:12
|
||||
node_modules/bigint-mod-arith/types/modInv.d.ts:11
|
||||
|
||||
___
|
||||
|
||||
|
@ -271,7 +271,7 @@ Modular exponentiation b**e mod n. Currently using the right-to-left binary meth
|
|||
|
||||
**`Throws`**
|
||||
|
||||
Excpeption thrown when n is not > 0
|
||||
RangeError if n <= 0
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -289,7 +289,7 @@ b**e mod n
|
|||
|
||||
#### Defined in
|
||||
|
||||
node_modules/bigint-mod-arith/types/modPow.d.ts:13
|
||||
node_modules/bigint-mod-arith/types/modPow.d.ts:12
|
||||
|
||||
___
|
||||
|
||||
|
@ -305,7 +305,7 @@ and can be enabled at runtime executing node --experimental-worker with node >=1
|
|||
|
||||
**`Throws`**
|
||||
|
||||
bitLength MUST be > 0
|
||||
RangeError if bitLength < 1
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -322,7 +322,7 @@ A promise that resolves to a bigint probable prime of bitLength bits.
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/prime.ts:29](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/prime.ts#L29)
|
||||
[src/ts/prime.ts:28](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/prime.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
|
@ -335,7 +335,7 @@ The sync version is NOT RECOMMENDED since it won't use workers and thus it'll be
|
|||
|
||||
**`Throws`**
|
||||
|
||||
bitLength MUST be > 0
|
||||
RangeError if bitLength < 1
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -352,7 +352,7 @@ A bigint probable prime of bitLength bits.
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/prime.ts:111](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/prime.ts#L111)
|
||||
[src/ts/prime.ts:109](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/prime.ts#L109)
|
||||
|
||||
___
|
||||
|
||||
|
@ -364,7 +364,7 @@ Returns a cryptographically secure random integer between [min,max].
|
|||
|
||||
**`Throws`**
|
||||
|
||||
Arguments MUST be: max > min
|
||||
RangeError if max <= min
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -381,7 +381,7 @@ A cryptographically secure random bigint between [min,max]
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBetween.ts:15](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/randBetween.ts#L15)
|
||||
[src/ts/randBetween.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/randBetween.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
|
@ -393,14 +393,14 @@ Secure random bits for both node and browsers. Node version uses crypto.randomFi
|
|||
|
||||
**`Throws`**
|
||||
|
||||
bitLength MUST be > 0
|
||||
RangeError if bitLength < 1
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `bitLength` | `number` | `undefined` | The desired number of random bits |
|
||||
| `forceLength` | `boolean` | `false` | If we want to force the output to have a specific bit length. It basically forces the msb to be 1 |
|
||||
| `forceLength` | `boolean` | `false` | Set to true if you want to force the output to have a specific bit length. It basically forces the msb to be 1 |
|
||||
|
||||
#### Returns
|
||||
|
||||
|
@ -410,7 +410,7 @@ A Promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cry
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBits.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/randBits.ts#L14)
|
||||
[src/ts/randBits.ts:13](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/randBits.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
|
@ -422,14 +422,14 @@ Secure random bits for both node and browsers. Node version uses crypto.randomFi
|
|||
|
||||
**`Throws`**
|
||||
|
||||
bitLength MUST be > 0
|
||||
RangeError if bitLength < 1
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `bitLength` | `number` | `undefined` | The desired number of random bits |
|
||||
| `forceLength` | `boolean` | `false` | If we want to force the output to have a specific bit length. It basically forces the msb to be 1 |
|
||||
| `forceLength` | `boolean` | `false` | Set to true if you want to force the output to have a specific bit length. It basically forces the msb to be 1 |
|
||||
|
||||
#### Returns
|
||||
|
||||
|
@ -439,7 +439,7 @@ A Uint8Array/Buffer (Browser/Node.js) filled with cryptographically secure rando
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBits.ts:45](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/randBits.ts#L45)
|
||||
[src/ts/randBits.ts:43](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/randBits.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
|
@ -451,14 +451,14 @@ Secure random bytes for both node and browsers. Node version uses crypto.randomB
|
|||
|
||||
**`Throws`**
|
||||
|
||||
byteLength MUST be > 0
|
||||
RangeError if byteLength < 1
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `byteLength` | `number` | `undefined` | The desired number of random bytes |
|
||||
| `forceLength` | `boolean` | `false` | If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1 |
|
||||
| `forceLength` | `boolean` | `false` | Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1 |
|
||||
|
||||
#### Returns
|
||||
|
||||
|
@ -468,7 +468,7 @@ A promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cry
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBytes.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/randBytes.ts#L14)
|
||||
[src/ts/randBytes.ts:13](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/randBytes.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
|
@ -477,17 +477,18 @@ ___
|
|||
▸ **randBytesSync**(`byteLength`, `forceLength?`): `Uint8Array` \| `Buffer`
|
||||
|
||||
Secure random bytes for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
This is the synchronous version, consider using the asynchronous one for improved efficiency.
|
||||
|
||||
**`Throws`**
|
||||
|
||||
byteLength MUST be > 0
|
||||
RangeError if byteLength < 1
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `byteLength` | `number` | `undefined` | The desired number of random bytes |
|
||||
| `forceLength` | `boolean` | `false` | If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1 |
|
||||
| `forceLength` | `boolean` | `false` | Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1 |
|
||||
|
||||
#### Returns
|
||||
|
||||
|
@ -497,7 +498,7 @@ A UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure rando
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBytes.ts:46](https://github.com/juanelas/bigint-crypto-utils/blob/d4bc197/src/ts/randBytes.ts#L46)
|
||||
[src/ts/randBytes.ts:45](https://github.com/juanelas/bigint-crypto-utils/blob/fe7a8fe/src/ts/randBytes.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
|
@ -513,7 +514,7 @@ a and b must be the same type, either number or bigint
|
|||
|
||||
**`Throws`**
|
||||
|
||||
Excpeption thrown when n is not > 0
|
||||
RangeError if n <= 0
|
||||
|
||||
#### Parameters
|
||||
|
||||
|
@ -530,4 +531,4 @@ A bigint with the smallest positive representation of a modulo n
|
|||
|
||||
#### Defined in
|
||||
|
||||
node_modules/bigint-mod-arith/types/toZn.d.ts:15
|
||||
node_modules/bigint-mod-arith/types/toZn.d.ts:14
|
||||
|
|
|
@ -1019,9 +1019,9 @@
|
|||
]
|
||||
},
|
||||
"node_modules/bigint-mod-arith": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bigint-mod-arith/-/bigint-mod-arith-3.1.0.tgz",
|
||||
"integrity": "sha512-vpiKCiv9B1nK8HhFOU7PMC4k9nrufQxeivgCj5yOH2ZMLD+UPwc/RfNgBCX+v8C6t0sF4q7mEZgZij6k53zpWA==",
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bigint-mod-arith/-/bigint-mod-arith-3.1.1.tgz",
|
||||
"integrity": "sha512-SzFqdncZKXq5uh3oLFZXmzaZEMDsA7ml9l53xKaVGO6/+y26xNwAaTQEg2R+D+d07YduLbKi0dni3YPsR51UDQ==",
|
||||
"engines": {
|
||||
"node": ">=10.4.0"
|
||||
}
|
||||
|
@ -1968,9 +1968,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-react": {
|
||||
"version": "7.31.7",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.7.tgz",
|
||||
"integrity": "sha512-8NldBTeYp/kQoTV1uT0XF6HcmDqbgZ0lNPkN0wlRw8DJKXEnaWu+oh/6gt3xIhzvQ35wB2Y545fJhIbJSZ2NNw==",
|
||||
"version": "7.31.8",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.8.tgz",
|
||||
"integrity": "sha512-5lBTZmgQmARLLSYiwI71tiGVTLUuqXantZM6vlSY39OaDSV0M7+32K5DnLkmFrwTe+Ksz0ffuLUC91RUviVZfw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-includes": "^3.1.5",
|
||||
|
@ -2319,9 +2319,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/fast-glob": {
|
||||
"version": "3.2.11",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
|
||||
"integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
|
||||
"version": "3.2.12",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz",
|
||||
"integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
|
@ -2941,9 +2941,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/is-callable": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz",
|
||||
"integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==",
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.5.tgz",
|
||||
"integrity": "sha512-ZIWRujF6MvYGkEuHMYtFRkL2wAtFw89EHfKlXrkPkjQZZRWeh9L1q3SV13NIfHnqxugjLvAOkEHx9mb1zcMnEw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
|
@ -5442,9 +5442,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz",
|
||||
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==",
|
||||
"version": "4.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
|
||||
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
@ -6472,9 +6472,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"bigint-mod-arith": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bigint-mod-arith/-/bigint-mod-arith-3.1.0.tgz",
|
||||
"integrity": "sha512-vpiKCiv9B1nK8HhFOU7PMC4k9nrufQxeivgCj5yOH2ZMLD+UPwc/RfNgBCX+v8C6t0sF4q7mEZgZij6k53zpWA=="
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bigint-mod-arith/-/bigint-mod-arith-3.1.1.tgz",
|
||||
"integrity": "sha512-SzFqdncZKXq5uh3oLFZXmzaZEMDsA7ml9l53xKaVGO6/+y26xNwAaTQEg2R+D+d07YduLbKi0dni3YPsR51UDQ=="
|
||||
},
|
||||
"binary-extensions": {
|
||||
"version": "2.2.0",
|
||||
|
@ -7260,9 +7260,9 @@
|
|||
"requires": {}
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"version": "7.31.7",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.7.tgz",
|
||||
"integrity": "sha512-8NldBTeYp/kQoTV1uT0XF6HcmDqbgZ0lNPkN0wlRw8DJKXEnaWu+oh/6gt3xIhzvQ35wB2Y545fJhIbJSZ2NNw==",
|
||||
"version": "7.31.8",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.8.tgz",
|
||||
"integrity": "sha512-5lBTZmgQmARLLSYiwI71tiGVTLUuqXantZM6vlSY39OaDSV0M7+32K5DnLkmFrwTe+Ksz0ffuLUC91RUviVZfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-includes": "^3.1.5",
|
||||
|
@ -7441,9 +7441,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"fast-glob": {
|
||||
"version": "3.2.11",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
|
||||
"integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
|
||||
"version": "3.2.12",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz",
|
||||
"integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
|
@ -7887,9 +7887,9 @@
|
|||
}
|
||||
},
|
||||
"is-callable": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz",
|
||||
"integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==",
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.5.tgz",
|
||||
"integrity": "sha512-ZIWRujF6MvYGkEuHMYtFRkL2wAtFw89EHfKlXrkPkjQZZRWeh9L1q3SV13NIfHnqxugjLvAOkEHx9mb1zcMnEw==",
|
||||
"dev": true
|
||||
},
|
||||
"is-core-module": {
|
||||
|
@ -9744,9 +9744,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz",
|
||||
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==",
|
||||
"version": "4.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
|
||||
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
|
|
|
@ -10,11 +10,10 @@ import { _useWorkers, _workerUrl, WorkerToMainMsg, MainToWorkerMsg } from './wor
|
|||
* iterations of Miller-Rabin Probabilistic Primality Test (FIPS 186-4 C.3.1)
|
||||
*
|
||||
* @param w - A positive integer to be tested for primality
|
||||
* @param iterations - The number of iterations for the primality test. The value shall be consistent with Table C.1, C.2 or C.3
|
||||
* @param iterations - The number of iterations for the primality test. The value shall be consistent with Table C.1, C.2 or C.3 of FIPS 186-4
|
||||
* @param disableWorkers - Disable the use of workers for the primality test
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* w MUST be >= 0
|
||||
* @throws {@link RangeError} if w<0
|
||||
*
|
||||
* @returns A promise that resolves to a boolean that is either true (a probably prime number) or false (definitely composite)
|
||||
*/
|
||||
|
|
|
@ -21,8 +21,7 @@ if (!IS_BROWSER) {
|
|||
* @param bitLength - The required bit length for the generated prime
|
||||
* @param iterations - The number of iterations for the Miller-Rabin Probabilistic Primality Test
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A promise that resolves to a bigint probable prime of bitLength bits.
|
||||
*/
|
||||
|
@ -103,8 +102,7 @@ export function prime (bitLength: number, iterations: number = 16): Promise<bigi
|
|||
* @param bitLength - The required bit length for the generated prime
|
||||
* @param iterations - The number of iterations for the Miller-Rabin Probabilistic Primality Test
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A bigint probable prime of bitLength bits.
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,7 @@ import { randBitsSync } from './randBits'
|
|||
* @param max Returned value will be <= max
|
||||
* @param min Returned value will be >= min
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* Arguments MUST be: max > min
|
||||
* @throws {@link RangeError} if max <= min
|
||||
*
|
||||
* @returns A cryptographically secure random bigint between [min,max]
|
||||
*/
|
||||
|
|
|
@ -4,10 +4,9 @@ import { randBytes, randBytesSync } from './randBytes'
|
|||
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
*
|
||||
* @param bitLength - The desired number of random bits
|
||||
* @param forceLength - If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A Promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bits
|
||||
*/
|
||||
|
@ -35,10 +34,9 @@ export function randBits (bitLength: number, forceLength: boolean = false): Prom
|
|||
/**
|
||||
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
* @param bitLength - The desired number of random bits
|
||||
* @param forceLength - If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A Uint8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bits
|
||||
*/
|
||||
|
|
|
@ -4,10 +4,9 @@ if (!IS_BROWSER) var crypto = await import('crypto') // eslint-disable-line no-v
|
|||
* Secure random bytes for both node and browsers. Node version uses crypto.randomBytes() and browser one self.crypto.getRandomValues()
|
||||
*
|
||||
* @param byteLength - The desired number of random bytes
|
||||
* @param forceLength - If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* byteLength MUST be > 0
|
||||
* @throws {@link RangeError} if byteLength < 1
|
||||
*
|
||||
* @returns A promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bytes
|
||||
*/
|
||||
|
@ -34,12 +33,12 @@ export function randBytes (byteLength: number, forceLength = false): Promise<Uin
|
|||
|
||||
/**
|
||||
* Secure random bytes for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
* This is the synchronous version, consider using the asynchronous one for improved efficiency.
|
||||
*
|
||||
* @param byteLength - The desired number of random bytes
|
||||
* @param forceLength - If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* byteLength MUST be > 0
|
||||
* @throws {@link RangeError} if byteLength < 1
|
||||
*
|
||||
* @returns A UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bytes
|
||||
*/
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
* iterations of Miller-Rabin Probabilistic Primality Test (FIPS 186-4 C.3.1)
|
||||
*
|
||||
* @param w - A positive integer to be tested for primality
|
||||
* @param iterations - The number of iterations for the primality test. The value shall be consistent with Table C.1, C.2 or C.3
|
||||
* @param iterations - The number of iterations for the primality test. The value shall be consistent with Table C.1, C.2 or C.3 of FIPS 186-4
|
||||
* @param disableWorkers - Disable the use of workers for the primality test
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* w MUST be >= 0
|
||||
* @throws {@link RangeError} if w<0
|
||||
*
|
||||
* @returns A promise that resolves to a boolean that is either true (a probably prime number) or false (definitely composite)
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"isProbablyPrime.d.ts","sourceRoot":"","sources":["../src/ts/isProbablyPrime.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAE,CAAC,EAAE,MAAM,GAAC,MAAM,EAAE,UAAU,GAAE,MAAW,EAAE,cAAc,GAAE,OAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA2D7H;AAED,wBAAgB,gBAAgB,CAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CA0TxE;AAED,wBAAgB,yBAAyB,IAAK,MAAM,CA8BnD"}
|
||||
{"version":3,"file":"isProbablyPrime.d.ts","sourceRoot":"","sources":["../src/ts/isProbablyPrime.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAE,CAAC,EAAE,MAAM,GAAC,MAAM,EAAE,UAAU,GAAE,MAAW,EAAE,cAAc,GAAE,OAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA2D7H;AAED,wBAAgB,gBAAgB,CAAE,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CA0TxE;AAED,wBAAgB,yBAAyB,IAAK,MAAM,CA8BnD"}
|
|
@ -8,8 +8,7 @@
|
|||
* @param bitLength - The required bit length for the generated prime
|
||||
* @param iterations - The number of iterations for the Miller-Rabin Probabilistic Primality Test
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A promise that resolves to a bigint probable prime of bitLength bits.
|
||||
*/
|
||||
|
@ -21,8 +20,7 @@ export declare function prime(bitLength: number, iterations?: number): Promise<b
|
|||
* @param bitLength - The required bit length for the generated prime
|
||||
* @param iterations - The number of iterations for the Miller-Rabin Probabilistic Primality Test
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A bigint probable prime of bitLength bits.
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"prime.d.ts","sourceRoot":"","sources":["../src/ts/prime.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAoElF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAG,MAAM,CAO7E"}
|
||||
{"version":3,"file":"prime.d.ts","sourceRoot":"","sources":["../src/ts/prime.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAoElF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAG,MAAM,CAO7E"}
|
|
@ -3,8 +3,7 @@
|
|||
* @param max Returned value will be <= max
|
||||
* @param min Returned value will be >= min
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* Arguments MUST be: max > min
|
||||
* @throws {@link RangeError} if max <= min
|
||||
*
|
||||
* @returns A cryptographically secure random bigint between [min,max]
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"randBetween.d.ts","sourceRoot":"","sources":["../src/ts/randBetween.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAW,GAAG,MAAM,CAUlE"}
|
||||
{"version":3,"file":"randBetween.d.ts","sourceRoot":"","sources":["../src/ts/randBetween.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAW,GAAG,MAAM,CAUlE"}
|
|
@ -3,10 +3,9 @@
|
|||
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
*
|
||||
* @param bitLength - The desired number of random bits
|
||||
* @param forceLength - If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A Promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bits
|
||||
*/
|
||||
|
@ -14,10 +13,9 @@ export declare function randBits(bitLength: number, forceLength?: boolean): Prom
|
|||
/**
|
||||
* Secure random bits for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
* @param bitLength - The desired number of random bits
|
||||
* @param forceLength - If we want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a specific bit length. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* bitLength MUST be > 0
|
||||
* @throws {@link RangeError} if bitLength < 1
|
||||
*
|
||||
* @returns A Uint8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bits
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"randBits.d.ts","sourceRoot":"","sources":["../src/ts/randBits.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,OAAO,CAAC,UAAU,GAAC,MAAM,CAAC,CAmBrG;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,UAAU,GAAC,MAAM,CAehG"}
|
||||
{"version":3,"file":"randBits.d.ts","sourceRoot":"","sources":["../src/ts/randBits.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,OAAO,CAAC,UAAU,GAAC,MAAM,CAAC,CAmBrG;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,UAAU,GAAC,MAAM,CAehG"}
|
|
@ -3,22 +3,21 @@
|
|||
* Secure random bytes for both node and browsers. Node version uses crypto.randomBytes() and browser one self.crypto.getRandomValues()
|
||||
*
|
||||
* @param byteLength - The desired number of random bytes
|
||||
* @param forceLength - If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* byteLength MUST be > 0
|
||||
* @throws {@link RangeError} if byteLength < 1
|
||||
*
|
||||
* @returns A promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bytes
|
||||
*/
|
||||
export declare function randBytes(byteLength: number, forceLength?: boolean): Promise<Uint8Array | Buffer>;
|
||||
/**
|
||||
* Secure random bytes for both node and browsers. Node version uses crypto.randomFill() and browser one self.crypto.getRandomValues()
|
||||
* This is the synchronous version, consider using the asynchronous one for improved efficiency.
|
||||
*
|
||||
* @param byteLength - The desired number of random bytes
|
||||
* @param forceLength - If we want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
* @param forceLength - Set to true if you want to force the output to have a bit length of 8*byteLength. It basically forces the msb to be 1
|
||||
*
|
||||
* @throws {RangeError}
|
||||
* byteLength MUST be > 0
|
||||
* @throws {@link RangeError} if byteLength < 1
|
||||
*
|
||||
* @returns A UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure random bytes
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"randBytes.d.ts","sourceRoot":"","sources":["../src/ts/randBytes.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAE,UAAU,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,UAAU,GAAC,MAAM,CAAC,CAmB9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,UAAU,GAAC,MAAM,CAiBlG"}
|
||||
{"version":3,"file":"randBytes.d.ts","sourceRoot":"","sources":["../src/ts/randBytes.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAE,UAAU,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,UAAU,GAAC,MAAM,CAAC,CAmB9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,UAAU,GAAC,MAAM,CAiBlG"}
|
Loading…
Reference in New Issue