# The Vigenère Cipher

The Vigenère Cipher

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.

Once a message and keyword are selected, repeated use of the "next step" button illustrates the steps the Vigenère procedure. To use a new message or keyword, or to try your hand at decrypting a message, first press the "start over/new example" button. You will then be able to select a new message, a new keyword, or the decryption mode.

Selection of the decryption mode gives a random choice from a list of twelve messages distinct from the nine messages for encrypting. You can opt to decrypt an encrypted version of one of the nine original messages, if desired.