Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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=47q=71 Then calculate: n=pq And calculate: (n)=(p1)(q1) Let's assume your public key is made of these two numbers: Public key =[e,n] Private key =[d,n] where e=97 and d=1693. Assume your plaintext is: "College Station". Convert each letter of your plaintext to a number mi. You may use the functions ord 0 to find the ASCII number. For each number mi, encrypt it by doing the following: ci=EPUB(mi)=(mie)modulusn Print the final ciphertext C=[c0,c1,c2,,cn] (You can print a list of ASCII values, not the character) Then, decrypt your ciphertext C by doing the following for each number ci : DPRIV(ci)=(cid)modulusn This should give you back mi and you can use chr( function to recover the character. Now with mi you can find which letter it corresponds to
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started