I am planning on creating a prime number generator, my only problem is this: how am I going to keep track of the gigantic prime numbers? I want to use an array
1 2 3 4 5 6 7 8 9
srand(time(NULL));
int *key1 = newint;
int *key2 = newint;
int x = 0;
for (x=0;x<1025;x++){
key1[x] = ((int)rand())%10;
key2[x] = ((int)rand())%10;
}
but here's my other problem: how am I going to manipulate the array? Do I treat it as a matrix or something else? I am pretty sure I can't just use it as a single large number, but what am I going to do?
I need bigger numbers than that to use in any reasonable cryptography uses. it would take a minimum of 212 bit key (4096 bit) or 2 of 500 digit primes to generate a public key long enough to warrant a sufficient sense of security. I know how to generate the numbers, what I need to know is how to multiply, divide, modulus, raise, and do complex math to the numbers.
I'd recommend not reinventing the wheel and just going with a bignum library. For example: http://www.ttmath.org/ - You can use something like ttmath::UInt<TTMATH_BITS(4096)>