Cryptography
by Soumya C. Kambhampati

Vigenere Cipher:

Vigenere Cipher Explanation

The Vigenere cipher is a more complex version of shift cipher.

It uses two things to encode plaintext: a keyword, and a Vigenere square, like the one below.

It takes 26 alphabets, each one moving one to the left.

To encode, you take a keyword and repeat it until it is matching in length with the plaintext.

Assuming that letters A-Z are numbers 0-25, the code Ci for each plain text letter Pi

with the corresponding keyword letter Ki is simply Ci = (Pi+Ki) mod 26.

Vigenere Square


Shift Cipher:

Shift Cipher Explanation

To encode, one simply moves each letter down fixed positions in the alphabet, as shown in the figure on the bottom.

This can also be expressed algebraically using modular arithmetic.

If you think of A-Z in terms of their positions 0-25, and s is the shift, then the code for a plain text letter x will simply be (x + s) mod 26.

Here u mod v is just the remainder when you divide u by v.

To decipher ciphertext y, you do (y - s) mod 26.