On Thu, 10 Jul 2008 03:10:50 -0700 (PDT), imranisb

<im******@gmail.comwrote:

>Hi,

Im developing RSA cryptography based application in VC#.Net 2.0 and

need to use "BigInteger.probablePrime()". I know that VC#.Net 2.0

doesn't have the BigInteger class but found that one buddy created

BigInteger class but it is missing some overloading function like

BigInteger.probablePrime(). The code of the BigInteger class developed

in the C#.Net can be found here:

http://www.codeproject.com/KB/cs/biginteger.aspx

Quick suggestions are always welcome.

Thanks in advance.

If you have, or can obtain, a copy of "Practical Cryptography" by

Ferguson and Schneier they give an algorithm in section 11.4

The algorithm is basically very simple:

repeat

pick a random BigInteger in the right range

until (the number you picked is prime)

For reasonably sized numbers you will need a probabilistic prime text,

such as Miller-Rabin and some sort of level of confidence parameter so

you can be sure that your number is prime to better than say 1 in

2^128

Alternatively have a look at the Java source code for ideas, you can

download the Java source from Sun.

rossum