+2007-07-05 Sebastien Pouliot <sebastien@ximian.com>
+
+ * PrimalityTests.cs: Last attempt half-failed. For the time being we
+ need the initial workaround :(
+
2007-07-05 Sebastien Pouliot <sebastien@ximian.com>
* PrimalityTests.cs: Added Test method that select which algorithm,
public static bool Test (BigInteger n, ConfidenceFactor confidence)
{
// Rabin-Miller fails with smaller primes (at least with our BigInteger code)
- if (n.BitCount () < 100)
+ if (n.BitCount () < 33)
return SmallPrimeSppTest (n, confidence);
else
return RabinMillerTest (n, confidence);
// Applying optimization from HAC section 4.50 (base == 2)
// not a really random base but an interesting (and speedy) one
- BigInteger y = mr.Pow (2, r);
+ BigInteger y = null;
+ // FIXME - optimization disable for small primes due to bug #81857
+ if (n.BitCount () > 100)
+ y = mr.Pow (2, r);
// still here ? start at round 1 (round 0 was a == 2)
for (int round = 0; round < t; round++) {