// ============================================================ // // randomPrime.h // // Copyright 2002, Dennis Meilicke and Rene Peralta // // ============================================================ // // Description: // // NTTL Implementation of: // RandomPrime // // ============================================================ #ifndef __nttl_randomPrime__ #define __nttl_randomPrime__ #include #include template void RandomPrime( T *prime, size_t digits, size_t security ) { nttlTraits t; while (1) { *prime = t.Random( digits ); // // Make the number odd. This increases the // change the the number is prime. // //cout << "gen number is " << endl; //cout << *prime << endl; //cout << "after oddify " << endl; *prime |= 1; //cout << *prime << endl; if( IsPrime( *prime, security ) ) break; } } template void RandomPrime( T *prime, size_t digits ) { RandomPrime( prime, digits, (size_t)20 ); } #endif