Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS 1410 XOR Permutation Cipher Instructions : Write a C++ program that will: 1. Input a 7 bit key from a file. This file must

CS 1410

XOR Permutation Cipher

Instructions: Write a C++ program that will:

1. Input a 7 bit key from a file. This file must be entitled exactly "key.txt".

2. Input a plaintext message of any size from a file entitled "plaintext.txt".

3. For every character in the plaintext message, perform the following tasks to encrypt it: a. Compute its base 10 ASCII value

b. Convert the base 10 number into an equivalent 7 bit unsigned binary number

c. 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]

d. XOR the permuted_bits with the key to compute the ciphertext bits.

e. Output to the console screen the 7 ciphertext bits for that plaintext character.

4. 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:

1. Plaintext bits

2. Key bits

3. Cipertext bits

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+9. Discuss how companies can use blogs.

Answered: 1 week ago

Question

Develop goals and timetables.

Answered: 1 week ago

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago

Question

5. Have you stressed the topics relevance to your audience?

Answered: 1 week ago