Question: Implement a decryption cipher to decode messages from text files. Key Programming concepts: if statements, loops, strings, file input Approximate lines of code: 33 not

Implement a decryption cipher to decode messages from text files.

Key Programming concepts: if statements, loops, strings, file input

Approximate lines of code: 33 not including comments or white space

Program inputs:

"Enter file to decrypt:"

-the user will always enter a text file that exists and needs to be decrypted

Program outputs:

"Decripted message: XXX"

-XXX is the decrypted message for every line in the chosen file

Assignment Details:

This assignment will give you a brief introduction to cryptography using the Polybius square Cipher! Cryptography allows us to encode and decode messages that are difficult to decipher without knowledge of a secret key/table/code. Cryptography is a rich subject in its own right, but we will not have time to cover it in detail. Please check out the numerous online resources if you want more information.

This particular cipher depends upon the following secret table, which has the 26 letters from the alphabet along with 10 common punctuation marks, randomly arranged in a 6x6 grid:

1 2 3 4 5 6
1 R ) V B ; S
2 K X D W L Q
3 Y N T ? G "
4 : P ( A U '
5 . , ! Z J M
6 I F H E C O

The main idea is to replace letters in your secret message with the corresponding row and column number from the table. The encrypted message will then have two numbers that represent a single letter. For exapmple, to encrypt the following message:

ATTACK AT DAWN

Letter Corresponding Number
A 44
T 33
C 65
K 21
D 23
W 24
N 32

The individual letters from the message correspond to the following numbers:

Putting these numbers together, gives us the following encoded message:

443333446521 4433 23442432

To decode the message, you just do the reverse process! Given two numbers, use the first number as the row and the second as the column in the polybius grid to find the corresponding letter.

I need some help making this code. Thanks!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!