CSc 7003, Programming for Data Science (Summer 2019)
Program 3 - Crypto
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:
- Each letter will be encoded using the index order of the alphabet. [A=0, B=1, . . . , Z=25]
- 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].
- Spaces are coded as _
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