46. Vigenère cipher

The result of a Caesar cipher looks like gibberish, but it's actually quite easy to break a Caesar cipher. Simply try decrypting the message with each of the possible shifts 1 through 26 and look at the results. When the shift is incorrect, the result is still gibberish, but when the shift is correct, the result looks like words, albeit in five-grams without spaces or punctuation.

The Vigenère cipher improves on the Caesar cipher by using multiple interlaced Caesar ciphers. This cipher uses a word as its key. Each letter in the key represents a shift. For example, A represents a shift of 0, B represents a shift of 1, and so forth. The cipher matches letters in the plaintext with letters in the key, repeating the key if necessary. It then uses the key letters' shifts to modify the plaintext letters.

The Vigenère cipher (Vigenère is roughly pronounced vision-air) is named after 17th century French cryptographer Blaise de Vigenère. He didn't invent the cipher, but it was misattributed to him and the name stuck.

Write a program similar to the one you wrote for the preceding problem but this time use a Vigenère cipher to encrypt and decrypt messages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.139.105