- Type in, or copy and paste, the code from Listing 3-3 in the Nielson book.
- Run the code several times. Make sure you understand what is happening. Modify the key and/or the message and run the program again. What changes do you notice?
- Look at Listing 3-2 to discover how to print the hex code for the ciphertext. Print the ciphertext in hex.
- How long is the ciphertext in hex? How many blocks does that translate into?
- Research slicing in Python. Print the first and last blocks (in hex) of the ciphertext.
- Print all blocks of the ciphertext.
- Exercise 3.6 from the Nielson book. (Modify your program to encrypt and decrypt several meetup messages, as in the example on page 66. Be sure to include some from Bob to Alice as well as Alice to Bob.)
- Print out the corresponding blocks from each message, as on pages 66-67. Where do you notice similarities, and why? Do they have the same number of blocks? Why or why not?
- Determine the type of object that the ciphertext is. Use
the
type
function in Python. - In Python,
bytes
objects are immutable, which means they cannot change.List
andbytearray
objects are mutable. Explore converting one of your ciphertexts to these objects and changing some portion of the ciphertext. What happens? Do you get the same plaintext once you decrypt?