[Mono-bugs] [Bug 81857][Nor] New - BigInteger.IsProbablePrime() fails on some primes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jun 11 14:10:08 EDT 2007

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi at ximian.com.


--- shadow/81857	2007-06-11 14:10:08.000000000 -0400
+++ shadow/81857.tmp.24551	2007-06-11 14:10:08.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 81857
+Product: Mono: Class Libraries
+Version: 1.0
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: Mono.Security
+AssignedTo: sebastien at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: BigInteger.IsProbablePrime() fails on some primes
+Kazuki found some BigInteger issues:
+1) new BigInteger (5987).IsProbablePrime() returns false.
+2) new BigInteger (65537).IsProbablePrime() causes IndexOutOfRangeException.
+  http://primes.utm.edu/lists/small/10000.txt
+3) new BigInteger (5915587277).IsProbablePrime() returns false
+  http://primes.utm.edu/lists/small/small.html
+for 65537, the exception stack is:
+MonoTests.Mono.Math.BigIntegerTest.IsProbablePrime2 :
+System.IndexOutOfRangeException : Array index is out of range.
+  at Mono.Math.BigInteger.TestBit (UInt32 bitNum) [0x00011] in
+  at Mono.Math.BigInteger+ModulusRing.OddPow (UInt32 b,
+Mono.Math.BigInteger exp) [0x00071] in
+  at Mono.Math.BigInteger+ModulusRing.Pow (UInt32 b, Mono.Math.BigInteger
+exp) [0x00015] in
+  at Mono.Math.Prime.PrimalityTests.RabinMillerTest (Mono.Math.BigInteger
+bi, ConfidenceFactor confidence) [0x00037] in
+  at Mono.Math.BigInteger.IsProbablePrime () [0x0007c] in
+  at MonoTests.Mono.Math.BigIntegerTest.IsProbablePrime2 () [0x00000] in
+Additional Information:
+Kazuki has a fix for 5987, attached.
+He also doubt on OddPow() implementation for the other two cases.

More information about the mono-bugs mailing list