☕
Pause for minutes until .
Remaining:
Pius Walter
T4INF1202: Kryptologie
Part 5: Feistel ciphers
2026-04-28
Recap
  • Last week, we discussed stream ciphers, block ciphers and operation modes
  • Today, we will take a peek inside the construction of a block cipher and their common components
  • More generally, we'll talk about a whole family of constructions, the Feistel network construction
Design of a cipher
  • When inspecting the design of a cipher, there are certain components that are reoccurring:
    • Product cipher construction: key schedule and round function
    • Substitution (S-boxes)
    • Permutation (P-boxes)
  • They are the essential building blocks of ciphers
Block cipher permutation
  • A block cipher is generally only an invertible permutation that is determined by a key Q4mta4Ck5NLHKZf1qH71g5gJY
  • Q4mta4Ck5NLHKZf1qH71g5gJY is the efficient and easy way of expressing this permutation
  • For a block size Q4mta4Ck5NLHbZf1qH71g5gJY, it generates a plaintext-ciphertext mapping of length Q4mta4Ck5NLH2^bZf1qH71g5gJY
Product cipher
  • A product cipher produces this permutation by applying the same function on the input data repeatedly
  • Each application is called a round of the cipher
  • Consequently, the applied function is called the round function
  • With increased number of rounds, security of the cipher increases while performance decreases
Product cipher
  • During design, this gives great flexibility to the designer
  • Iteration count can be easily tweaked to achieve the desired properties (compromise between security and performance)
  • Ciphers can be transformed into much stronger equivalents by applying slightly more rounds (e.g., AES-128 has 10 rounds, AES-256 has 14 rounds)
Product cipher
  • This also gives an advantage for cryptanalysts, since it is possible to more precisely estimate the security margin of a cipher
  • E.g., if Q4mta4Ck5NLHnZf1qH71g5gJY rounds are just within the realm of feasibility to break, one can simply choose, for example, Q4mta4Ck5NLH2nZf1qH71g5gJY in the final version
  • Cryptanalysis of round-reduced variants gives insight to the state of the security margin
  • Gives reasonable rationale for security argumentation
Product cipher
  • In summary, the core concept is iteratively applying a function which by itself would be comparatively weak
  • By applying it multiple times, the amount of mixing and the possible permutations increase exponentially
  • Linear complexity for benign user, exponential complexity for adversary
Cipher properties
  • Two core concepts of ciphers were already described by Claude Shannon 1945 in “A Mathematical Theory of Cryptography”
    • Confusion: the dependence of the outcome on different parts of the key
    • Diffusion: the dependence of the outcome on different parts of the input (avalanche property)
Key schedule
  • In a product cipher, Q4mta4Ck5NLHKZf1qH71g5gJY is usually not used to influence the round function directly
  • Instead, some internal derivation of Q4mta4Ck5NLHKZf1qH71g5gJY is performed, which generates the round keys (sometimes also called subkeys)
  • This derivation is called the key schedule or KSAKey Scheduling Algorithm and usually performed before any encryption/decryption operation runs
Key schedule
Product cipher construction
Product cipher construction
Product cipher construction
Product cipher construction
Product cipher construction
Constitution of round function
  • The round function itself is built from primitives like S-boxes and P-boxes
  • Needs to be composed so that it is highly non-linear
  • Typically, S-boxes achieve confusion while P-boxes achieve diffusion (although the two goals are typically mixed, so they cannot be separated easily)
S-box
  • A Q4mta4Ck5NLHn \times mZf1qH71g5gJY S-box (substitution box) superficially is simply a lookup table which maps input bit vectors in Q4mta4Ck5NLH\mathbb{F}_2^nZf1qH71g5gJY onto output bit vectors in Q4mta4Ck5NLH\mathbb{F}_2^mZf1qH71g5gJY
  • Q4mta4Ck5NLHnZf1qH71g5gJY and Q4mta4Ck5NLHmZf1qH71g5gJY need not necessarily be equal
  • I.e., this can be seen as a boolean vector function
  • Examples: RC4 S-box has Q4mta4Ck5NLHn = m = 8Zf1qH71g5gJY (i.e., each byte is replaced by a different byte), DESData Encryption Standard S-boxes have Q4mta4Ck5NLHn = 6, m = 4Zf1qH71g5gJY
S-box
  • Typically, but not necessarily, S-boxes need to be invertible
  • They are designed to be highly (ideally perfectly) nonlinear
  • Linearity can be quantified by using the Hadamard transform (also known as the Walsh transform), a generalization of the Fourier transform
S-box
  • Perfectly nonlinear boolean functions are also known as maximally nonlinear functions or bent functions
  • If any linear combination of bits of S-box output vectors also constitutes a bent function, the S-box is called a perfect S-box
  • Design of a good S-box is exceptionally complex topic and a research area of itself
S-box
  • I.e., the goal of a good S-box is not only to have a deterministic way of swapping values
  • It also should promote the avalanche property (i.e., roughly half the output bits flip, statistically)
  • Introduces nonlinearity in the transformation of input to output
S-box
  • An S-box is represented in code typically as a lookup table (array)
  • The display is typically given in tabular form, where the input value is the XOR of the heading column and row and the output is the cell inside
S-box example
000102Q4mta4Ck5NLH\cdotsZf1qH71g5gJY0e0f
00637c77Q4mta4Ck5NLH\cdotsZf1qH71g5gJYab76
10ca82c9Q4mta4Ck5NLH\cdotsZf1qH71g5gJY72c0
20b7fd93Q4mta4Ck5NLH\cdotsZf1qH71g5gJY3115
Q4mta4Ck5NLH\vdotsZf1qH71g5gJY
Q4mta4Ck5NLH\ddotsZf1qH71g5gJY
e0e1f898Q4mta4Ck5NLH\cdotsZf1qH71g5gJY28df
f08ca189Q4mta4Ck5NLH\cdotsZf1qH71g5gJYbb16
P-box
  • A P-box (permutation box) is simpler and is the main instrument to achieve diffusion
  • Generally, it simply maps input bits to output bits in a 1:1 fashion; it is a permutation of the input bits
  • Any P-box can be shown as an S-box, but not the other way around (the S-box is the more general construction)
P-box example
Design goals
  • A product cipher can have any arbitrary structure as long as the whole construction remains invertible
  • This means, however, that during the design of the round function, invertibility has to be kept in mind
  • Idea of a Feistel Network is to design a framework that does not need this property, i.e., the Feistel structure ensures invertibility by itself
Idea
  • The Feistel network is a product cipher which has a specific structure
  • It is most popular for its use in DESData Encryption Standard, but it is also used in GOST 28147-89, Camellia, CAST or TEATiny Encryption Algorithm
  • The round function relies on an internal function Q4mta4Ck5NLHFZf1qH71g5gJY – this is the one which needs not to be invertible
  • Versatility: for instance, hash functions can be turned into ciphers using a Feistel network
Advantages
  • Another advantage is that encryption and decryption are exceptionally similar → hardware implementations only require one instance
  • Key characteristic: blocks are cut into two halves Q4mta4Ck5NLHLZf1qH71g5gJY and Q4mta4Ck5NLHRZf1qH71g5gJY (not necessarily of the same size)
  • Identical size halves: balanced Feistel network; non-identical: unbalanced Feistel network
Feistel network round application
Structure
  • In each round, the right half becomes the left half of the next round
  • It is also used as input to Q4mta4Ck5NLHFZf1qH71g5gJY parameterized by Q4mta4Ck5NLHK_nZf1qH71g5gJY, which influences the left half (which becomes the right half next round)
QBEntEozXWioL_{n+1} = R_nkIt7msRdzcHK
QBEntEozXWioR_{n+1} = L_n \oplus F(R_n, K_n)kIt7msRdzcHK
Invertibility
  • Because the half Q4mta4Ck5NLHR_nZf1qH71g5gJY which is used as input to Q4mta4Ck5NLHFZf1qH71g5gJY makes it to the next round unmodified, this guarantees invertibility
  • Key schedule ensures all Q4mta4Ck5NLHK_nZf1qH71g5gJY are present
  • The operation can then simply be performed bottom-up, decrypting a ciphertext to a plaintext
Security
Security models
  • Increasingly strong adversary models:
    • Known-Plaintext Attack: Adversary knows plaintext-ciphertext pairs but cannot influence
    • Chosen-Plaintext Attack: Adversary can supply a plaintext and is given the corresponding ciphertext
    • Chosen-Plaintext-Ciphertext Attack: Adversary can supply either plaintext or ciphertext and is given the corresponding ciphertext/plaintext
Security
DES
32
Introduction
Introduction
Key schedule
  • The main operations of the DESData Encryption Standard KSAKey Scheduling Algorithm are the “permuted choices” (PCs) and bitwise rotation
  • Rotation length depends on the round
  • PC1 simply discards 8 of the 64 bits (sometimes used for parity reasons, but simply the NSANational Security Agency figleaf to justify a shorter key)
  • PC2 then selects 48 of 56 bits for the round keys
  • 16 of these round keys are generated
Key schedule
Key schedule
Key schedule
Key schedule
Key schedule
Key schedule
  • After the key schedule, 16 subkeys of 48 bits each have been generated
  • These are used as input for the Feistel network in the respective rounds
  • Note that the DES function Q4mta4Ck5NLHFZf1qH71g5gJY takes a half block as input (32 bits), but the subkey is 48 bit long
DES Feistel function
DES Feistel function
DES Feistel function
DES Feistel function
DES Feistel function
Feistel round application
  • This function is applied 16 times in a Feistel construction
  • The output is then a 64-bit block (64 bit input, 64 bit output)
  • This is the most basic variant of DES, the “single” DESData Encryption Standard
  • 56 bits of security is not a lot
DES constructions
  • There are three constructions that are common when using DESData Encryption Standard:
    • Single DES, used as is: 56 bit key
    • Two-key DES: 112 bit key in two chunks Q4mta4Ck5NLHK_1, K_2Zf1qH71g5gJY:
      Q4mta4Ck5NLHC = E_{K_1}(D_{K_2}(E_{K_1}(P)))Zf1qH71g5gJY
    • Triple DES (3DES, TDESTriple DES, DES-EDE): 168 bit key in three chunks Q4mta4Ck5NLHK_1, K_2, K_3Zf1qH71g5gJY:
      Q4mta4Ck5NLHC = E_{K_3}(D_{K_2}(E_{K_1}(P)))Zf1qH71g5gJY
Security
  • The security of macroscopic constructions is not straightforward to analyze
  • While the simple variant for a key length of 56 bits provides (ideally) 56 bits of security, the composed variants do not provide 112/168 bits of security
  • The exact reasons are beyond the scope of this lecture and are widely described in literature
2KTDES
3KTDES
  • The security of triple DESData Encryption Standard is bound by the meet-in-the-middle attack
  • The principle behind this attack is that the attacker can attack different parts of the composed function separately
  • Recall that in TDESTriple DES Q4mta4Ck5NLHC = E_{K_3}(D_{K_2}(E_{K_1}(P)))Zf1qH71g5gJY
Meet-in-the-middle attack
  • An attacker who has a pair Q4mta4Ck5NLHP, CZf1qH71g5gJY can now perform Q4mta4Ck5NLH2^{56}Zf1qH71g5gJY evaluations with candidates for Q4mta4Ck5NLHK_3Zf1qH71g5gJY, evaluating Q4mta4Ck5NLHD_{K_3}(C)Zf1qH71g5gJY
  • This creates a table with Q4mta4Ck5NLH2^{56}Zf1qH71g5gJY entries, a map between Q4mta4Ck5NLHK_3Zf1qH71g5gJY candidates and decrypted ciphertexts
  • I.e., this is from the “outside” to the “inside” (first step of TDESTriple DES decryption)
Meet-in-the-middle attack
  • Then, the attacker performs Q4mta4Ck5NLH2^{112}Zf1qH71g5gJY evaluations with candidates for Q4mta4Ck5NLHK_1, K_2Zf1qH71g5gJY, performing Q4mta4Ck5NLHD_{K_2}(E_{K_1}(P))Zf1qH71g5gJY
  • This is from the “inside” to the “outside” (first two steps of TDESTriple DES encryption)
  • For each value, the attacker compares with the table from step 1. If a match is found, the attack can try if Q4mta4Ck5NLHK_1, K_2, K_3Zf1qH71g5gJY fit
Meet-in-the-middle attack
  • Since the asymptotic complexity of Q4mta4Ck5NLH2^{56}Zf1qH71g5gJY is negligible compared to the Q4mta4Ck5NLH2^{112}Zf1qH71g5gJY operations, this means the latter dominates the total complexity
  • The security of TDESTriple DES is therefore always at most 112 bits
  • In practice, it is worse because there are algorithmic attacks on DESData Encryption Standard
Conclusion
47
Takeaway
Takeaway
  • Feistel networks are an elegant cryptographic construction with many advantages
  • They have fallen out of favor recently; cannot compete performance-wise at same security level
  • Compound cryptographic constructions are difficult to estimate accurately without knowledge of the underlying attacks
  • You should be able to explain the impact of a possible meet-in-the-middle attack
Thank you!
Any questions?
Acronyms