# Vigenere Cipher

The Vigenère cipher is a method of encrypting alphabetic text by using a series of interwoven Caesar ciphers. Each letter of the keyword represents a particular shift amount.

### Example

For example, suppose that the plaintext to be encrypted is`attackatdawn`

.

The person sending the message chooses a keyword and repeats it until it matches the length of the plaintext, for example, the keyword “LEMON”: `LEMONLEMONLE`

We can then generate the Cipher Text using the Vigenere Table.
**Encryption**
Plaintext: `attackatdawn`

KEY:`LEMONLEMONLE`

(GENERATED) Ciphertext: `LXFOPVEFRNHR`

Decryption is performed by going to the row in the table corresponding to the key, finding the position of the ciphertext letter in that row and then using the column’s label as the plaintext.

**Decryption**
Ciphertext: `LXFOPVEFRNHR`

KEY:`LEMONLEMONLE`

(GENERATED) Plaintext: `attackatdawn`

What is the weakness? The primary weakness of the Vigenère cipher is the repeating nature of its key. If a cryptanalyst correctly guesses the key’s length n, the cipher text can be treated as n interleaved Caesar ciphers, which can easily be broken individually. The key length may be discovered by brute force testing each possible value of n, or Kasiski examination and the Friedman test can help to determine the key length (see below: § Kasiski examination and § Friedman test).