Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (25 pts] Simple Transposition Cipher The textbook explains the simple transposition cipher (Section 3.4) and the course slides (available on Canvas). This cipher divides

image text in transcribed

1. (25 pts] Simple Transposition Cipher The textbook explains the simple transposition cipher (Section 3.4) and the course slides (available on Canvas). This cipher divides the original message into two strings corresponding to its even and odd characters. Those strings are then concatenated to form the ciphertext. Requirements: Implement the odd-even transposition cipher, placing your code in the file p4_1.py. In your p4_1.py module, define the functions encrypt (msg:str)-str and decrypt(msg:str)-str. You may define other functions as you see fit, but these three functions must match the interface specified here. The encrypt function should take in the original text and use the odd-even encryption approach described above, returning the encrypted string. The decrypt function should assume that the msg is already encrypted and decrypt it, returning the original text. Examples: The following image shows the results of executing the required functions. >>> encrypted = encrypt("It was a dark and stormy night") >>> encrypted 'twsadr n tryngti a akadsom ih' >>> original = decrypt(encrypted) >>> original 'It was a dark and stormy night

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions