# The Vigenère Cipher

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

The Vigenère cipher encrypts a message by using a keyword and modular arithmetic. The keyword is repeated as often as needed until there are the same number of letters as the message contains. The positions of the letters in the alphabet (a → 0, b → 1, …, z → 25) are then added to the positions of the corresponding letters in the keyword. Addition is done modulo 26, and the resulting sums are then replaced by their corresponding letters to arrive at the encrypted message. To decrypt a message, the same keyword is used, but subtraction modulo 26 is done instead of addition.

[more]
Contributed by: Marc Brodie (January 2012)

(Wheeling Jesuit University)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

The Vigenère cipher is a generalization of the Caesar cipher and other shift ciphers. The Caesar cipher replaces each letter in a message with the letter three letters later in the alphabet (including wrapping around to replace x with a, etc.), and thus is effectively a Vigenère cipher with keyword "d." However, the Vigenère cipher is much more difficult to crack, since it is not a simple substitution cipher—two occurrences of the same letter in a message are typically encrypted with different letters. Conversely, two occurrences of the same letter in an encrypted message typically represent two different letters in the original message. In general, the longer the keyword, the more difficult it is to crack the code.

This Demonstration includes nine messages and seven keywords to illustrate Vigenère encryption. Two single-letter keywords are included to illustrate Caesar (shift) ciphers.

Cool spy lingo found at www.intelligencesearch.com/spy-codes.html.

## Permanent Citation