Python block cipher

Continue with the exercise 4 encryption/decryption code (the example code or your own code) and enhance it to be able to encrypt data of any size.

  1. The name of the file that is going to be encrypted is the only parameter.
  2. Request the encryption key from the user.
  3. Use an initialization vector (ask from user or generate a random) where appropriate.
  4. Encrypt the data in 64 bit blocks.
  5. Implement the following block cipher modes and combine the blocks with them



  • An example answer, that supports ASCII files only. To run:
    python CBC|ECB filename
    • Remember to edit the BitVector append path if your BitVector is not the same version (3.3.1) or is not in the same path (./packages/BitVector-3.3.1).
    • The user input reading method is just purely for demonstrative purposes - never use this kind of approach.
Last modified: 2014/02/18 11:57