randBitsSync
This commit is contained in:
parent
eaf7c53ca2
commit
7e792b5e2e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -321,7 +321,7 @@ function primeSync (bitLength, iterations = 16) {
|
|||
if (bitLength < 1) { throw new RangeError(`bitLength MUST be > 0 and it is ${bitLength}`) }
|
||||
let rnd = 0n
|
||||
do {
|
||||
rnd = fromBuffer(randBits(bitLength, true))
|
||||
rnd = fromBuffer(randBitsSync(bitLength, true))
|
||||
} while (!_isProbablyPrime(rnd, iterations))
|
||||
return rnd
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ function primeSync (bitLength, iterations = 16) {
|
|||
if (bitLength < 1) { throw new RangeError(`bitLength MUST be > 0 and it is ${bitLength}`) }
|
||||
let rnd = 0n
|
||||
do {
|
||||
rnd = fromBuffer(randBits(bitLength, true))
|
||||
rnd = fromBuffer(randBitsSync(bitLength, true))
|
||||
} while (!_isProbablyPrime(rnd, iterations))
|
||||
return rnd
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ function prime (bitLength, iterations = 16) {
|
|||
if (!_useWorkers) {
|
||||
let rnd = 0n
|
||||
do {
|
||||
rnd = fromBuffer(randBits(bitLength, true))
|
||||
rnd = fromBuffer(randBitsSync(bitLength, true))
|
||||
} while (!_isProbablyPrime(rnd, iterations))
|
||||
return new Promise((resolve) => { resolve(rnd) })
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ function primeSync (bitLength, iterations = 16) {
|
|||
if (bitLength < 1) { throw new RangeError(`bitLength MUST be > 0 and it is ${bitLength}`) }
|
||||
let rnd = 0n
|
||||
do {
|
||||
rnd = fromBuffer(randBits(bitLength, true))
|
||||
rnd = fromBuffer(randBitsSync(bitLength, true))
|
||||
} while (!_isProbablyPrime(rnd, iterations))
|
||||
return rnd
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ export function prime (bitLength, iterations = 16) {
|
|||
if (!process.browser && !_useWorkers) {
|
||||
let rnd = 0n
|
||||
do {
|
||||
rnd = fromBuffer(randBits(bitLength, true))
|
||||
rnd = fromBuffer(randBitsSync(bitLength, true))
|
||||
} while (!_isProbablyPrime(rnd, iterations))
|
||||
return new Promise((resolve) => { resolve(rnd) })
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ export function primeSync (bitLength, iterations = 16) {
|
|||
if (bitLength < 1) { throw new RangeError(`bitLength MUST be > 0 and it is ${bitLength}`) }
|
||||
let rnd = 0n
|
||||
do {
|
||||
rnd = fromBuffer(randBits(bitLength, true))
|
||||
rnd = fromBuffer(randBitsSync(bitLength, true))
|
||||
} while (!_isProbablyPrime(rnd, iterations))
|
||||
return rnd
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue