n this problem, you will mple cipner thlat, instead of dividng the text mtO ouu characters, separates it into three sets of characters. As an example, we will use this 1977 quote by Digital Equipment Corp. president Ken Olson -- "There is no reason anyone would want a computer in their home." (Spaces are represented with the square u-like character.) There is no reason anyone would want a computer in their home. Rail 1: Rail 2: T r i n e d a e i t i h e a. u a u n h r Rail 3: e a n t m. Example three-rail transposition. The resulting encrypted text is produced by reading the text horizontally, i.e., adding the three rails: Rail 1 + Rail 2 + Rail 3 = **“Trinrs yeoda cpeitihehesoeoao u naournhro.e annnwlwt mt e m" (without the quotes). Requirements: mplement the three-rail transposition cipher above, placing your code in the file p4_2.py (template provided, replace comment at the beginning of the file with your own code). Feel free to develop your code in PyCharm or the DE of your choice, then upload or paste it into Coding Rooms. Because this is our first assignment here, just as a packup, also submit your python files through the Canvas assignment for Project 4. n your p4_1.py module, define the functions main(), encrypt(msg: str) → str and decrypt(msg: str) » str. You may define other functions as you see fit, but these three must match the interface specified here. • The encrypt function should take in the original text and use the three-rail encryption approach described above, returning the encrypted string. Include docstring with doctests. • The decrypt function should assume that the msg is already encrypted as described above, and decrypt it, returning the original text. Include docstring with doctests. • The main function should prompt the user for some input, then ask whether to encrypt or decrypt it, calling the appropriate function and printing the result

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
In this problem, you will implement a transposition cipher that, instead of dividing the original text into odd and even characters, separates it into three sets of characters. As an example, we will use this 1977 quote by Digital Equipment Corp. president Ken Olson -- "There is no reason anyone would want a computer in their home." (Spaces are represented with the square u-like character.)

### Visualization of the Three-Rail Transposition:

```
       There is no reason anyone would want a computer in their home.
Rail 1: T r i n r s y e o a d a u c p e t i h e
Rail 2: h e s o e o o a o u l n u o r n h r o l
Rail 3: e u     l u a n n n w l t   t u e l     m
```

**Example three-rail transposition.**

The resulting encrypted text is produced by reading the text horizontally, i.e., adding the three rails: 

**Rail 1 + Rail 2 + Rail 3 = "Trinrsy eoad aucpet ihe hesoeoa o ul nuornhro e annnwlt mt   e m"**

### Requirements:

Implement the three-rail transposition cipher above, placing your code in the file `p4_2.py` ([template](#) provided, replace comment at the beginning of the file with your own code). Feel free to develop your code in PyCharm or the IDE of your choice, then upload or paste it into Coding Rooms. Because this is our first assignment here, just as a backup, also submit your python files through the Canvas assignment for Project 4.

In your `p4_1.py` module, define the functions `main()`, `encrypt(msg: str) -> str`, and `decrypt(msg: str) -> str`. You may define other functions as you see fit, but these three must match the interface specified here.

- **Encrypt Function:** This should take in the original text and use the three-rail encryption approach described above, returning the encrypted string. Include docstring with doctests.
- **Decrypt Function:** This should assume that the message is already encrypted as described above, and decrypt it, returning the original text. Include docstring with doctests.
- **Main Function:** This should prompt the user for some input, then ask whether to encrypt or decrypt it,
Transcribed Image Text:In this problem, you will implement a transposition cipher that, instead of dividing the original text into odd and even characters, separates it into three sets of characters. As an example, we will use this 1977 quote by Digital Equipment Corp. president Ken Olson -- "There is no reason anyone would want a computer in their home." (Spaces are represented with the square u-like character.) ### Visualization of the Three-Rail Transposition: ``` There is no reason anyone would want a computer in their home. Rail 1: T r i n r s y e o a d a u c p e t i h e Rail 2: h e s o e o o a o u l n u o r n h r o l Rail 3: e u l u a n n n w l t t u e l m ``` **Example three-rail transposition.** The resulting encrypted text is produced by reading the text horizontally, i.e., adding the three rails: **Rail 1 + Rail 2 + Rail 3 = "Trinrsy eoad aucpet ihe hesoeoa o ul nuornhro e annnwlt mt e m"** ### Requirements: Implement the three-rail transposition cipher above, placing your code in the file `p4_2.py` ([template](#) provided, replace comment at the beginning of the file with your own code). Feel free to develop your code in PyCharm or the IDE of your choice, then upload or paste it into Coding Rooms. Because this is our first assignment here, just as a backup, also submit your python files through the Canvas assignment for Project 4. In your `p4_1.py` module, define the functions `main()`, `encrypt(msg: str) -> str`, and `decrypt(msg: str) -> str`. You may define other functions as you see fit, but these three must match the interface specified here. - **Encrypt Function:** This should take in the original text and use the three-rail encryption approach described above, returning the encrypted string. Include docstring with doctests. - **Decrypt Function:** This should assume that the message is already encrypted as described above, and decrypt it, returning the original text. Include docstring with doctests. - **Main Function:** This should prompt the user for some input, then ask whether to encrypt or decrypt it,
## Examples of Text Encryption and Decryption

### Running Encryption (E) in Coding Rooms or Your IDE

1. **Prompt**:  
   Do you wish to encrypt or decrypt a message [E/D]? **E**

2. **Input**:  
   Enter a line of text to encrypt:  
   "There is no reason anyone would want a computer in their home."

3. **Output**:  
   Encrypted text:  
   "Trinrs yeoda cpeitiheheseoaoa u naournhro.e  annnwlwt mt  e m"

---

### Running Decryption (D) in Coding Rooms or Your IDE

1. **Prompt**:  
   Do you wish to encrypt or decrypt a message [E/D]? **D**

2. **Input**:  
   Enter encrypted text to decrypt:  
   "Trinrs yeoda cpeitiheheseoaoa u naournhro.e  annnwlwt mt  e m"

3. **Output**:  
   Decrypted text:  
   "There is no reason anyone would want a computer in their home."

---

These examples demonstrate how a simple text encryption and decryption process works. The initial input is encrypted into a scrambled version that appears nonsensical until it is decrypted back to its original form.
Transcribed Image Text:## Examples of Text Encryption and Decryption ### Running Encryption (E) in Coding Rooms or Your IDE 1. **Prompt**: Do you wish to encrypt or decrypt a message [E/D]? **E** 2. **Input**: Enter a line of text to encrypt: "There is no reason anyone would want a computer in their home." 3. **Output**: Encrypted text: "Trinrs yeoda cpeitiheheseoaoa u naournhro.e annnwlwt mt e m" --- ### Running Decryption (D) in Coding Rooms or Your IDE 1. **Prompt**: Do you wish to encrypt or decrypt a message [E/D]? **D** 2. **Input**: Enter encrypted text to decrypt: "Trinrs yeoda cpeitiheheseoaoa u naournhro.e annnwlwt mt e m" 3. **Output**: Decrypted text: "There is no reason anyone would want a computer in their home." --- These examples demonstrate how a simple text encryption and decryption process works. The initial input is encrypted into a scrambled version that appears nonsensical until it is decrypted back to its original form.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY