Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with python thanks! Finish implementing the code in practiceRSA.py and make sure you can encrypt and decrypt data. Encrypt a message with both
Need help with python thanks!
Finish implementing the code in practiceRSA.py and make sure you can encrypt and decrypt data. Encrypt a
message with both your pubic and private keys. Code for encrypting with a public key is given, do not forget to
provide code for private encryption. Include a screen shot of the output in your write up
Part :
Given my public keyne decrypt the cipher text C represented as an integer created with my public key :
C
public key
Make a separate python file to calculate your solution to part Explain what you did and how you cracked the public key
python code
cip#usrbinpython
from prime import
import math
def main:
public,private makekeyintsysargv
#public key ne
printfpublic key is publicpublic
#private key nd
printfprivate key is privateprivate
#message to encrypt
msg b'test,message'
print msg
printintfrombytesmsg
#cipher with public key
x ciphermsgpublicpublic
printx
#decipher with private key
y dcipherx private private
printytobyteslenmsg
def ciphermen:
i int.frombytesm
return powien
def dciphercdn:
#FINISH THIS FUNCTION
FINISH THIS FUNCTION
You'll need a function from prime.py
def makekeybitlen:
#pick two prime numbers using bitlen
p
p
#compute n to be part of public key
n
#l lcmprimeprime
l
#choose number
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