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 | |
|---|---|---|
| 17919 * 7907 | AMultiplying two primes is quick and easy, even for a computer. This is the easy forward direction of a one-way function. | |
| 2factor(62615533) | BThis assumes a one-way function can be reversed. A hash cannot be run backwards to recover the original input. | |
| 3Mixing blue and yellow paint to get green is easy, but you cannot easily unmix the green back into the two paints. | CWorking backwards from a big product to find the two primes is extremely hard. This is the hard backward direction of a one-way function. | |
| 4A hash function turns any input into a fixed-length output, but you cannot work backwards from the output to the input. | Ddigest = sha256(password) | |
| 5hash = sha256("cat") original = reverse(hash) # gets back "cat" | EThe comment has the directions the wrong way round. Multiplying two primes is easy, and factoring the result is the hard direction. | |
| 6# Factoring is easy, multiplying is hard n = p * q | Fgreen = mix(blue, yellow) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
one-way function — A calculation that is easy to do forwards but practically impossible to reverse, like mixing paint. It is the idea behind hashing and public-key encryption.p = 61
q = 53
print(p * q)n = 3233
print(n % 61)import hashlib
print(hashlib.sha256(b"paint").hexdigest())def mix(blue, yellow):
return blue + yellow
print(mix(5, 3))digest = hashlib.sha256(b"cat").hexdigest()
print(len(digest))