Why a Caesar cipher is weak compared with modern encryption

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Why a Caesar cipher is weak compared with modern encryption

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. How many useful keys does a Caesar cipher have?
A 25 shifts
B Trillions of shifts
2. Which is a reason a Caesar cipher is weak?
A It uses a key that is far too long to guess
B A computer can try all 25 keys in a blink
3. Modern encryption keys compared with a Caesar key:
A Modern keys are huge, with trillions of trillions of options
B Modern keys are about the same size, with 25 options
4. In a Caesar cipher, what happens to the letter patterns of the message?
A They disappear completely
B They remain, so common letters like E still stand out
5. Which method helps a code breaker crack a Caesar cipher without knowing the key?
A Looking for the most common letter in the ciphertext
B Guessing one password out of trillions

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1keys = 25 A25 keys is a tiny number, and a computer can try them all in a blink, not years.
2keys = 2 ** 128 Bfor shift in range(1, 26):
3A computer can try every Caesar shift in a split second CA Caesar shift moves every letter the same amount, so letter patterns like common letters stay visible.
4Letter patterns remain in a Caesar cipher, so the most common letter in the ciphertext is probably E DA Caesar cipher has only 25 possible keys, so there are very few shifts to try
5A Caesar cipher is strong because shifting hides every pattern Emost_common = max(counts, key=counts.get)
6A computer needs years to try all 25 Caesar keys FModern encryption can have trillions upon trillions of keys, far too many to try one by one

Definitions

weak cipher

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
caesarKeys ← __
2.
___ shift ← 1 TO 25 DECRYPT(ciphertext, shift)
3.
keysTried ← 25 IF keysTried _ 25 THEN DISPLAY "Every key tried"
4.
counts ← COUNTLETTERS(__________) DISPLAY counts
5.
modernKeys ← 2 _ 256

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A msg = 'KHOOR'
B for shift in range(1, 10):
C guess = decrypt(msg, shift)
D print(shift, guess)
Question 2
A msg = 'HELLO'
B cipher = caesar(msg, 3)
C print(len(cipher) > len(msg))
Question 3
A cipher = 'KHOOR'
B count = 0
C for ch in cipher:
D if ch = 'R': count += 1
E print(count)
Question 4
A cipher = 'KHOOR ZRUOG'
B top = least_common(cipher)
C shift = ord(top) - ord('E')
Question 5
A key_bits = 128
B keys = 2 ** key_bits
C rate = 10 ** 12
D years = keys / rate * 31536000
E print(years)

Answer Key

Why a Caesar cipher is weak compared with modern encryption
Section A: Quick Questions
Q1
A — 25 shifts
Q2
B — A computer can try all 25 keys in a blink
Q3
A — Modern keys are huge, with trillions of trillions of options
Q4
B — They remain, so common letters like E still stand out
Q5
A — Looking for the most common letter in the ciphertext
Section B: Match the Pairs
Q1
keys = 25 → A Caesar cipher has only 25 possible keys, so there are very few shifts to try
Q2
keys = 2 ** 128 → Modern encryption can have trillions upon trillions of keys, far too many to try one by one
Q3
A computer can try every Caesar shift in a split second → for shift in range(1, 26):
Q4
Letter patterns remain in a Caesar cipher, so the most common letter in the ciphertext is probably E → most_common = max(counts, key=counts.get)
Q5
A Caesar cipher is strong because shifting hides every pattern → A Caesar shift moves every letter the same amount, so letter patterns like common letters stay visible.
Q6
A computer needs years to try all 25 Caesar keys → 25 keys is a tiny number, and a computer can try them all in a blink, not years.
Section C: Definitions
Q1
weak cipher — A cipher with few keys and letter patterns that show through, so a computer can break it fast. Modern encryption uses huge keys and complex steps. A Caesar cipher has only 25 keys.
Section D: Fill in the Blanks
Q1
caesarKeys ← 25
Q2
FOR shift ← 1 TO 25 DECRYPT(ciphertext, shift)
Q3
keysTried ← 25 IF keysTried = 25 THEN DISPLAY "Every key tried"
Q4
counts ← COUNTLETTERS(ciphertext) DISPLAY counts
Q5
modernKeys ← 2 ^ 256
Section E: Spot the Error
Q1
B — A Caesar cipher has 25 keys, so a brute-force loop must try them all. range(1, 10) only tries 9 shifts and might miss the right one. It should be range(1, 26).
Q2
C — A Caesar shift keeps the message length the same, so the lengths are equal. This leaked pattern helps attackers. The check should use == instead of >.
Q3
D — Counting letters shows how patterns remain in Caesar ciphertext. The comparison must use == to check equality. A single = is assignment and causes a syntax error.
Q4
B — Frequency analysis looks for the MOST common letter, which probably stands for E in English. Using the least common letter would not reveal the shift. It should be most_common(cipher).
Q5
D — keys / rate gives the number of seconds. To turn seconds into years you divide by the seconds in a year, not multiply. The line should be keys / rate / 31536000.