# Cryptography/Vigenère cipher
## Vigenère Cipher

One of the most famous and simple polyalphabetic cipher is the Vigenere Cipher developed by Blaise de Vigenere in the 16th century. The Vigenère cipher operates in a manner similar to a Caesar cipher, however, rather than shifting the plaintext character by a fixed value n, a keyword (or phrase) is chosen and the ordinal values of the characters in that keyword are used to determine the offset. The process that creates encrypted text is simple, but it was unbroken for 300 years.The system is so simple that the Vigenere encryption system has been discovered and rediscovered dozens of times.
For example, if the keyword is "KEY" and the plaintext is "VIGENERE CIPHER," then first the key must be repeated so that it is the same length as the text (so key becomes keykeykeykeyke). Next, the ordinal value of V (22) is shifted by the ordinal value of K (11) yielding F (6), the ordinal value of I (9) by the ordinal value of E (5) yielding M (13), etc. The keyword is repeated until the entire message is encrypted:
An easier, but equivalent way of encrypting text is by writing out each letter of the alphabet and the key, and simply matching up the letters:
First The V in the first row would up with the F in the second. Then, one would go down a row, and see that the I in the first row lines up with the M in the third. After one reaches the bottom row, then they would continue lining up letters with the second row. This uses exactly the same cipher, and is simply an easier method of performing the encryption when doing so by hand.
The Caesar cipher could be seen as a special case of the Vigenère cipher in which the chosen keyword is only a single character long.
An algorithmic way of expressing this cipher would be:

### GROMARK cipher

The Gronsfeld cipher is variation of Vigenere using a pseudo-random decimal key.
The Gronsfeld cipher was invented by José de Bronckhorst, earl of Gronsfeld, in 1744.
The cipher developed by Count Gronsfeld (Gronsfeld's cipher) was used throughout Europe. It is enciphered and deciphered identically to the Vigenere cipher, except the key is a block of decimal digits (repeated as necessary) shifting each plaintext character 0 to 9, rather than a block of letters (repeated as necessary) shifting each plaintext character 0 to 25. It was more popular than the Vigenère cipher, despite its limitations.
An algorithmic way of expressing this cipher would be:
The GROMARK Cipher is a Gronsfeld cipher using a mixed alphabet and a running key.

## running key cipher

The running key cipher is a type of polyalphabetic substitution cipher in which a text, typically from a book, is used to provide a very long keystream. Usually, the book to be used would be agreed ahead of time, while the passage to use would be chosen randomly for each message and secretly indicated somewhere in the message.
A cryptanalyst will see peaks in the ciphertext letter distribution corresponding to letters that are formed when high-frequency plaintext letters are encrypted with high-frequency key text letters.
If a cryptanalyst discovers two ciphertexts produced by (incorrectly) encrypting two different plaintext messages with the same "one-time" pad, the cryptanalyst can combine those messages to produce a new ciphertext that is the same as using one of the original plaintext messages as a running key to encrypt the other original plaintext, then use techniques that decode running key ciphers to try to recover both plaintexts.

## Further reading

In a later chapter of this book, we will discuss techniques for Breaking Vigenère cipher.
* ↑ "The GROMARK cipher, and some relatives"
* ↑ "Gronsfeld Cipher".
* ↑ Jerry Metzger. "The ACA and You". A publication of the American Cryptogram Association. Chapter 8: "The Cipher Exchange and Cipher Standards". Section "GRONSFELD".
* ↑ Jerry Metzger. "The ACA Cipher Exchange and Cipher Standards". Section "GROMARK"
* ↑ Sravana Reddy; Kevin Knight. "Decoding Running Key Ciphers". 2012.