Problem 3. (Encryption Program) 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. 'A tuple is like a list, but is immutable. You create a tuple by enclosing comma-separated values within matched parentheses, eg, a = (1, 2, 3). If a is a tuple, a[i] is the ith element in it. 5 / 7 Project 4 (RSA Cryptosystem) >- "/workspace/project4 $ python3 encrypt.py 3599 1759 Cs110 000110000000010011010100001010100011001010100011001110000110010111100100 Directions: • 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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.2: While Loops
Problem 9E
icon
Related questions
Question
Problem 3. (Encryption Program) 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.
'A tuple is like a list, but is immutable. You create a tuple by enclosing comma-separated values within matched parentheses, eg, a = (1, 2, 3).
If a is a tuple, a[i] is the ith element in it.
5 / 7
Project 4 (RSA Cryptosystem)
>- "/workspace/project4
$ python3 encrypt.py 3599 1759
Cs110
<ctrl-d>
000110000000010011010100001010100011001010100011001110000110010111100100
Directions:
• 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.
Transcribed Image Text:Problem 3. (Encryption Program) 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. 'A tuple is like a list, but is immutable. You create a tuple by enclosing comma-separated values within matched parentheses, eg, a = (1, 2, 3). If a is a tuple, a[i] is the ith element in it. 5 / 7 Project 4 (RSA Cryptosystem) >- "/workspace/project4 $ python3 encrypt.py 3599 1759 Cs110 <ctrl-d> 000110000000010011010100001010100011001010100011001110000110010111100100 Directions: • 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr