#x^2-y^2=4 where (x,y) on the Pell Conic corresponds to ((x-y)/2,(x+y)/2) #when we mod by an odd N. #We can then use the ideas of the typical RSA Encryption to encrypt #a point on a Pell Conic and use knowledge of the conic and of the #prime factorization of N=pq to find a private key quickly via the #Chinese Remainder Theorem. This is what this program does #Setup: Specify the discriminant of the Pell Conic. Specify N=pq, #N is public and p,q are private. Choose a code ie an integer #e to encode the points. Use the Chinese Remainder Theoerem to #find the inverse k of e for this curve. print('--Initialize the Curve--') print('-The curve will be the Pell Conic x^2-dy^2=4 mod N=pq') d = MLib.fund_disc(int(input('Input the Discriminant d:'))) p = int(input('Input the first prime factor of N: ')) while MLib.isprime(p)==0: p = int(input('That was not prime, please input a prime: ')) q = int(input('Input the second prime factor of N: ')) while MLib.isprime(q)==0: q = int(input('That was not prime, please input a prime: ')) while p==q: q = int(input('That number will not work, try another: ')) N=p*q