Constructing a 400 bit Prime

p=400
p=12q+1, q is a prime as well

NTL_CLIENT

int main()
{

ZZ x, y, r; // declaring variables
ZZ Gen1, Gen2;// generators
ZZ a;
ZZ prime, qual1,qual2; //generator tests
ZZ one, onen, four; // constants
ZZ f1, f2; // prime factors for a
ZZ phi;
long len; // prime length
one =1;
onen =-1;
four =4;
len =397;
a =12;
phi =2*2;
q =4;


//Program 1 (1)

cout <<"\n\n Question 1 "<<""; //Standard output stream

SetSeed(to_ZZ((unsigned long)time(NULL))); //
GenPrime(q, len, 80);
p = a*q + 1;

while(Numbits(p) > 400);// P is 400 bit prime
{
GenPrime(q, len, 80);
p = a*q + 1;
}

cout <<"\n p is "<<NumBits (p) <<bit length. \n";
cout <<"\n prime p: \n"p"<<\n";
cout <<"\n prime q: \n"q"<<\n";// p=12q+1 where q is a prime

Can this be done in a simpler way (atill in C++)

thanks


Topic archived. No new replies allowed.