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 | |
|---|---|---|
| 1(m + k) % 26 | ADecrypts one letter: subtract the same key number from the cipher letter number, then wrap back into 0-25 | |
| 2(c - k) % 26 | Bp = (ord(ch) - 65 - k) % 26 | |
| 3zip pairs each message letter with the key number in the same position so they can be shifted together | CDecryption adds the key instead of subtracting it, so the shift goes the wrong way and the original message is not recovered | |
| 4To decrypt a one-time pad, subtract the same key value from each cipher letter number and wrap with MOD 26 | DThe % 26 is missing, so the result can go past 25 and will not wrap back around to a letter from A to Z | |
| 5c = (m + k) | EEncrypts one letter: add the key number to the message letter number, then wrap back into 0-25 | |
| 6p = (c + k) % 26 | Ffor ch, k in zip(message, key): |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
(m + k) % 26 — One-time pad: shift each message letter number m by the matching key number k, wrapping with % 26. To decrypt, subtract the same key values: (c - k) % 26. zip pairs each letter with its key.for m, k in zip(message, key):for m, k in zip(message, key):
c = (m + k) % 26for m, k in zip(message, key):
c = (m + k) % 26for c, k in zip(cipher, key):
p = (c - k) % 26for m, k in zip(message, key):
c = (m + k) % 26
cipher.append(c)