This lab is done in groups of 2. The goal of the lab is to implement DES and evaluate the quality of 2 rounds of DES encryption using statistical analysis.

DES (Data Encryption Standard) algorithm is publicly known and described in all details. The only secret portion of DES encryption is the key.

- General DES description and setup
- Expansion function, S-boxes, permutation, and key schedule.
- A nice step-by-step example of DES encryption.

- Work in pairs or groups of three. Some collaboration between groups between groups is fine for the implementation part (for instance, sharing S-boxes with other groups is encoding is fine).

- Write a function (a method) that takes a 32-bit binary plaintext and a 48-bit key and encrypts the plaintext using a DES round with that key.
- Write a program that runs N rounds of DES (recall that DES works as a Feistel cipher, i.e. it encrypts only half of the current text in one round. . We ignore the initial permutation.
- Write a function to choose 48 bits (each) for the first and second rounds of DES according to the key schedule.

The goal is to determine whether any patterns of the original plaintext are preserved after two rounds of DES. Compare decryption of very structured patterns to that of random bit-strings. For each encryption try comparing frequencies of zeros and ones in the resulting encryption or in any of its subsets (e.g. the first half or all odd-numbered bits). Specifically you need to try the following:

- At least three very structured patterns, such as all zeros, half ones half zeros, etc.
- At least three randomly generated plaintexts (use a seeded random number generator for repeatability), for comparison to patterned plaintexts
- Three random 56-bit keys of 0s and 1s (with equal probability of each) that will be used in the DES

Encrypt each of the six plaintexts using two rounds of DES with each of the three keys (choose the key bits according to the key schedule) and try statistical analysis to see if frequencies of bits in the entire ciphertexts or in its portion (or individual bits) are predictable from the plaintext. The dependencies must manifest themselves for all three keys and must be clearly distinct from encryption of a random plaintext.

Write down your analysis, the results, and the conclusions. Submit all your code, including supplemental code (e.g. programs that you used for statistical analysis, such as R or statistical packages, if you choose to use them).

- All your program code (well-documented) and instructions for running it.
- All the keys and the plaintexts that you used and all the corresponding ciphertexts.
- Any helper code that you used.
- Your detailed analysis and conclusions.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.