[Mono-bugs] [Bug 70169][Nor] New - BigInteger modular exponentiation doesn't work when modulus is power of 2

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 3 Dec 2004 00:37:11 -0500 (EST)


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 pieter@mentalis.org.

http://bugzilla.ximian.com/show_bug.cgi?id=70169

--- shadow/70169	2004-12-03 00:37:11.000000000 -0500
+++ shadow/70169.tmp.5825	2004-12-03 00:37:11.000000000 -0500
@@ -0,0 +1,29 @@
+Bug#: 70169
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Mono.Security
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pieter@mentalis.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: BigInteger modular exponentiation doesn't work when modulus is power of 2
+
+The BigInteger.ModPow method throws an IndexOutOfRangeException when the 
+modulus is a power of two. The following example program illustrates the 
+problem:
+
+	BigInteger b = new BigInteger(10);
+	BigInteger e = new BigInteger(10);
+	BigInteger m = new BigInteger(32);
+	Console.WriteLine(e.ModPow(e, m));
+	Console.ReadLine();
+
+The modulus can be any 2^k (for k = 0..inf).