CSCI 4174/CSCI 6708 NETWORK SECURITY: ASSIGNMENT NO. 4
PLEASE READ - GENERAL IMPORTANT NOTES FOR ALL ASSIGNMENTS:
- It is very important that you use the network tools that you download only for collecting information about your own machine or a self-contained private network. Never use any of the tools for unethical purposes
- All references must be properly cited in your answers. Use IEEE or ACM reference styles (https://www.ieee.org/documents/ieeecitationref.pdf) (https://www.cs.ucy.ac.cy/~chryssis/specs/ACM-refguide.pdf) . Points will be deducted for improper citations and citations in incorrect formats.
- Keep in mind that just because you cite references, you must not “cut-and-paste” from these or other sources. The write-up must be properly paraphrased and referenced.
- Late Penalty Policy: The assignment is due at 11.59 PM on the due date. It will not be marked late up to 5 hours past the deadline. Beyond the grace time, there will be a 10% per day on the mark earned on the assignment. For instance, if your score on the assignment is 8/10 and there is a 10% late penalty, the score will be reduced to 7.2/10. Assignments that are five days past due will not be accepted.
5. Submission: Submission will be on Brightspace.
This is a programming assignment on cryptography – you will implement two ciphers.
Note: Do not use online resources or built-in libraries. Implement the programs on your own.
Exercise 1: Write a program to simulate Playfair substitution cipher. Your program should have three methods/functions:
Method 1: Accepts a secret key (String of characters) as argument and generates and returns a key matrix (2D array).
Method 2: Accepts plaintext (String of characters) and the key matrix as arguments and generates and returns the ciphertext.
Method 3: Accepts ciphertext (String of characters) and the key matrix as arguments and generates and returns the plaintext.
You may assume that the plaintext, ciphertext and the key all consist of only upper-case letters. You can ignore spaces, punctuations and line breaks.
Use a driver program with a main method to test the above methods. First test your code using the examples from the lecture notes. Ensure that you test some of the special cases such as repeated characters in a pair, odd total number of characters, etc.
Next, run your program to encrypt the following text, using the secret key RAYQUAZA
POKEMON TOWER DEFENSE
YOUR MISSION IN THIS FUN STRATEGY TOWER DEFENSE GAME IS TO HELP PROFESSOR OAK TO STOP ATTACKS OF WILD RATTATA. SET OUT ON YOUR OWN POKEMON JOURNEY, TO CATCH AND TRAIN ALL POKEMON AND TRY TO SOLVE THE MYSTERY BEHIND THESE ATTACKS. YOU MUST PLACE POKEMON CHARACTERS STRATEGICALLY ON THE BATTLEFIELD SO THAT THEY STOP ALL WAVES OF ENEMY ATTACKER
DURING THE BATTLE YOU WILL LEVEL UP AND EVOLVE YOUR POKEMON. YOU CAN ALSO CAPTURE OTHER
POKEMON DURING THE BATTLE AND ADD THEM TO YOUR TEAM. USE YOUR MOUSE TO PLAY THE GAME. GOOD LUCK
Note: Ignore spaces, punctuations, and line breaks.
Decrypt the ciphertext to get back the above plaintext (ignore about spaces, punctuations, and line breaks).
As an example, when you encrypt and decrypt, the text will appear as below:
POKEMON TOWER DEFENSE YOUR MISSION ... (Plaintext)
xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx ... (Ciphertext; x stands for some uppercase letter)
POKEMONTOWERDEFENSEYOURMISQSION ... (Ciphertext back to Plaintext; the plaintext may have extra Q, X and Z characters – you can leave them as they are)
Exercise 2: Write a program to simulate Matrix transposition cipher. Your program should have two methods: Method 1: Accepts plaintext (String of characters) and a key (integer array representing the permutation of the columns) as arguments and generates and returns the ciphertext (String of characters).
Method 2: Accepts ciphertext (String of characters) and a key (integer array representing the permutation of the columns) as arguments and generates and returns the plaintext (String of characters).
Use a driver program with a main method to test the above methods. You may use some of the examples from the lecture notes to test your solution.
You may assume that the plaintext and ciphertext consist of uppercase letters, lowercase letters, numbers, and spaces. You can represent the space by a % character. No other special characters are required.
Run your program on the same text file as for Exercise 1. Ignore newline characters but include spaces. Use a 10- column matrix and some random permutation of the columns as the key.
You can develop the programs in Java, C, C++ or Python. Make necessary assumptions regarding the spacing of characters in the input text files.
Submit your source codes and a text file/PDF file containing the inputs and outputs.
What to submit: One zip file containing a) Source codes for the two programs and c) Text file/PDF containing sample inputs and outputs.