CSE 539 – 2018

Project 2
Due: Feb 25th  15th, 2018

Groups: This HW to be done in groups of 2 (mandatory).

Note: You have to use 32 bit machineseither use 32 bit Linux, or compile with –m32 option. Also, you may need to do:
sudo apt-get install libc6-dev-i386 gcc-multilib g++-multilib


The code provided will not work if used on 64 bit machines.

You are given a ZIP file >> here.

This file contains two C programs encrypt.c and decrypt.c (it also has md5.h which contains MD-5 routines used by the encrypt/decrypt programs). In addition it contains the encrypted versions of a text file, an image file (png format) and a PDF file. Compile and run the programs as described below (due to code in md5.h you may get a lot of warnings, ignore warnings from the md5.h file). Tested under Ubuntu Linux.

The programs use 32-bit block encryption, like HW1.

To run the encrypt program, use the command: ./encrypt <filename>. The encrypted output will be in a file called “output”. The key used will be printed – the program generates a key from system entropy.

To run the decrypt program, use the command: ./decrypt <key>. The key has to be the correct key. The program will read encrypted data from “output” and write decrypted data into the file “output-dec”.

1.     Look at the code for MD-5 and compare with the block diagrams (on Wikipedia).

2.     Test the programs on text, image and pdf files. The carefully look at the code and understand how it works. Write down the algorithm used. (Do you think this encryption algorithm “cheats” – that is it is not a self contained encryption algorithm?)

3.     Brute force the keys for the three files provided (note, knowing the type of the file – text, png, pdf – helps in brute forcing) and find the keys used. You may modify the programs. Do not assume you know the plaintext, but assume you know what type of plaintext it is (text, jpg, pdf, etc)

4.     Find weaknesses of the cipher design.

5.     Attempt to use the weaknesses found, to find keys faster. Much faster!



A short report (hardcopy) with answers for 2, 3, 4 and 5. (Note: 1 is missing).

Methods of submission:
Hard copy, hand it in, in class.
 Hand on only 1 copy with 2 names.



Any questions please post to discussion board. Also you may contact graders for personal attention.