Question: Let us implement a simple python program to show us how the public-key algorithm called RSA works. To generate the two keys, choose two random

 Let us implement a simple python program to show us how

Let us implement a simple python program to show us how the public-key algorithm called RSA works. To generate the two keys, choose two random large prime numbers p and q. For simplicity of calculation in our lab, let's assume small prime numbers such as p = 3 q = 7 Then calculate: n = p * q And calculate: phi (n) = (p - 1)(q - 1) Let's assume your public key is made of these two numbers: Public key = [e, n] Private keys = [d, n] Where: e = 11 d = 23 Assume your plaintext is: "Bluebonnets are beautiful!". Convert each letter of your plaintext (using parts of your program from Lab1 and Lab2) to a number m_i. You may use the functions ord() to find the ASCII number. For each number m_i, encrypt it by doing the following: c_i = E_PUB(m_i) - (m_i^e) modulus n Print the final ciphertext C = [C_0, C_1, C_2, ... C_n] (Suppose this is the ciphertext you need to send) Then, decrypt your ciphertext C by doing the following for each number c_i D_PRIV (c_i) = (c_i^d) modulus n This should give you back m_i and you can use chr() function to recover the character. Now with mi you can find which letter it corresponds to. Did you find 'Bluebonnets are beautiful!'? Repeat the encryption of the sentence above using p = 47, q = 71, e = 79 and d = 1019. Show the ciphertext and recovered message

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!