Vigenère Ciphering
You are to develop a program to implement Vigenère ciphering to encrypt and decrypt text
information. A description of Vigenère ciphering can be found at:
To illustrate encryption, a table of characters shown below can be used, termed a tabula recta,
Vigenère square, or Vigenère table. It consists of the alphabet written out 26 times in different
rows, each alphabet shifted cyclically to the left compared to the previous alphabet,
corresponding to the 26 possible Caesar ciphers. For each letter in the plain text, a letter from a
repeated keyword is used to define which row in the table is used to encrypt the character.

For example, suppose that the plaintext to be encrypted is (note that spaces an non alphabetic
characters are not allowed):
The person sending the message chooses an encryption keyword which is repeated until it
matches the length of the plaintext, for example, consider the keyword "LEMON":
The first letter of the plaintext, A, is encrypted using the alphabet in row L, which is the first
letter of the key. This is done by looking at the letter in row L and column A of the Vigenère
square, namely L. Similarly, for the second letter of the plaintext, the second letter of the key is
used; the letter at row E and column T is X. The rest of the plaintext is enciphered in a similar
Decryption is performed by finding the position of the ciphertext letter in a row of the table
(using the character from the keyword to select the row), and then taking the label of the column
in which it appears as the plaintext. For example, in row L, the ciphertext L appears in column A,
which taken as the first plaintext letter. The second letter is decrypted by looking up X in row E
of the table; it appears in column T, which is taken as the plaintext letter.

Recommended Answers

All 2 Replies

im not even sure how to start...
i put it as a matrix right?
and change letters to numbers?
i know its worded more complicated than it probably actually is though

Well I would use a double matrix:

String [][] ARRAY = {
   {"A", "B", ...},
   {"B", "C", ...},
   {"C", "D", ...},

Then for mapping the letters with the numbers in a quick way:

HashMap map = new HashMap(26);

The key is the letter and the value is the number. So when you have a letter, get the number from the map and you the index to use for the array

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.