5 // generate a probable prime. accuracy is the miller-rabin interations
7 genprime(mpint *p, int n, int accuracy)
11 // generate n random bits with high and low bits set
13 genrandom((uchar*)p->p, (n+7)/8);
14 p->top = (n+Dbits-1)/Dbits;
17 p->p[p->top-1] &= (x-1);
21 // keep icrementing till it looks prime
23 if(probably_prime(p, accuracy))