Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C (Not C++) The Vigenre cipher is a method of encrypting were the shift being used can vary from one letter to the next. So

C (Not C++)

The Vigenre cipher is a method of encrypting were the shift being used can vary from one letter to the next. So lets examine encryption of the word "HELLO" using the encryption key "BOOK". "HELLO" "BOOKB" Start by making the key as long as or longer than the message being encrypted. Repeat the key over again if needed. Since HELLO is 5 characters and BOOk is 4 characters, we start to repeat BOOK over again giving us BOOKB. Then take the first letter to encrypt. H=7, B=1, and we have 26 letters giving (7 + 1 ) % 26 = 8. So the letter H encrypts to 'I'. Let's do the next letter. E=4, O=14 giving us (4 + 14) % 26 = 18 % 26 = 18, or the letter 'S'. If we continue this procedure we will get "ISZVP" when "HELLO" is encrypted with "BOOK". You can verify this using the calculator at https://cryptii.com/vigenere-cipher (External Site). This cipher eluded attempts to break it for almost 300 years. Techniques to break it rely on the key repeating at some frequency. If the key is as long as the message to be encrypted, such as a paragraph or page out of a book or novel, and the same key is never used again, it becomes very difficult to break. This is known as a running key variant of the Vigenre cipher and at one time was considered unbreakable. Two spies that needed to exchange an encrypted message could agree in advance of a particular book, and a particular page that could be used for the key. The key could be as long as needed. There is a strong reason for digitizing all known books for use in cryptanalysis! Your assignment: 1) Ask the user if we are encrypting or decrypting. 2) Ask the user to enter a sentence to be transformed. 3) Ask the user to enter a sentence that will be used as the encryption or decryption key. 4) The sentences (array of characters) should end with a NULL terminator '\0'. 5) The range of values will be all printable characters on the ASCII chart starting with a SPACE - Value 32, up to and including a ~ - Value 126. Therefore, the number of symbols is 95 (0 to 94), i.e. Mod 95. 6) If the key is shorter than the message, make sure the key repeats until it matches the length of the text to be transformed. 7) Print out the transformed (encrypted or decrypted) message.

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

More Books

Students also viewed these Databases questions