Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1frequency analysis | Ashift = X - E = 23 - 5 = 18 | |
| 2most common ciphertext letter = E? | Bcount(letter) for each letter A to Z | |
| 3An attacker counts the letters in a ciphertext to see which one appears most often | CA good first guess is that the most common ciphertext letter stands for E, the most common English letter | |
| 4If X is the most common ciphertext letter and it stands for E, the Caesar shift can be worked out | DCounting how often each letter appears in ciphertext to guess which letters stand for common plaintext letters | |
| 5Most common ciphertext letter = Z, so Z must be E | EFrequency analysis needs enough text. A very short message does not have enough letters for the counts to match normal English, so the guess can be wrong. | |
| 6Short message: HI. Frequency analysis always works perfectly | FThe attacker assumed the most common ciphertext letter is always Z. Frequency analysis only says the most common ciphertext letter probably stands for E, whatever that ciphertext letter is. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
frequency analysis — Counting how often each letter appears in ciphertext. The most common letter probably stands for E, so an attacker can work out the key.for letter in ciphertext:
counts[letter] += 1top = max(counts, key=counts.get)shift = ord(top) - ord("E")if len(ciphertext) > 100:
print("Frequency analysis works well")total = len(ciphertext)
percent = count / total * 100