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 | |
|---|---|---|
| 1base64.b64encode(b"Hi") | ATreating Base64 as encryption. There is no key, so anyone can decode it and read the password. | |
| 2base64.b64decode("SGk=") | BRewrites the bytes of Hi as Base64 text (SGk=). No key is used, so anyone can turn it back. | |
| 3Base64 uses only 64 printable characters, so binary data can travel as plain text. | CA-Z a-z 0-9 + / | |
| 4Hex uses 16 characters for each 4 bits, while Base64 uses 64 characters for each 6 bits, so Base64 is shorter. | DHi = 4869 (hex) or SGk= (Base64) | |
| 5secret = base64.b64encode(password) # now it is safe | EBase64 is not encrypted and has no secret key. Anyone can decode SGVsbG8= to Hello. | |
| 6Encrypted with Base64: SGVsbG8= (only I can read it) | FReverses Base64 text back to the original data (Hi) with no password or key needed. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Base64 — Rewrites data using 64 printable characters so it can be sent as text. It has no secret key, so anyone can reverse it. It is encoding, not encryption, and protects nothing.import base64
msg = b"Hi"
print(base64.b64encode(msg))import base64
coded = base64.b64encode(b"Hello")
print(coded)import base64
coded = "SGk="
print(base64.b64decode(coded))text = "SGk="
data = base64.b64decode(text)
print(data)data = b"Hi"
print(data.hex())
print(base64.b64encode(data))