2021-08-06 08:10:32 +00:00
import { bitLength , eGcd , modInv , modPow , toZn } from 'bigint-mod-arith' ;
export { abs , bitLength , eGcd , gcd , lcm , max , min , modInv , modPow , toZn } from 'bigint-mod-arith' ;
2021-04-21 09:14:04 +00:00
function fromBuffer ( buf ) {
let ret = 0 n ;
for ( const i of buf . values ( ) ) {
const bi = BigInt ( i ) ;
ret = ( ret << 8 n ) + bi ;
}
return ret ;
}
/ * *
* 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
*
* @ throws { RangeError }
* byteLength MUST be > 0
*
* @ returns A promise that resolves to a UInt8Array / Buffer ( Browser / Node . js ) filled with cryptographically secure random bytes
* /
function randBytes ( byteLength , forceLength = false ) {
if ( byteLength < 1 )
throw new RangeError ( 'byteLength MUST be > 0' ) ;
return new Promise ( function ( resolve , reject ) {
{ // browser
const buf = new Uint8Array ( byteLength ) ;
self . crypto . getRandomValues ( buf ) ;
// If fixed length is required we put the first bit to 1 -> to get the necessary bitLength
if ( forceLength )
buf [ 0 ] = buf [ 0 ] | 128 ;
resolve ( buf ) ;
}
} ) ;
}
/ * *
* Secure random bytes for both node and browsers . Node version uses crypto . randomFill ( ) 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
*
* @ throws { RangeError }
* byteLength MUST be > 0
*
* @ returns A UInt8Array / Buffer ( Browser / Node . js ) filled with cryptographically secure random bytes
* /
function randBytesSync ( byteLength , forceLength = false ) {
if ( byteLength < 1 )
throw new RangeError ( 'byteLength MUST be > 0' ) ;
/* eslint-disable no-lone-blocks */
{ // browser
const buf = new Uint8Array ( byteLength ) ;
self . crypto . getRandomValues ( buf ) ;
// If fixed length is required we put the first bit to 1 -> to get the necessary bitLength
if ( forceLength )
buf [ 0 ] = buf [ 0 ] | 128 ;
return buf ;
}
/* eslint-enable no-lone-blocks */
}
/ * *
* 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
*
* @ throws { RangeError }
* bitLength MUST be > 0
*
* @ returns A Promise that resolves to a UInt8Array / Buffer ( Browser / Node . js ) filled with cryptographically secure random bits
* /
function randBits ( bitLength , forceLength = false ) {
if ( bitLength < 1 )
throw new RangeError ( 'bitLength MUST be > 0' ) ;
const byteLength = Math . ceil ( bitLength / 8 ) ;
const bitLengthMod8 = bitLength % 8 ;
return new Promise ( ( resolve , reject ) => {
randBytes ( byteLength , false ) . then ( function ( rndBytes ) {
if ( bitLengthMod8 !== 0 ) {
// Fill with 0's the extra bits
rndBytes [ 0 ] = rndBytes [ 0 ] & ( 2 * * bitLengthMod8 - 1 ) ;
}
if ( forceLength ) {
const mask = ( bitLengthMod8 !== 0 ) ? 2 * * ( bitLengthMod8 - 1 ) : 128 ;
rndBytes [ 0 ] = rndBytes [ 0 ] | mask ;
}
resolve ( rndBytes ) ;
} ) ;
} ) ;
}
/ * *
* 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
*
* @ throws { RangeError }
* bitLength MUST be > 0
*
* @ returns A Uint8Array / Buffer ( Browser / Node . js ) filled with cryptographically secure random bits
* /
function randBitsSync ( bitLength , forceLength = false ) {
if ( bitLength < 1 )
throw new RangeError ( 'bitLength MUST be > 0' ) ;
const byteLength = Math . ceil ( bitLength / 8 ) ;
const rndBytes = randBytesSync ( byteLength , false ) ;
const bitLengthMod8 = bitLength % 8 ;
if ( bitLengthMod8 !== 0 ) {
// Fill with 0's the extra bits
rndBytes [ 0 ] = rndBytes [ 0 ] & ( 2 * * bitLengthMod8 - 1 ) ;
}
if ( forceLength ) {
const mask = ( bitLengthMod8 !== 0 ) ? 2 * * ( bitLengthMod8 - 1 ) : 128 ;
rndBytes [ 0 ] = rndBytes [ 0 ] | mask ;
}
return rndBytes ;
}
/ * *
* Returns a cryptographically secure random integer between [ min , max ] . Both numbers must be >= 0
* @ param max Returned value will be <= max
* @ param min Returned value will be >= min
*
* @ throws { RangeError }
* Arguments MUST be : max > 0 && min >= 0 && max > min
*
* @ returns A cryptographically secure random bigint between [ min , max ]
* /
function randBetween ( max , min = 1 n ) {
if ( max <= 0 n || min < 0 n || max <= min )
throw new RangeError ( 'Arguments MUST be: max > 0 && min >=0 && max > min' ) ;
const interval = max - min ;
const bitLen = bitLength ( interval ) ;
let rnd ;
do {
const buf = randBitsSync ( bitLen ) ;
rnd = fromBuffer ( buf ) ;
} while ( rnd > interval ) ;
return rnd + min ;
}
function _workerUrl ( workerCode ) {
workerCode = ` (() => { ${ workerCode } })() ` ; // encapsulate IIFE
const _blob = new Blob ( [ workerCode ] , { type : 'text/javascript' } ) ;
return window . URL . createObjectURL ( _blob ) ;
}
let _useWorkers = false ; // The following is just to check whether we can use workers
/* eslint-disable no-lone-blocks */
{ // Native JS
if ( self . Worker !== undefined )
_useWorkers = true ;
}
/ * *
* The test first tries if any of the first 250 small primes are a factor of the input number and then passes several
* 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 disableWorkers - Disable the use of workers for the primality test
*
* @ throws { RangeError }
* w MUST be >= 0
*
* @ returns A promise that resolves to a boolean that is either true ( a probably prime number ) or false ( definitely composite )
* /
function isProbablyPrime ( w , iterations = 16 , disableWorkers = false ) {
if ( typeof w === 'number' ) {
w = BigInt ( w ) ;
}
if ( w < 0 n )
throw RangeError ( 'w MUST be >= 0' ) ;
{ // browser
return new Promise ( ( resolve , reject ) => {
const worker = new Worker ( _isProbablyPrimeWorkerUrl ( ) ) ;
worker . onmessage = ( event ) => {
worker . terminate ( ) ;
resolve ( event . data . isPrime ) ;
} ;
worker . onmessageerror = ( event ) => {
reject ( event ) ;
} ;
const msg = {
rnd : w ,
iterations : iterations ,
id : 0
} ;
worker . postMessage ( msg ) ;
} ) ;
}
}
function _isProbablyPrime ( w , iterations ) {
/ *
PREFILTERING . Even values but 2 are not primes , so don ' t test .
1 is not a prime and the M - R algorithm needs w > 1.
* /
if ( w === 2 n )
return true ;
else if ( ( w & 1 n ) === 0 n || w === 1 n )
return false ;
/ *
Test if any of the first 250 small primes are a factor of w . 2 is not tested because it was already tested above .
* /
const firstPrimes = [
3 n ,
5 n ,
7 n ,
11 n ,
13 n ,
17 n ,
19 n ,
23 n ,
29 n ,
31 n ,
37 n ,
41 n ,
43 n ,
47 n ,
53 n ,
59 n ,
61 n ,
67 n ,
71 n ,
73 n ,
79 n ,
83 n ,
89 n ,
97 n ,
101 n ,
103 n ,
107 n ,
109 n ,
113 n ,
127 n ,
131 n ,
137 n ,
139 n ,
149 n ,
151 n ,
157 n ,
163 n ,
167 n ,
173 n ,
179 n ,
181 n ,
191 n ,
193 n ,
197 n ,
199 n ,
211 n ,
223 n ,
227 n ,
229 n ,
233 n ,
239 n ,
241 n ,
251 n ,
257 n ,
263 n ,
269 n ,
271 n ,
277 n ,
281 n ,
283 n ,
293 n ,
307 n ,
311 n ,
313 n ,
317 n ,
331 n ,
337 n ,
347 n ,
349 n ,
353 n ,
359 n ,
367 n ,
373 n ,
379 n ,
383 n ,
389 n ,
397 n ,
401 n ,
409 n ,
419 n ,
421 n ,
431 n ,
433 n ,
439 n ,
443 n ,
449 n ,
457 n ,
461 n ,
463 n ,
467 n ,
479 n ,
487 n ,
491 n ,
499 n ,
503 n ,
509 n ,
521 n ,
523 n ,
541 n ,
547 n ,
557 n ,
563 n ,
569 n ,
571 n ,
577 n ,
587 n ,
593 n ,
599 n ,
601 n ,
607 n ,
613 n ,
617 n ,
619 n ,
631 n ,
641 n ,
643 n ,
647 n ,
653 n ,
659 n ,
661 n ,
673 n ,
677 n ,
683 n ,
691 n ,
701 n ,
709 n ,
719 n ,
727 n ,
733 n ,
739 n ,
743 n ,
751 n ,
757 n ,
761 n ,
769 n ,
773 n ,
787 n ,
797 n ,
809 n ,
811 n ,
821 n ,
823 n ,
827 n ,
829 n ,
839 n ,
853 n ,
857 n ,
859 n ,
863 n ,
877 n ,
881 n ,
883 n ,
887 n ,
907 n ,
911 n ,
919 n ,
929 n ,
937 n ,
941 n ,
947 n ,
953 n ,
967 n ,
971 n ,
977 n ,
983 n ,
991 n ,
997 n ,
1009 n ,
1013 n ,
1019 n ,
1021 n ,
1031 n ,
1033 n ,
1039 n ,
1049 n ,
1051 n ,
1061 n ,
1063 n ,
1069 n ,
1087 n ,
1091 n ,
1093 n ,
1097 n ,
1103 n ,
1109 n ,
1117 n ,
1123 n ,
1129 n ,
1151 n ,
1153 n ,
1163 n ,
1171 n ,
1181 n ,
1187 n ,
1193 n ,
1201 n ,
1213 n ,
1217 n ,
1223 n ,
1229 n ,
1231 n ,
1237 n ,
1249 n ,
1259 n ,
1277 n ,
1279 n ,
1283 n ,
1289 n ,
1291 n ,
1297 n ,
1301 n ,
1303 n ,
1307 n ,
1319 n ,
1321 n ,
1327 n ,
1361 n ,
1367 n ,
1373 n ,
1381 n ,
1399 n ,
1409 n ,
1423 n ,
1427 n ,
1429 n ,
1433 n ,
1439 n ,
1447 n ,
1451 n ,
1453 n ,
1459 n ,
1471 n ,
1481 n ,
1483 n ,
1487 n ,
1489 n ,
1493 n ,
1499 n ,
1511 n ,
1523 n ,
1531 n ,
1543 n ,
1549 n ,
1553 n ,
1559 n ,
1567 n ,
1571 n ,
1579 n ,
1583 n ,
1597 n
] ;
for ( let i = 0 ; i < firstPrimes . length && ( firstPrimes [ i ] <= w ) ; i ++ ) {
const p = firstPrimes [ i ] ;
if ( w === p )
return true ;
else if ( w % p === 0 n )
return false ;
}
/ *
1. Let a be the largest integer such that 2 * * a divides w − 1.
2. m = ( w − 1 ) / 2 * * a .
3. wlen = len ( w ) .
4. For i = 1 to iterations do
4.1 Obtain a string b of wlen bits from an RBG .
Comment : Ensure that 1 < b < w − 1.
4.2 If ( ( b ≤ 1 ) or ( b ≥ w − 1 ) ) , then go to step 4.1 .
4.3 z = b * * m mod w .
4.4 If ( ( z = 1 ) or ( z = w − 1 ) ) , then go to step 4.7 .
4.5 For j = 1 to a − 1 do .
4.5 . 1 z = z * * 2 mod w .
4.5 . 2 If ( z = w − 1 ) , then go to step 4.7 .
4.5 . 3 If ( z = 1 ) , then go to step 4.6 .
4.6 Return COMPOSITE .
4.7 Continue .
Comment : Increment i for the do - loop in step 4.
5. Return PROBABLY PRIME .
* /
let a = 0 n ;
const d = w - 1 n ;
let aux = d ;
while ( aux % 2 n === 0 n ) {
aux /= 2 n ;
++ a ;
}
const m = d / ( 2 n * * a ) ;
do {
const b = randBetween ( d , 2 n ) ;
let z = modPow ( b , m , w ) ;
if ( z === 1 n || z === d )
continue ;
let j = 1 ;
while ( j < a ) {
z = modPow ( z , 2 n , w ) ;
if ( z === d )
break ;
if ( z === 1 n )
return false ;
j ++ ;
}
if ( z !== d )
return false ;
} while ( -- iterations !== 0 ) ;
return true ;
}
function _isProbablyPrimeWorkerUrl ( ) {
// Let's us first add all the required functions
let workerCode = ` 'use strict';const ${ eGcd . name } = ${ eGcd . toString ( ) } ;const ${ modInv . name } = ${ modInv . toString ( ) } ;const ${ modPow . name } = ${ modPow . toString ( ) } ;const ${ toZn . name } = ${ toZn . toString ( ) } ;const ${ randBitsSync . name } = ${ randBitsSync . toString ( ) } ;const ${ randBytesSync . name } = ${ randBytesSync . toString ( ) } ;const ${ randBetween . name } = ${ randBetween . toString ( ) } ;const ${ isProbablyPrime . name } = ${ _isProbablyPrime . toString ( ) } ; ${ bitLength . toString ( ) } ; ${ fromBuffer . toString ( ) } ; ` ;
2021-08-06 07:14:18 +00:00
workerCode += ` onmessage=async function(_e){const _m={isPrime:await ${ isProbablyPrime . name } (_e.data.rnd,_e.data.iterations),value:_e.data.rnd,id:_e.data.id};postMessage(_m);} ` ;
2021-04-21 09:14:04 +00:00
return _workerUrl ( workerCode ) ;
}
/ * *
* 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
* 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 ) .
*
* @ 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
*
* @ returns A promise that resolves to a bigint probable prime of bitLength bits .
* /
function prime ( bitLength , iterations = 16 ) {
if ( bitLength < 1 )
throw new RangeError ( 'bitLength MUST be > 0' ) ;
/* istanbul ignore if */
if ( ! _useWorkers ) { // If there is no support for workers
let rnd = 0 n ;
do {
rnd = fromBuffer ( randBitsSync ( bitLength , true ) ) ;
} while ( ! _isProbablyPrime ( rnd , iterations ) ) ;
return new Promise ( ( resolve ) => { resolve ( rnd ) ; } ) ;
}
return new Promise ( ( resolve , reject ) => {
const workerList = [ ] ;
const _onmessage = ( msg , newWorker ) => {
if ( msg . isPrime ) {
// if a prime number has been found, stop all the workers, and return it
for ( let j = 0 ; j < workerList . length ; j ++ ) {
workerList [ j ] . terminate ( ) ;
}
while ( workerList . length > 0 ) {
workerList . pop ( ) ;
}
resolve ( msg . value ) ;
}
else { // if a composite is found, make the worker test another random number
const buf = randBitsSync ( bitLength , true ) ;
const rnd = fromBuffer ( buf ) ;
try {
const msgToWorker = {
rnd : rnd ,
iterations : iterations ,
id : msg . id
} ;
newWorker . postMessage ( msgToWorker ) ;
}
catch ( error ) {
// The worker has already terminated. There is nothing to handle here
}
}
} ;
{ // browser
const workerURL = _isProbablyPrimeWorkerUrl ( ) ;
for ( let i = 0 ; i < self . navigator . hardwareConcurrency - 1 ; i ++ ) {
const newWorker = new Worker ( workerURL ) ;
newWorker . onmessage = ( event ) => _onmessage ( event . data , newWorker ) ;
workerList . push ( newWorker ) ;
}
}
for ( let i = 0 ; i < workerList . length ; i ++ ) {
randBits ( bitLength , true ) . then ( function ( buf ) {
const rnd = fromBuffer ( buf ) ;
workerList [ i ] . postMessage ( {
rnd : rnd ,
iterations : iterations ,
id : i
} ) ;
} ) . catch ( reject ) ;
}
} ) ;
}
/ * *
* A probably - prime ( Miller - Rabin ) , cryptographically - secure , random - number generator .
* The sync version is NOT RECOMMENDED since it won 't use workers and thus it' ll be slower and may freeze thw window in browser ' s javascript . Please consider using prime ( ) instead .
*
* @ 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
*
* @ returns A bigint probable prime of bitLength bits .
* /
function primeSync ( bitLength , iterations = 16 ) {
if ( bitLength < 1 )
throw new RangeError ( 'bitLength MUST be > 0' ) ;
let rnd = 0 n ;
do {
rnd = fromBuffer ( randBitsSync ( bitLength , true ) ) ;
} while ( ! _isProbablyPrime ( rnd , iterations ) ) ;
return rnd ;
}
2021-08-06 08:10:32 +00:00
export { isProbablyPrime , prime , primeSync , randBetween , randBits , randBitsSync , randBytes , randBytesSync } ;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguYnJvd3Nlci5qcyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3RzL2Zyb21CdWZmZXIudHMiLCIuLi8uLi9zcmMvdHMvcmFuZEJ5dGVzLnRzIiwiLi4vLi4vc3JjL3RzL3JhbmRCaXRzLnRzIiwiLi4vLi4vc3JjL3RzL3JhbmRCZXR3ZWVuLnRzIiwiLi4vLi4vc3JjL3RzL3dvcmtlclV0aWxzLnRzIiwiLi4vLi4vc3JjL3RzL2lzUHJvYmFibHlQcmltZS50c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