Day 2: Symmetric Encryption
Resources (optional)
- one-time pad: video
Lecture Topics
- notes
- one-time pad
- the two-time pad is insecure
- limitations
- pseudo-random generators
- stream ciphers
Problems
Reminders:
- You can run tests for a function by running
python main.py FUNCTION_NAME
from the shell.
We’ll be working in the main.py
file. The cryptoy.py
library contains
the PRG function, cryptoy.prg(seed, n_bytes)
that you’ll use for the stream
cipher.
-
done together:
bytes_to_bitstring
bitstring_to_bytes
-
required:
random_bytes
xor
bitstring_xor
one_time_pad_encrypt
one_time_pad_decrypt
stream_cipher_encrypt
stream_cipher_decrypt
-
bonus:
- the “daisy chain” PRG:
prg1
daisy_chain_prg
- binary formatting and parsing
int_to_binary
,binary_to_int
- cryptanalyzing the many-time pad
many_time_pad_cryptanalysis
- the “daisy chain” PRG: