src/vendor/leemon.js
function randProbPrime(k) {
  if (k>=600) return randProbPrimeRounds(k, 2); //numbers from HAC table 4.3
  if (k>=550) return randProbPrimeRounds(k, 4);
  if (k>=500) return randProbPrimeRounds(k, 5);
  if (k>=400) return randProbPrimeRounds(k, 6);
  if (k>=350) return randProbPrimeRounds(k, 7);
  if (k>=300) return randProbPrimeRounds(k, 9);
  if (k>=250) return randProbPrimeRounds(k, 12); //numbers from HAC table 4.4
  if (k>=200) return randProbPrimeRounds(k, 15);
  if (k>=150) return randProbPrimeRounds(k, 18);
  if (k>=100) return randProbPrimeRounds(k, 27);
              return randProbPrimeRounds(k, 40); //number from HAC remark 4.26 (only an estimate)
}
function randProbPrime(k) {
  if (k>=600) return randProbPrimeRounds(k, 2); //numbers from HAC table 4.3
  if (k>=550) return randProbPrimeRounds(k, 4);
  if (k>=500) return randProbPrimeRounds(k, 5);
  if (k>=400) return randProbPrimeRounds(k, 6);
  if (k>=350) return randProbPrimeRounds(k, 7);
  if (k>=300) return randProbPrimeRounds(k, 9);
  if (k>=250) return randProbPrimeRounds(k, 12); //numbers from HAC table 4.4
  if (k>=200) return randProbPrimeRounds(k, 15);
  if (k>=150) return randProbPrimeRounds(k, 18);
  if (k>=100) return randProbPrimeRounds(k, 27);
              return randProbPrimeRounds(k, 40); //number from HAC remark 4.26 (only an estimate)
}
function randProbPrime ( k ) { if ( k >= 600 ) return randProbPrimeRounds ( k , 2 ) ; //numbers from HAC table 4.3 if ( k >= 550 ) return randProbPrimeRounds ( k , 4 ) ; if ( k >= 500 ) return randProbPrimeRounds ( k , 5 ) ; if ( k >= 400 ) return randProbPrimeRounds ( k , 6 ) ; if ( k >= 350 ) return randProbPrimeRounds ( k , 7 ) ; if ( k >= 300 ) return randProbPrimeRounds ( k , 9 ) ; if ( k >= 250 ) return randProbPrimeRounds ( k , 12 ) ; //numbers from HAC table 4.4 if ( k >= 200 ) return randProbPrimeRounds ( k , 15 ) ; if ( k >= 150 ) return randProbPrimeRounds ( k , 18 ) ; if ( k >= 100 ) return randProbPrimeRounds ( k , 27 ) ; return randProbPrimeRounds ( k , 40 ) ; //number from HAC remark 4.26 (only an estimate) }
return a k-bit random probable prime with probability of error < 2^-80
return a k - bit random probable prime with probability of error < 2^ - 80