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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education