Question: python code Write a program called encrypt.py that accepts the public - key n ( int ) and e ( int ) as command -

python code
Write a program called encrypt.py that accepts the public-key n (int) and e (int) as command-line arguments and a message to encrypt from standard input, encrypts each character in the message, and writes its fixed-width binary representation to standard output
~/workspace/rsa cryptosystem
$ python3 encrypt.py 35991759
CS110
000110000000010011010100001010100011001010100011001110000110010111100100
Part II (RSA Cryptosystem) Problem 8(Encryption Program)
Accept public-key n (int) and e (int) as command-line arguments
Get the number of bits per character (call it width) needed for encryption, ie, number of bits needed to encode n Accept message to encrypt from standard input
For each character c in message
- Use the built-in function ord() to turn c into an integer x - Encrypt x
- Write the encrypted value as a width-long binary string
Write a newline character

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 Programming Questions!