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 | |
|---|---|---|
| 1for shift in range(1, 26): | ABrute force means trying every shift, not guessing one. The real key could be any number from 1 to 25. | |
| 2if "THE" in guess: | BLoops through every possible Caesar shift from 1 to 25 so each one can be tested | |
| 3A Caesar cipher has only 25 possible keys, so an attacker can test them all | Ctotal_keys = 25 | |
| 4Brute force means trying every shift and printing each result to look for readable text | Dprint(shift, decrypt(text, shift)) | |
| 5for shift in range(1, 25): | Erange(1, 25) stops at 24, so shift 25 is never tested and the correct key could be missed. | |
| 6Only try shift 3, because that is the common one. | FChecks whether a decrypted guess contains a real word, which suggests the shift was correct |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
brute force — Trying every possible key, such as all 25 Caesar shifts, until readable text appears. A cipher with so few keys is weak because an attacker can check them all quickly.for shift in range(1, 26):
print(shift)for shift in range(1, 26):
print(shift)for shift in range(1, 26):
print(shift, decrypt("KHOOR", shift))plain = decrypt(text, shift)
if "the" in plain:
print("Found it!", shift)keys = list(range(1, 26))
print(len(keys))