Question: CS 1410 Assignment 2 XOR Permutation Cipher Due Before: Saturday, April 21st, 2018, 11:30 p.m. The purpose of this program is to help you to
CS 1410
Assignment 2
XOR Permutation Cipher
Due Before: Saturday, April 21st, 2018, 11:30 p.m.
The purpose of this program is to help you to write programs that can process information at the bit level. This program must be a C++ Win32 Console Application Project (that uses the empty project option). All programs will be graded using Visual Studio 2015. You will want to compile and run your code using this IDE.
25 points per day will be deducted if this is turned in late.
Instructions: Write a C++ program that will:
Input a 7 bit key from a file. This file must be entitled exactly key.txt.
Input a plaintext message of any size from a file entitled plaintext.txt.
For every character in the plaintext message, perform the following tasks to encrypt it:
Compute its base 10 ASCII value
Convert the base 10 number into an equivalent 7 bit unsigned binary number
Permute the bits of the 7 bit binary number according to the following permutation:
permuated_bits[0] = original_bits[2]
permuated_bits[1] = original_bits[5]
permuated_bits[2] = original_bits[6]
permuated_bits[3] = original_bits[4]
permuated_bits[4] = original_bits[1]
permuated_bits[5] = original_bits[3]
permuated_bits[6] = original_bits[0]
XOR the permuted_bits with the key to compute the ciphertext bits.
Output to the console screen the 7 ciphertext bits for that plaintext character.
Output a Carriage Return (endl) so that there are only 7 ciphertext bits per line.
Note: To conserve memory and to partially simulate how this would be implemented at the machine level, you must use the C++ bitset in order to store the following:
Plaintext bits
Key bits
Cipertext bits
C++ Bitset references:
https://www.geeksforgeeks.org/c-bitset-and-its-application/
http://www.cplusplus.com/reference/bitset/bitset/
Visual Studio 2015 Download link: https://www.uhd.edu/computing/labs-technology-centers/academic-computing-labs/Pages/acl-dreamspark.aspx
C++ Win32 Console Application Reference: https://msdn.microsoft.com/en-us/library/ms235629(v=vs.140).aspx
Sample Run 1:
plaintext.txt = XOR Permuation Cipher.
key.txt = 1010101
______________________________________________________
Sample Run 2:
plaintext.txt = abc123$% QWERT
key.txt = 1111110
This program needs to be able to work with plaintext files of any size and any 7 bit key.
Turn in your .cpp file into the Blackboard dropbox for assignment 2. Only turn in 1 .cpp file entitled Your Name.cpp (using your personal name). This file will look like the following:
Do not wait until the last minute to do this assignment. Get started as soon as you read this. Writing an algorithm will help you to code this. If you are experiencing logic errors, do not forget to use your debugger. Tutoring is available in S735.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
