Author: spouliot
Date: 2007-07-05 11:22:51 -0400 (Thu, 05 Jul 2007)
New Revision: 81399
Modified:
trunk/mcs/class/Mono.Security/Mono.Math/BigInteger.cs
trunk/mcs/class/Mono.Security/Mono.Math/ChangeLog
Log:
2007-07-05 Sebastien Pouliot <[EMAIL PROTECTED]>
* BigInteger.cs: Call PrimalityTests.Test instead of the Rabin-Miller
test. This will select the best algorithm to use based on the prime
candidate. Applied #69999 optimization (even if this code is commented
right now) so this old issue can be closed.
Modified: trunk/mcs/class/Mono.Security/Mono.Math/BigInteger.cs
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Math/BigInteger.cs 2007-07-05
15:21:01 UTC (rev 81398)
+++ trunk/mcs/class/Mono.Security/Mono.Math/BigInteger.cs 2007-07-05
15:22:51 UTC (rev 81399)
@@ -909,8 +909,8 @@
if (this % smallPrimes[p] == 0)
return false;
}
- // the last step is to confirm the "large" prime with
the Miller-Rabin test
- return PrimalityTests.RabinMillerTest (this,
Prime.ConfidenceFactor.Medium);
+ // the last step is to confirm the "large" prime with
the SPP or Miller-Rabin test
+ return PrimalityTests.Test (this,
Prime.ConfidenceFactor.Medium);
}
#endregion
@@ -1162,8 +1162,11 @@
Montgomery.Reduce (resultNum,
mod, mPrime);
}
- Kernel.SquarePositive (tempNum, ref
wkspace);
- Montgomery.Reduce (tempNum, mod,
mPrime);
+ // the value of tempNum is required in
the last loop
+ if (pos < totalBits - 1) {
+ Kernel.SquarePositive (tempNum,
ref wkspace);
+ Montgomery.Reduce (tempNum,
mod, mPrime);
+ }
}
Montgomery.Reduce (resultNum, mod, mPrime);
Modified: trunk/mcs/class/Mono.Security/Mono.Math/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Math/ChangeLog 2007-07-05 15:21:01 UTC
(rev 81398)
+++ trunk/mcs/class/Mono.Security/Mono.Math/ChangeLog 2007-07-05 15:22:51 UTC
(rev 81399)
@@ -1,3 +1,10 @@
+2007-07-05 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * BigInteger.cs: Call PrimalityTests.Test instead of the Rabin-Miller
+ test. This will select the best algorithm to use based on the prime
+ candidate. Applied #69999 optimization (even if this code is commented
+ right now) so this old issue can be closed.
+
2007-07-05 Sebastien Pouliot <[EMAIL PROTECTED]>
* BigInteger.cs: Reduce modulo steps in Multiply. Add #if/#else around
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches