Cryptography, Cybersecurity.
{2}".format(g,p,issafe(g,p))) print ("x\tg^x\tg^x (mod p)") for x in range(0,10): print ("{0}\t{1}\t{2}".format(x,pow(g,x),pow(g,x,p))) A sample run with an unsafe value is: Is g=3 safe for p=13? False x g^x g^x (mod p) 0 1 1 1 3 3 2 9 9 3 27 1 4 81 3 5 243 9 6 729 1 7 2187 3 8 6561 9 9 19683 1 and