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 publickey n int and e int as commandline arguments and a message to encrypt from standard input, encrypts each character in the message, and writes its fixedwidth binary representation to standard output
~workspacersa cryptosystem
$ python encrypt.py
CS
Part II RSA Cryptosystem Problem Encryption Program
Accept publickey n int and e int as commandline 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 builtin function ord to turn c into an integer x Encrypt x
Write the encrypted value as a widthlong binary string
Write a newline character
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
