Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Vigenre Cipher c++ To encrypt a single letter, we take the plaintext letter and corresponding letter of the key and add them together. To add

Vigenre Cipher c++

To encrypt a single letter, we take the plaintext letter and corresponding letter of the key and add them together. To add a letter means that we first consider the letters as numbers, add the two numbers, and translate back to letters. So for example, if we had the plaintext letter 'B' and the key letter 'C', we translate this to 1 and 2 based on their position in alphabetic order. Add them to get 3, which corresponds to the letter 'D'. To deal with the situation of the sum exceeding 26, we simply take the sum modulo 26. That is if the plaintext letter is 'Z' and the key is 'B', this becomes 25 + 1, or 0 mod 26 and thus is the ciphertext letter 'A'.

You will need to write a program to implement the Vigenre cipher. In the end, your program should do the following:

  1. Open a file and read it in as a string.
  2. Prompt the user for a key.
  3. Encrypt the file with the key and write it out to a temporary file.
  4. Open the temporary file and read it in as a string.
  5. Decrypt the file.
  6. Verify that the plaintext and decrypted ciphertext match.

As part of this process you need to develop functions and classes, as appropriate, using the techniques we have developed in lecture. In particular you should utilize operator overloading during the encryption process. That is as part of your encryption process you should have a line roughly looking like:

That is as part of your encryption process you should have a line roughly looking like:

ciphertext_letter = plaintext_letter + key_letter

and in your decryption process something roughly like:

plaintext_letter = ciphertext_letter - key_letter

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

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago