• Plaintext = 0010 1000
• IP = (2,6,3,1,4,8,5,7)
• EP = (4,1,2,3,2,3,4,1)
• IP⁻¹ = (4,1,3,5,7,2,8,6)
• K1 = 11101001, K2 = 10100111
• S0, S1
• P4 = (2,4,3,1)
Step 1: Apply Initial Permutation (IP)
Plaintext bits (1..8): 0 0 1 0 1 0 0 0
IP = (2,6,3,1,4,8,5,7)
So:
• b2 b6 b3 b1 b4 b8 b5 b7
=0 0 1 0 0 0 1 0
After IP: 0010 0010
Split: L0 = 0010, R0 = 0010
Step 2: Round 1 (fk with K1)
2.1 EP on R0
R0 = 0010 (bits r1 r2 r3 r4 = 0 0 1 0)
EP = (4,1,2,3,2,3,4,1)
So:
• r4 r1 r2 r3 r2 r3 r4 r1
=0 0 0 1 0 1 0 0
EP(R0) = 00010100
2.2 XOR with K1
EP(R0) = 00010100
K1 = 11101001
XOR:
00010100 ⊕ 11101001 = 11111101
= 11111101
Split into two 4-bit parts:
• Left4 = 1111 → goes to S0
• Right4 = 1101 → goes to S1
2.3 S-box outputs
S0 input = 1111
• Row = outer bits = 1 _ _ 1 → 11₂ = 3
• Col = inner bits = _ 1 1 _ → 11₂ = 3
S0[3][3] = 2 → 10
S0 output = 10
S1 input = 1101
• Row = outer bits = 1 _ _ 1 → 11₂ = 3
• Col = inner bits = _ 1 0 _ → 10₂ = 2
S1[3][2] = 0 → 00
S1 output = 00
Combine: 10 00 → 1000
2.4 Apply P4
P4 = (2,4,3,1)
Input = 1 0 0 0
Output = b2 b4 b3 b1 = 0 0 0 1
P4 output = 0001
2.5 XOR with L0
L0 = 0010
P4 = 0001
0010 ⊕ 0001 = 0011
New Left = 0011
Right stays R0 = 0010
So after Round 1:
0011 0010
Step 3: Switch (SW)
Swap halves:
0011 0010 → 0010 0011
So:
• L = 0010
• R = 0011
Step 4: Round 2 (fk with K2)
4.1 EP on R
R = 0011 (r1 r2 r3 r4 = 0 0 1 1)
EP:
r4 r1 r2 r3 r2 r3 r4 r1
=1 0 0 1 0 1 1 0
EP(R) = 10010110
4.2 XOR with K2
EP(R) = 10010110
K2 = 10100111
XOR:
10010110 ⊕ 10100111 = 00110001
= 00110001
Split:
• Left4 = 0011 → S0
• Right4 = 0001 → S1
4.3 S-box outputs
S0 input = 0011
Row = 0 _ _ 1 → 01₂ = 1
Col = _ 0 1 _ → 01₂ = 1
S0[1][1] = 2 → 10
S0 = 10
S1 input = 0001
Row = 0 _ _ 1 → 01₂ = 1
Col = _ 0 0 _ → 00₂ = 0
S1[1][0] = 2 → 10
S1 = 10
Combine: 10 10 → 1010
4.4 P4
Input 1 0 1 0
P4 (2,4,3,1) → 0 0 1 1
P4 = 0011
4.5 XOR with Left
L = 0010
P4 = 0011
0010 ⊕ 0011 = 0001
So after Round 2:
0001 0011
Step 5: Apply IP⁻¹
IP⁻¹ = (4,1,3,5,7,2,8,6)
Input bits = 00010011 (b1..b8 = 0 0 0 1 0 0 1 1)
Pick:
• b4 b1 b3 b5 b7 b2 b8 b6
=1 0 0 0 1 0 1 0
Ciphertext = 1000 1010