Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

Students also viewed these Databases questions

Question

=+1.3(b), show that a trifling set is nowhere dense [A15].

Answered: 1 week ago