Honors 1000, Productive Data Manipulation in Python and MySQL (Fall 2020)

Program 1 - Crypto

Due: 28 September 2020

In the 2nd World War, passing encrypted messages allowed Allied forces to communicate using the same technology that Axis forces used without the enemy knowing the content of the message. Assume that you are an intelligence officer in the army who was asked to create an encryption and decryption platform to help the army. Your plan is to create the encryption using the following logic:

  1. Each letter will be encoded using the index order of the alphabet. [A=0, B=1, . . . , Z=25]
  2. The message will have a timestamp, for example 9:00 (military time 9.00am). Using the hour part of the time stamp each letter should be shifted [A->J, B->K, ..., Z->I].
  3. Spaces are coded as _
Assume all the characters will be in lower case and apart from the time there are no other characters in the message other than a..z.

The program should be able to take the user input of a message and decrypt it, also if an ecrypted message was given, it should be able to display the decrypted output.

Following is an example of the encryption algorithm in action.

14:00/the ships are in position
14:00/7,21,18_6,21,22,3,6_14,5,18_22,1_3,2,6,22,7,22,2,1

Find out what the following message means

21:30/17,25_21,12,25_12,25,21,24,19_14,9_21,14,14,21,23,5

A sample run of the program is given below:

macbook-pro:Crypto raj$ python3 Crypto.py 

Enter e plain-text or d coded-text or q: e 14:00/great work
Encrypted text is: 14:00/20,5,18,14,7_10,2,5,24

Enter e plain-text or d coded-text or q: d 14:00/20,5,18,14,7_10,2,5,24
Decrypted text is: 14:00/great work

Enter e plain-text or d coded-text or q: q
Crypto.py

Interesting YouTube videos of Alan Turing and World War 2 Code Breaking

Turing's Enigma Problem (Part 1) - Computerphile

Tackling Enigma (Turing's Enigma Problem Part 2) - Computerphile