[19103] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

Re: Fermat's primality test vs. Miller-Rabin

daemon@ATHENA.MIT.EDU (Sidney Markowitz)
Mon Dec 5 10:10:20 2005

X-Original-To: cryptography@metzdowd.com
X-Original-To: cryptography@metzdowd.com
Date: Mon, 05 Dec 2005 15:01:42 +1300
From: Sidney Markowitz <sidney@sidney.com>
To: Joseph Ashwood <ashwood@msn.com>
Cc: cryptography@metzdowd.com
In-Reply-To: <BAY0-SMTP07FE569D399BC04F2B0C42AC4E0@phx.gbl>

Joseph Ashwood wrote:
> Granted this is only a test of the 
> generation of 128 numbers, but I got 128 primes (based on 128 MR rounds). 

That doesn't make sense, unless I'm misinterpreting what you are saying. Primes
aren't that common, are they?

I don't have time right now to look for a bug in your code, but you could add a
sanity check that would catch a bug immediately by adding in the appropriate
spot a test like

 if (!curnum.isProbablePrime(128))
   System.out.println("Something wrong, number is not really a prime!");


to check that your primality test gets the same result as the M-R primality
test that comes with BigInteger.

 -- sidney

---------------------------------------------------------------------
The Cryptography Mailing List
Unsubscribe by sending "unsubscribe cryptography" to majordomo@metzdowd.com

home help back first fref pref prev next nref lref last post