Advertisement

Vigenère Cipher

A polyalphabetic substitution cipher using a repeating keyword to determine each letter's shift.

Learn

A polyalphabetic substitution cipher using a repeating keyword to determine each letter's shift.

The Vigenère cipher encrypts each letter of the plaintext with a Caesar shift whose size is determined by the corresponding letter of a repeating key. With letters encoded A=0, B=1, ..., Z=25, encryption is C_i = (M_i + K_i) mod 26 and decryption is M_i = (C_i − K_i) mod 26, where K_i is the key letter at position i (the key repeats if shorter than the message). This breaks simple frequency analysis because the same plaintext letter maps to different ciphertext letters depending on its position in the key cycle.

C_i = (M_i + K_i) mod 26; M_i = (C_i − K_i) mod 26

  • Plaintext HELLO with key KEY → shifts K(10) E(4) Y(24) K(10) E(4) → RIJVS
  • Plaintext ATTACK with key LEMON → shifts 11 4 12 14 13 11 → LXFOPV
  • A repeating-letter key (e.g., AAAA) reduces Vigenère to a plain Caesar shift of 0

How to recognize it

  • A key or keyword is given alongside the ciphertext
  • The same ciphertext letter does not always decode to the same plaintext letter
  • Letter frequencies in the ciphertext appear flatter than in a monoalphabetic cipher

Common mistakes

  • Forgetting to repeat the key when the message is longer
  • Using A=1 instead of A=0 (off-by-one shifts)
  • Subtracting instead of adding (or vice versa) during encryption

Practice guidance

Coding & Decoding

Advertisement