Feistel Cipher Visualized

4 rounds · MD5 round function · animated bit-level walkthrough

How can a one-way function power a reversible cipher?

A Feistel network splits plaintext into two halves — L (left) and R (right). Each round feeds R and a round key Ki into a one-way function F (here, MD5), then XORs the output with L. Finally the halves are swapped.

The magic: you never need to invert F! During decryption, the same structure "undoes" each round because XOR is its own inverse: if A ⊕ B = C, then C ⊕ B = A. The one-way function is only ever evaluated forward — its output is simply XORed again to cancel out.

So MD5 (irreversible, lossy, maps any input to 128 bits) works perfectly here — the cipher's reversibility comes from the Feistel structure, not from the round function.

Speed: Normal