/* * Program to generate "trap-door primes". * Generates primes for use with "index" program * * Hard to find factors of the product of two of them n=p.q * - but easy to find discrete logs wrt p & q * See "Non-Interactive Public-Key Cryptography", Maurer & Yacobi * Eurocrypt '91 * * Requires: big.cpp crt.cpp * */ #include #include #include #include "big.h" /* include MIRACL system */ #define NPRIMES 5 /* =9 for > 256 bit primes */ #define PROOT 2 using namespace std; Miracl precision=100; int main() { /* program to find a trap-door prime */ BOOL found; int i,spins; long seed; Big pp[NPRIMES],q,p,t; ofstream prime_data("prime.dat"); cout << "Enter 9 digit seed= "; cin >> seed; irand(seed); cout << "Enter 4 digit seed= "; cin >> spins; for (i=0;i