Monoalphabetic substitution cipher

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

Monoalphabetic substitution cipher

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. In a monoalphabetic substitution cipher, what is the key?
A A scrambled alphabet
B A single number to shift by
2. Plain row: ABC... Key row: QWE... Using this key table, what does CAB encrypt to?
A EQW
B QWE
3. How do you decrypt with a key table?
A Look up each cipher letter in the plain row and read the scrambled letter below it
B Find each cipher letter in the scrambled row and read the plain letter above it
4. Which is a valid keyword alphabet made from the keyword ZEBRA?
A ZEBRACDFGHIJKLMNOPQSTUVWXY
B ZEBRAZEBRACDFGHIJKLMNOPQST
5. How many different keys can a substitution cipher have?
A Only 26
B 26 factorial, about 4 x 10^26

Match the Pairs

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

Left columnRight column
1plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ key: QWERTYUIOPASDFGHJKLZXCVBNM Akey: QWERTYUIOPASDFGHJKLZXCVBNM plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Q -> A
226! = 403291461126605635584000000 BThe number of possible keys in a substitution cipher, because there are 26 choices for the first letter, 25 for the next, and so on.
3A keyword alphabet starts the scrambled alphabet with a keyword (repeated letters removed), then adds the remaining letters in order. CA substitution key table: the top row is the normal alphabet and the bottom row is the scrambled alphabet. A becomes Q, B becomes W, C becomes E.
4To decrypt, use the reverse table: find each ciphertext letter in the key row and swap it for the plain letter above it. Dkeyword: CYBER key: CYBERADFGHIJKLMNOPQSTUVWXZ
5key: QWERTYUIOPASDFGHJKLZXCVBNN EA monoalphabetic cipher uses one fixed scrambled alphabet for the whole message. The key does not change from letter to letter.
6Encrypt HELLO with key shift 3 -> KHOOR, so the key changes for every letter. FThe key repeats the letter N and leaves out M. A valid key must use each of the 26 letters exactly once.

Definitions

monoalphabetic substitution cipher

Fill in the Blanks

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

1.
plain = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" key = "QWERTYUIOPASDFGHJKLZXCVBNM" print(___(key))
2.
i = plain.index("H") cipher = key[_] print(cipher)
3.
i = ___.index("Z") print(plain[i])
4.
import math print(math._________(26))
5.
keyword = "ZEBRA" rest = "CDFGHIJKLMNOPQSTUVWXY" key = keyword _ rest

Spot the Error

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

Question 1
A key = {'a': 'x', 'b': 'x'}
B text = 'ab'
C for ch in text:
D print(key[ch])
Question 2
A key = {'a': 'x', 'b': 'q'}
B back = []
C for p in key:
D back[key[p]] = p
Question 3
A FIRST letter has 2 choices
B SECOND letter has 25 choices
C THIRD letter has 24 choices
D KEYS = 26 x 25 x 24 x ... x 1
Question 4
A SET keyword TO ZEBRAS
B KEEP repeated letters in it
C ADD unused letters A to Z
D SET key TO the new alphabet
Question 5
A key = {'a': 'x', 'b': 'q'}
B out = ''
C for ch in key:
D out = out + key[ch]
E print(out)

Answer Key

Monoalphabetic substitution cipher
Section A: Quick Questions
Q1
A — A scrambled alphabet
Q2
A — EQW
Q3
B — Find each cipher letter in the scrambled row and read the plain letter above it
Q4
A — ZEBRACDFGHIJKLMNOPQSTUVWXY
Q5
B — 26 factorial, about 4 x 10^26
Section B: Match the Pairs
Q1
plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ key: QWERTYUIOPASDFGHJKLZXCVBNM → A substitution key table: the top row is the normal alphabet and the bottom row is the scrambled alphabet. A becomes Q, B becomes W, C becomes E.
Q2
26! = 403291461126605635584000000 → The number of possible keys in a substitution cipher, because there are 26 choices for the first letter, 25 for the next, and so on.
Q3
A keyword alphabet starts the scrambled alphabet with a keyword (repeated letters removed), then adds the remaining letters in order. → keyword: CYBER key: CYBERADFGHIJKLMNOPQSTUVWXZ
Q4
To decrypt, use the reverse table: find each ciphertext letter in the key row and swap it for the plain letter above it. → key: QWERTYUIOPASDFGHJKLZXCVBNM plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Q -> A
Q5
key: QWERTYUIOPASDFGHJKLZXCVBNN → The key repeats the letter N and leaves out M. A valid key must use each of the 26 letters exactly once.
Q6
Encrypt HELLO with key shift 3 -> KHOOR, so the key changes for every letter. → A monoalphabetic cipher uses one fixed scrambled alphabet for the whole message. The key does not change from letter to letter.
Section C: Definitions
Q1
monoalphabetic substitution cipher — A cipher that swaps each letter for a different letter from one scrambled alphabet. That scrambled alphabet is the key, and it never changes during the message.
Section D: Fill in the Blanks
Q1
plain = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" key = "QWERTYUIOPASDFGHJKLZXCVBNM" print(len(key))
Q2
i = plain.index("H") cipher = key[i] print(cipher)
Q3
i = key.index("Z") print(plain[i])
Q4
import math print(math.factorial(26))
Q5
keyword = "ZEBRA" rest = "CDFGHIJKLMNOPQSTUVWXY" key = keyword + rest
Section E: Spot the Error
Q1
A — Two plain letters map to the same cipher letter, 'x'. A substitution key is a scrambled alphabet, so each letter must be used once. Otherwise decryption is ambiguous. It should be {'a': 'x', 'b': 'q'}.
Q2
B — The reverse table is looked up by letter, such as back['x'], so it must be a dictionary. A list can only be indexed by numbers. It should be back = {}.
Q3
A — The first letter of the scrambled alphabet can be any of the 26 letters, not 2. The choices then go 26, 25, 24 and so on, which gives 26 factorial keys.
Q4
B — A keyword alphabet must use each letter once. Repeated letters must be removed, or the key is not a valid scrambled alphabet. It should say REMOVE repeated letters.
Q5
C — The loop must go through each letter of the message, 'abba', so every letter can be swapped using the key table. Looping over the key does not encrypt the message. It should be for ch in 'abba':.