---
title: "Short note: Caesar cipher"
subject: "Operating System"
chapter: 8
key: "semester_6/operating_system:caesar-cipher-note"
source: https://www.bctengineer.com/q/semester_6/operating_system/caesar-cipher-note
site: BCT Engineering
---

# Short note: Caesar cipher

Operating System · Chapter 8: Security

- Asked in: 2074 Bhadra, 3 marks
- Video: [Caesar Cipher (Part 1)](https://www.youtube.com/watch?v=JtbKh_12ctg) — Neso Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/caesar-cipher-note
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-8

## Question

Write a short note on 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.

## Answer

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)
```text
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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which is the Caesar encryption rule?
   A. C = (P + k) mod 26
   B. C = (P - k) mod 26
   C. C = (P x k) mod 26
   D. C = P^k mod 26
   Answer: A. Decryption is P = (C - k) mod 26. (Key point: Rule)

2. With k = 3, what is ATTACK?
   A. CVVCEM
   B. DWWDFN
   C. DXXDGO
   D. XQQXZH
   Answer: B. A->D, T->W, C->F, K->N. (Key point: Example)

3. Why is it insecure?
   A. The key is 26! long
   B. It needs two keys
   C. Only 25 keys and it preserves letter frequencies
   D. Hash collisions
   Answer: C. Brute force and frequency analysis break it. (Key point: Weakness)

## Related in Operating System

- [Symmetric cryptography, substitution, Caesar](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Asymmetric-cryptography-substitution-caesar) — Operating System, chapter 8
