minor fixes
This commit is contained in:
parent
2192825049
commit
360d06b4b2
|
@ -61,13 +61,13 @@ console.log(bigintCryptoUtils.modInv(2n, 5n)) // prints 3
|
|||
|
||||
console.log(bigintCryptoUtils.modInv(BigInt('3'), BigInt('5'))) // prints 2
|
||||
|
||||
console.log(bigintCryptoUtils.randBetween(2n ** 256n)) // Prints a cryptographically secure random number between 1 and 2**256 (both included).
|
||||
console.log(bigintCryptoUtils.randBetween(2n ** 256n)) // prints a cryptographically secure random number between 1 and 2**256 (both included).
|
||||
|
||||
async function primeTesting (): void {
|
||||
// Output of a probable prime of 2048 bits
|
||||
// Let us print out a probable prime of 2048 bits
|
||||
console.log(await bigintCryptoUtils.prime(2048))
|
||||
|
||||
// Testing if a number is a probable prime (Miller-Rabin)
|
||||
// Testing if number is a probable prime (Miller-Rabin)
|
||||
const number = 27n
|
||||
const isPrime = await bigintCryptoUtils.isProbablyPrime(number)
|
||||
if (isPrime === true) {
|
||||
|
|
16
docs/API.md
16
docs/API.md
|
@ -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:20](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/isProbablyPrime.ts#L20)
|
||||
[src/ts/isProbablyPrime.ts:20](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/isProbablyPrime.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
|
@ -322,7 +322,7 @@ A promise that resolves to a bigint probable prime of bitLength bits.
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/prime.ts:28](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/prime.ts#L28)
|
||||
[src/ts/prime.ts:28](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/prime.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
|
@ -352,7 +352,7 @@ A bigint probable prime of bitLength bits.
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/prime.ts:109](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/prime.ts#L109)
|
||||
[src/ts/prime.ts:109](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/prime.ts#L109)
|
||||
|
||||
___
|
||||
|
||||
|
@ -381,7 +381,7 @@ A cryptographically secure random bigint between [min,max]
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBetween.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/randBetween.ts#L14)
|
||||
[src/ts/randBetween.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/randBetween.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
|
@ -410,7 +410,7 @@ A Promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cry
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBits.ts:13](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/randBits.ts#L13)
|
||||
[src/ts/randBits.ts:13](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/randBits.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
|
@ -439,7 +439,7 @@ A Uint8Array/Buffer (Browser/Node.js) filled with cryptographically secure rando
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBits.ts:43](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/randBits.ts#L43)
|
||||
[src/ts/randBits.ts:43](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/randBits.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
|
@ -468,7 +468,7 @@ A promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cry
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBytes.ts:13](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/randBytes.ts#L13)
|
||||
[src/ts/randBytes.ts:13](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/randBytes.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
|
@ -498,7 +498,7 @@ A UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure rando
|
|||
|
||||
#### Defined in
|
||||
|
||||
[src/ts/randBytes.ts:45](https://github.com/juanelas/bigint-crypto-utils/blob/3138bfa/src/ts/randBytes.ts#L45)
|
||||
[src/ts/randBytes.ts:45](https://github.com/juanelas/bigint-crypto-utils/blob/2192825/src/ts/randBytes.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
|
|
|
@ -60,13 +60,13 @@ console.log(bigintCryptoUtils.modInv(2n, 5n)) // prints 3
|
|||
|
||||
console.log(bigintCryptoUtils.modInv(BigInt('3'), BigInt('5'))) // prints 2
|
||||
|
||||
console.log(bigintCryptoUtils.randBetween(2n ** 256n)) // Prints a cryptographically secure random number between 1 and 2**256 (both included).
|
||||
console.log(bigintCryptoUtils.randBetween(2n ** 256n)) // prints a cryptographically secure random number between 1 and 2**256 (both included).
|
||||
|
||||
async function primeTesting (): void {
|
||||
// Output of a probable prime of 2048 bits
|
||||
// Let us print out a probable prime of 2048 bits
|
||||
console.log(await bigintCryptoUtils.prime(2048))
|
||||
|
||||
// Testing if a number is a probable prime (Miller-Rabin)
|
||||
// Testing if number is a probable prime (Miller-Rabin)
|
||||
const number = 27n
|
||||
const isPrime = await bigintCryptoUtils.isProbablyPrime(number)
|
||||
if (isPrime === true) {
|
||||
|
|
Loading…
Reference in New Issue