Question: Vigenre cipher. The trouble with a monoalphabetic cipher is that it can be easily broken by frequency analysis. The so-called Vigenre cipher overcomes this problem

Vigenère cipher. The trouble with a monoalphabetic cipher is that it can be easily broken by frequency analysis. The so-called Vigenère cipher overcomes this problem by encoding a letter into one of several cipher letters, depending on its position in the input document. Choose a keyword, for example TIGER. Then encode the first letter of the input text like this:

A B C D E F G H I J K L

That is, the encoded alphabet is just the regular alphabet shifted to start at T, the first letter of the keyword TIGER. The second letter is encrypted according to this map:

M N O P Q R S T U V W X

The third, fourth, and fifth letters in the input text are encrypted using the alphabet sequences beginning with characters G, E, and R. Because the key is only five letters long, the sixth letter of the input text is encrypted in the same way as the first.
Write a program that encrypts or decrypts an input text using this cipher. Use command line argu ments as in Exercise •• P21.1 .

Data from Exercise  P21.1 Random monoalphabet cipher. The Caesar cipher, which shifts all letters by a fixed amount, is far too easy to crack. Here is a better idea. For the key, don’t use numbers but words. Suppose the keyword is FEATHER. Then first remove duplicate let ters, yielding FEATHR, and append the other letters of the alphabet in reverse order. Now encrypt the letters as follows:

Y Z T U V W X Y Z A B C

Write a program that encrypts or decrypts a file using this cipher. The keyword is specified with the -k command line option. The -d command line option specifies decryption. For example,

D E F G H I J K L M N O

decrypts a file using the keyword FEATHER. It is an error not to supply a keyword.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z T U V W X Y Z A B C D E F G H I J K L M N O P Q R S

Step by Step Solution

3.44 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The Vigenre cipher is a method of encrypting alphabetic text by using a simple form of polyalphabetic substitution A polyalphabetic cipher is a cipher ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!