Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python Part V: The Double Cipher: Encryption (20 points) Write a function de.encrypt that takes the following arguments, in this onder 1. plaintext: an

image text in transcribed
image text in transcribed
In python
Part V: The Double Cipher: Encryption (20 points) Write a function de.encrypt that takes the following arguments, in this onder 1. plaintext: an oiginal, plaintest sering lo be encryplad 2. ilenane: a file that contains the 6 x 6 encryption key Your function should take the plaintext, encrypt it based on the key contained m t iename, then return the encrypted result as a string. It is best to explain the encryptioe mechanism using an example plaintext- STONYBROOK'. 2ilenane- *keyl.txt CSE 101 -Fall 2017 Homework 4 Page 6 First, the coordinates (row, col) of each character in plaintext is spliz into two rows, with the first row being the character's row number in the file, and the second row being the character's column number in the tile: KEY GRID: HNXTD2 7GJRSB row nunbers: 363215666 col numbers: 54424244 2 The coordinate position of each character is gencrated by calling yourmap.char.to.coords0 function from Part IlI by passing filename as the argument. Call your map.char.to.coords ) function once to generate the dictionary and then look up cach letler of the plainlext in the dictionary to pct its coundinate position Here's an example char to_coords-mop_char to.coords (tilename) called only once! row, col . char_to_coords[char] char stores a sytol from plaintext Second, the row numbers and the column numbers are concaltienaied into one list of integers, with all the row numbers followed by all the column numbers: 363 2156665442424442 Third, pair the numbers from the ahove sequence (from left to righit) to assemible a new set of rowicolumn pairs, as shown below 53 63 21 56 66 54 42 42 44 42 Finally, cach new row/column pair represenss a cooedinate of an encrypted character. Call your map.coords.to.chaz fonction from Part IV by passing fileasme as the argument Here's an example coords_ca_enar map_cocras_ca_chars(tilename) called only once ! - charcoords to char (coozdl, coord2)] * coord1, coord2) is a tuple formed by taking a pair of coordinates from the List generated in step 3. above. Eor eaaaple, we could write coords to_char1(5, 3)] to get the character at position 5,3 t in the 6 x 6 grid. Look up the letter in the key grid and you get a message like this coordinates: 53 63 21 56 66 54 42 42 44 42

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_2

Step: 3

blur-text-image_3

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

Discuss three main reasons people decide to become entrepreneurs.

Answered: 1 week ago

Question

3. What changes should I be making?

Answered: 1 week ago

Question

2. Why?

Answered: 1 week ago