The assignment is worth 15% of the total mark for this module. This assignment involves writing two separate C/C++ programs for task 1 and task 2 described below. The purpose of this assignment is for you to get a good understanding of the DES encryption and decryption algorithms. 

The tasks:

· Task 1 (10%)

Complete the given scratch of DES algorithm implementation ConsoleDES.cpp. Basically, you need to finish the functions of Encryption, Decryption, SBox, cipher, Key64to48, etc. Subsequently, you need to extend the program to handle an input file of size not multiples of 8 bytes. Given an input file input.txt, you need to show the encryption result. Note that the key file key.txt is given and the first 64 bits need to be used in this task. 

· Task 2 (5%)

This task is to extend the above code to Triple DES since the 56-bit effective key size is small. In Triple DES, you are given three 64-bit keys which are Key 1, Key 2, Key 3, respectively. For encryption, you need to perform encryption with Key 1, decryption with Key 2 and encryption with Key 3. You also need to design the decryption algorithm. Given the above file input.txt, you need to show the encryption result. Note that the key file key.txt is given and all of the 192 bits need to be used in this task.

The programs should contain brief comments describing the main block of the programs, and the programs should be laid out neatly with consistent indentation.

Submission

You are required to submit the source code files (CE235A1T1.cpp and CE235A1T2.cpp) and the encryption results of the given file input.txt (CE235A1T1result.txt and CE235A1T2result.txt). All of the files should be placed in a single folder which should then be zipped for submission to the coursework submission system (FASER), i.e. the submission should be a single file in zip format.

After you complete your programs, you should demonstrate them to the module supervisor.