I’m about to implement the DSA algorithm, but there is a problem:
choose “p”, a prime number with L bits, where 512 <= L <= 1024 and L is a multiple of 64
How can I implement a random generator of that number? Int64 has “only” 63 bits length.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can generate a random number with
nbits using this code:The result is, of course, random and not necessarily a prime.
The BigInteger class was introduced in the .NET 4.0 Framework.
For generating large prime numbers, Wikipedia says:
So you could do something like this: