Lesson 6 of 15
Feistel Network
Feistel Network
A Feistel network (Horst Feistel, IBM, 1973) is a symmetric structure used in many block ciphers including DES. Its key insight: you can build an invertible cipher from a non-invertible round function.
One Round
Split the block into two halves and . Apply the round function with round key :
The structure is automatically invertible — to reverse a round:
Multi-round Encryption
Repeat the round with different subkeys . More rounds → more diffusion and confusion.
Our Simulation
We use 4-bit halves (from an 8-bit block: , ) with round function:
Combined in the round:
DES
DES uses a 64-bit block with 16 Feistel rounds and 56-bit keys. It was the US federal standard from 1977 to 2001, superseded by AES.
Your Task
Implement:
feistel_round(L, R, K)→(new_L, new_R)wherenew_L = R,new_R = L XOR (R+K)%256feistel_encrypt(plaintext, keys)— apply rounds with each key in sequencefeistel_decrypt(ciphertext, keys)— apply rounds in reverse order using inverse round
Python runtime loading...
Loading...
Click "Run" to execute your code.