This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Algorithm used by BigInteger prime generator?


> From: Alexandre Oliva <oliva@dcc.unicamp.br>
> Date: 22 Apr 1999 11:55:44 -0300
> 
> On Apr 22, 1999, Andrew Haley <aph@pasanda.cygnus.co.uk> wrote:
> 
> > The technique of simply adding 2 until a prime is reached is pretty
> > much standard in crypto, and with crypto-sized BigIntegers the
> > deviation from a uniform distribution is insignificantly small.
> 
> But we're not talking about crypto-sized BigIntegers, we're talking
> about the BigInteger class.  It's supposed to be general-purpose, not
> exclusive for use for cryptography.

I think that's the heart of this disagreement.  I think that
BigInteger is a crypto library in disguise, intended so that Java may
be used for Internet commerce.  I think that's why the exact method
for generating random primes isn't exactly specified, so that
implementors may do the most efficient thing.  I accept that's not
what the standard actually says.  ;-)

> assuming that isProbablePrime takes constant time for a constant
> bitLength.

Mm.  It would be a very bad implementation of isProbablePrime that
took constant time for a constant bitLength.

Andrew.