Information Security: 4. DES
Introduction
Two Types of Cipher
- stream cipher
- prone to error or loss
- block cipher
- partial errors don't affect entire data
N-bits Encryption
- example: n=2
00 => 11 01 => 10 10 => 00 11 => 01
- It needs a table of 2^n * n bits
Feistel Cipher
- Encryption
Input: n=32
[ LE0 | RE0 ]
Round 1:
LE1 = RE0
t = F(RE0, K1)
RE1 = LE0 XOR t
[ LE1 | RE1 ]
Round 2:
LE2 = RE1
t = F(RE1, K2)
RE2 = LE1 XOR t
[ LE2 | RE2 ]
...
Round 16:
[ LE16 | RE16 ]
Last (swap):
LE17 = RE16
RE17 = LE16
[ LE17 | RE17]
- Input size and round iteration can be optimized
- Decryption
[ LD0 | RD0 ] (= LE17, RE17)
LD1 = RE17
t = F(RE17, K16)
RD1 = LE17 XOR t
[ LD1 | RD1 ]
...
[ LD16 | RD16 ]
LD17 = RD16
RD17 = LD16
[ LD17 | RD17 ] (Plaintext)
- Explain
LD1 = RD0 = LE16 = RE15 RD1 = LD0 XOR F(RD0, K16) = RE16 XOR F(LE16, K16) = LE15 XOR F(RE15, K16) XOR F(LE16, K16) = LE15 XOR F(RE15, K16) XOR F(RE16, K16) = LE15 XOR 0 = LE15
Simplified DES (SDES)
Example
- Input: 8-bit
- Key: 10-bit; additional keys can be derived
SDES Practice
- Plaintext = 0111 0010
- Key = 10100 00010
Sub-key generation
- P10
- change position
- 1 2 3 4 5 6 7 8 9 10 -> 3 5 2 7 4 10 1 9 8 6
- LS-1
- left shift 1 (LSB will be at RSB)
- P8
- 6 3 7 4 8 5 10 9 (1, 2 not used)
- LS-2
- left shift 2 (LS-1 twice)
Encryption
- IP; initial permutation
- change position (like P10)
- E/P; extend permutation
- 1 2 3 4 -> 4 1 2 3 2 3 4 1
- S0-box
- with a 4*4 matrix
- xyzw -> xw, yz
- output = matrix[xw][yz]
- 0b0110 => matrix[0b00][0b11]
- S1-box; same but different matrix
- SW; swap
- IP^-1
- 4 1 3 5 7 2 8 6
Decryption
- same but using keys in reversed order