Part 3: The figure below describes a block cipher LDES (“linear” DES). LDES is a mini example of a block cipher that has 2 rounds in the Feistel network. It operates on 4-bit block and 2-bit key. The important feature of LDES is that the S-box has been replaced with a linear operation which makes the whole cipher linear. The purpose of this exercise is to help you understand the importance of S-box in DES. Without the S-box, the cipher becomes linear and can be totally broken. This exercise will guide you step by step to break the linear cipher LDES. 1. Based on the encryption in the figure above, draw a diagram for the corresponding decryption. 2. Implement the encryption / decryption algorithms using C++ or Java. 3. For each key = 00, 01, 10, 11, calculate E(0000), E(1000), E(0100), E(0010), E(0001), E(1100), E(1010), E(1001), E(0110), E(0101), E(0011), E(0111), E(1011), E(1101), E(1110), E(1111). Verify that, for every key, E(1100) = E(1000) + E(0100) + E(0000). Write similar equations for E(1010), E(1001), E(0110), E(0101), E(0011), E(0111), E(1011), E(1101), E(1110), E(1111) in terms of E(0000), E(1000), E(0100), E(0010), E(0001). This demonstrates that if an adversary knows E(0000), E(1000), E(0100), E(0010), E(0001), he can encrypt any message. In general, for a linear cipher with block size n, if an adversary knows n + 1 pairs of plaintext/ciphertext, he can encrypt/decrypt any messages without even knowing the key. 2
Part 2: Consider a block cipher MDES (“mini” DES) which works exactly the same as LDES, except that the operation from (I1, I2, I3) to (J1, J2) is based on the following S-box I1I2I3 000 001 010 011 100 101 110 111 J1J2 00 00 00 01 00 00 10 11 4. Implement the encryption / decryption algorithms of MDES using C++ or Java. 5. Using MDES, for each key = 00, 01, 10, 11, calculate E(0000), E(1000), E(0100), E(0010), E(0001), E(1100), E(1010), E(1001), E(0110), E(0101), E(0011), E(0111), E(1011), E(1101), E(1110), E(1111). Verify that the equations that you observe in question 3 now is no longer valid 6. Implement MDES in two modes: ECB and CBC using C++ or Java. Both modes ECB and CBC do not need message padding. Your program should accept a key as 2-bit binary string, a message as hex string and outputs a ciphertext as a hex string on the console. For example: YourProgram -key 10 -mode ECB -encrypt f4a5a32 YourProgram -key 01 -mode ECB -decrypt b6f7a11 YourProgram -key 11 -mode CBC -iv a -encrypt 2a45def YourProgram -key 00 -mode CBC -iv 4 -decrypt b412ab2 Note that each hex character is a 4-bit block message.
The post describes a block cipher LDES appeared first on My Assignment Online.