Skip to main content

Short note: Caesar cipher

Short answer

The Caesar cipher shifts each plaintext letter by a fixed key k (mod 26); for k=3, A becomes D. 'ATTACK' encrypts to 'DWWDFN'. Only 25 keys exist and letter frequencies are preserved, making it trivial to break with brute force or frequency analysis.

Write a short note on Caesar Cipher.

The Caesar cipher is one of the oldest and simplest substitution ciphers, attributed to Julius Caesar. Each letter of the plaintext is replaced by the letter a fixed number of positions (the key k) further along the alphabet. The classic Caesar cipher uses k = 3.

Rule

  • Encryption: C = (P + k) mod 26
  • Decryption: P = (C − k) mod 26

with A = 0, B = 1, …, Z = 25.

Example (k = 3)

Plain : A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

Plaintext: ATTACK → Ciphertext: DWWDFN.

Weaknesses

  • There are only 25 possible keys, so brute force is easy.
  • It keeps letter frequencies, so frequency analysis breaks it at once.
  • Its generalisation is the mono-alphabetic substitution cipher, which uses any permutation of the alphabet as the key (26! keys), but it is still broken by frequency analysis.

It is not secure, but it is historically important and useful for explaining the ideas of a key and substitution.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 8 questions →