### Problem Set #2

#### Due: Feb 22nd, 2005 at 11am

Remember, your homework MUST be submitted in LaTeX!

For this problem, I have implemented DES for you. Use it if you please.

Do not hand in homework electronically; print it out and bring it to class.

Problem 1. (Difficulty: 3) Change DES to WDES as described in class. This entails taking the DES code above and setting rounds to 16, leaving off the IP and IPI and FINAL_REVERSE switches, and modifying the S-boxes to be linear in the way we described. Then find the key that maps plaintext (9237bca1, f62011da) to ciphertext (a35498dc, 1b44aaa9). Turn in your code as usual along with an execution.

Problem 2. (Difficulty: 3) The DES code above is ready to go for 3-round differential attacks. We will use the differential given in class (Fig 3.10 of Stinson). In particular, use the following pairs (by adding this code to hwdes.c):

```int pairs[][2][2][2] = {
{
{ {0x748502cd, 0x38451097}, {0x03c70306, 0xd8a09f10} },
{ {0x38747564, 0x38451097}, {0x78560a09, 0x60e6d4cb} }
},
{
{ {0x48691102, 0x6acdff31}, {0x45fa285b, 0xe5adc730} },
{ {0x375bd31f, 0x6acdff31}, {0x134f7915, 0xac253457} }
},
{
{ {0x357418da, 0x013fec86}, {0xd8a31b2f, 0x28bbc5cf} },
{ {0x12549847, 0x013fec86}, {0x0f317ac2, 0xb23cb944} }
}
};
```
Now mount a differential attack using these three pairs to completely recover the key. Note that you will have to do an exhaustive key search after the initial differential attack is done.

Turn in your code as usual along with an execution.

Problem 3. (Difficulty: 3) We now lauch a differential attack against 6-round DES, using the 3-round differential given in class (Fig 3.12 of Stinson). Set the number of rounds to 6, and fix the key (yes, you heard me, pick a key and fix it in your program). Because we will need about 120 input pairs, I'm going to let you generate them yourself rather than give them to you as I did in problem 2.

Now, generate the pairs with the given differential, filter out the wrong pairs, and tabulate counters for the key candidates. Recover the key for 6-round DES (no cheating even though the key is in your program to begin with!).

Turn in your code as usual along with an execution.