Question: I need to have a program that decrypts the cipher text from the code below. The code needs to be in python. The only function

I need to have a program that decrypts the cipher text from the code below. The code needs to be in python. The only function of this program will be to decrypt the cipher text and output the original message. Will need to retrieve the cipher text from user then convert the cipher text back to plain text.

Below is the python3 code for mentioned problem statement:

import random def primeNumberChecker(num): if num > 1: for i in range(2, num): if (num % i) == 0: return False break else: return True else: return False def gcd(a, b): while b != 0: a, b = b, a % b return a #Euclid's extended algorithm for finding the multiplicative inverse of two numbers def multiplicative_inverse(e, phi): d = 0 x1 = 0 x2 = 1 y1 = 1 temp_phi = phi while e > 0: temp1 = temp_phi // e temp2 = temp_phi - temp1 * e temp_phi = e e = temp2 x = x2 - temp1 * x1 y = d - temp1 * y1 x2 = x1 x1 = x d = y1 y1 = y if temp_phi == 1: return d + phi def generate_keypair(p, q): n = p * q # Phi is the totient of n phi = (p - 1) * (q - 1) # Choose an integer e such that e and phi(n) are coprime 1                                            

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!