Exemplo n.º 1
0
     print("[f] Calculate entropy") 
     print("[g] Perform a shift")
     print("[h] Decrypt RSA with primes")
     print("[i] Decrypt RSA without primes")
     print("[x] Exit\n>>> ")
     answer = raw_input()
 
     if answer == 'a':
         Modular_Exponent()
     elif answer == 'b':
         n = int(raw_input("What number do you want to factor: "))
         print(Crypto.factorize(n))
     elif answer == 'c':
         totient()
     elif answer == 'd':
         x = int(raw_input("Enter your first number: "))
         y = int(raw_input("Enter your second number: "))
         print("The gcd is: " + str(Crypto.egcd(x,y)[0]))
     elif answer == 'e':
         x = int(raw_input("Enter your number: "))
         y = int(raw_input("Enter your mod: "))
         print("The inverse is: " + str(Crypto.modinv(x,y)))
     elif answer == 'f':
         Crypto.entropy()
     elif answer == 'g':
         Crypto.shift()
     elif answer == 'h':
         RSA.decryptRSA()
     elif answer == 'i':
         RSA.decryptRSAPrimes()