Feistel Cipher Structure and AES Key Expansion (First 4 Bytes)
Part A: Feistel Cipher Structure
Feistel Cipher is a symmetric block cipher structure that divides the plaintext into two equal halves and processes them through multiple rounds of substitution and permutation, using sub-keys derived from the main key.
Working Principle:
The plaintext block is split into two halves: Left (L) and Right (R). In each round, one half is modified using a round function F and a sub-key, then the halves are swapped.
Structure of Each Round:
For round i:
Li=Ri−1
Ri=Li−1⊕F(Ri−1,Ki)
Where Ki is the sub-key for round i and F is the round function.
Block Diagram (described in words):
- Plaintext is divided into L₀ (left half) and R₀ (right half)
- R₀ is passed through function F along with sub-key K₁
- Output of F is XORed with L₀ to produce R₁
- R₀ becomes L₁ (swap)
- This process repeats for n rounds
- After the final round, the two halves are combined to form ciphertext
Key Properties:
- Encryption and Decryption use the same structure (sub-keys applied in reverse order for decryption)
- Round function F need not be invertible
- Security increases with more rounds
- Examples: DES (16 rounds), Blowfish, Camellia
Part B: AES Key Expansion — First 4 Bytes of Next Key After First Iteration
Given Key (16 bytes):
| W0 |
W1 |
W2 |
W3 |
| 2B 7E 15 16 |
28 AE D2 A6 |
AB F7 97 66 |
01 02 03 04 |
AES Key Expansion Formula:
W4=W0⊕g(W3)
Where g() function involves:
- a) RotWord — Circular left shift of W3 by 1 byte
- b) SubBytes — Substitute each byte using S-Box
- c) XOR with Rcon — XOR first byte with round constant
Step-by-step Computation:
Step i: Take W3
W3=[01,02,03,04]
Step ii: RotWord (circular left shift by 1 byte)
RotWord(01,02,03,04)=[02,03,04,01]
Step iii: SubBytes using S-Box
For each byte, the row = upper nibble and column = lower nibble:
- Byte 02 → Row 0, Col 2 → S-Box value = 77
- Byte 03 → Row 0, Col 3 → S-Box value = 7B
- Byte 04 → Row 0, Col 4 → S-Box value = F2
- Byte 01 → Row 0, Col 1 → S-Box value = 7C
SubBytes=[77,7B,F2,7C]
Step iv: XOR with Rcon(1)
Round constant for first round: Rcon(1)=[01,00,00,00]
[77⊕01, 7B⊕00, F2⊕00, 7C⊕00]=[76,7B,F2,7C]
So, g(W3)=[76,7B,F2,7C]
Step v: Compute W4 = W0 ⊕ g(W3)
W0=[2B,7E,15,16]
W4=[2B⊕76, 7E⊕7B, 15⊕F2, 16⊕7C]
W4=[5D,05,E7,6A]
Final Answer:
The first 4 bytes of the next key after the first iteration are: 5D 05 E7 6A