I am posting this more generically in the software development section to see what might be available and to increase a possible success rate. But enough of that let's get to the question at hand.
Recently, in C#, I started back up a project of mine to do RSA encryption. Part of what makes an RSA cipher successful is the production of large, random numbers, that are prime. For my project, I am using a library that uses random.org to seed a random number generator, and then producing VERY large values that must be stored in BigIntegers (for those who are unfamiliar with these, they pretty much, at least from what I can tell, can hold a number of what ever size you want ... I think they emulate the value from like a byte array).
Anyway, as you saw I said these are "Prime" random numbers. While I have the formula that can create the keys fine, the problem that kills it is it takes me forever to determine if these large random numbers are prime.
So I ask this question, what can I do to speed up the code to produce large random numbers that I know are prime, or what examples do you have? I have done the usual for loop and performing a modulo to see if the remainder is 0, but with numbers this large it's really slow (and by that I think I once forgot it was running and had it going and like 30-60 mins later, the first random number still wasn't found). I am not looking for a C# specific answer, more like pseudo code you might say, or processes
(On a side note, yes I know C# does have a built in RSA library but I hate it. The p and q values produced are too small, and I have no clue how its random engine works, or what it uses. I also hate how it expects the keys, with all the what should be concealed values being flaunted in the object).