Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- From: Le Chaud Lapin <jaibuduvin@xxxxxxxxx>
- Date: Thu, 29 May 2008 11:21:07 -0700 (PDT)
On May 29, 6:32 am, Ertugrul Söylemez <e...@xxxxxxxx> wrote:
Le Chaud Lapin <jaibudu...@xxxxxxxxx> wrote:
What are the prevaling recommendations for choosing p, q, such that
the product is indeed, say, 512 bits, for a 512-bit modulus.
Actually, an N bits long product of two primes doesn't really contain N
bits of entropy. Since there are only pi(2^N) - pi(2^(N-1)) primes of N
bits, with Legendre's approximation, one 512 bits prime contains only
slightly more than 502.5 bits of entropy, so a 1024 bits long RSA
modulus would contain only 1005 bits of entropy.
I don't think that this entropy difference can be exploited in practice,
and honestly, I wouldn't care about it. Just follow Joseph's advice.
Yes, to generate an N bits prime, first you create a prime sieve using
the sieve of Eratosthenes or the sieve of Atkin. Then repeat the
following, until you have found enough primes: Generate a random number
less than 2^N, then set its lowest and highest bits to 1, then adjust it
according to your sieve, then do a primality test.
Note that the crux of my OP, making sure that the product really does
have 512 bits, is not assured by setting only the highest-order and
lowest-order bits of p and q and hunting for primes from those bases.
It is possible that a p and q, each with 256 bits, will not generate
an n of 512 bits.
The primality test itself consists of trial division by the first few
thousand primes, which are not covered by the prime sieve, and if the
number still passes, then a Miller-Rabin or some other fast test is
done.
And finally AKS, heheh. :)
Some might say it is unecessary, but IMO, a function with the
following signature..
bool Big_Integer::is_prime()
should not be named as such if there is a possibility that it will
return true when false is correct.
[We still keep our ::is_probably_prime (unsigned int)]
-Le Chaud Lapin-
.
- Follow-Ups:
- Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- From: Ertugrul Söylemez
- Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- References:
- Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- From: Le Chaud Lapin
- Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- From: Ertugrul Söylemez
- Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- Prev by Date: Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- Next by Date: Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- Previous by thread: Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- Next by thread: Re: Algorithm For Ensuring p & q Sufficiently Large For n in RSA
- Index(es):
Relevant Pages
|