

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 10
click for more info
Not enough gems
Cost: 6 gems
1: Feistel Network
incomplete
2: Feistel Network
incomplete
3: Data Encryption Standard
incomplete
4: DES Review
incomplete
5: Initialization Vectors
incomplete
6: DES Feistel Network
incomplete
7: Substitution Box
incomplete
8: Substitution Box
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Many block ciphers, including DES which we'll be talking about soon, use a Feistel network (or "Feistel Cipher") as a key component of their encryption algorithms.
Feistel structures have the useful property that encryption and decryption operations are very similar and sometimes identical. Decryption only requires a reversal of the key schedule. This keeps the implementation of the algorithms simple and concise.
n = The number of ciphering rounds
L0 = Left (first) half of the plaintext bytes
R0 = Right (second) half of the plaintext bytes
K0 - Kn = The round keys (from a key schedule)
F = The round function (specific to the ciphering algorithm, like DES for example)
One of the most interesting things about Feistel networks is that the round function does NOT have to be reversible.
A Feistel cipher is not a fully-fledged encryption algorithm but is rather a framework that more complete cipher implementations (like DES) utilize.
For marketing purposes, Passly has decided to create its own Feistel network. It will use the Go standard library's SHA-256 hash function as the round function.
Here's some pseudocode:
func feistel(msg []byte, roundKeys [][]byte) []byteSplit the message into equal left and right-hand sides of equal length.
For each round:
nextRHS = xor(lhs, hash(rhs+key))
nextLHS = oldRHS
When you're done with all the rounds, return the concatenation of the right and left-hand sides (right first, then left)
The hash() and xor() functions are provided for you.