Homework 1 – Permutation Cipher in C++

Homework 1 – Permutation Cipher in C++

How does it work?
1. Select the block size (n) and a permutation.
2. Divide a given plaintext into blocks of n letters and use ‘x’ as padding, if necessary.
3. Apply a permutation to each block and generate the encrypted ciphertext.
For example, for n = 4 and permutation of (2, 1, 4, 3)
Unencrypted plaintext is gentlemen do not read each other’s mail [1]
1234 1234 1234 1234 1234 1234 1234 1234 1234 1234
gent leme n do not rea d ea ch o ther ’s m ailx
2143 2143 2143 2143 2143 2143 2143 2143 2143 2143
egtn elem nod n to r ae dae hco htre s’m iaxl
Encrypted ciphertext is egtnelem nodn tor ae daehco htres’m iaxl
The program needs to get the following information from the user:
• To encrypt: a text file that includes the plaintext, and a block size and the permutation information via standard input (keyboard).
• To decrypt: a binary file that includes an encrypted ciphertext, and a block size and the permutation information via standard input (keyboard).
Here’s what a sample run should look like:

DETAILED ASSIGNMENT

20210224054717homework

Powered by WordPress