ArticleslgStudy

computer science

Substitution–permutation network

Substitution–permutation network is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Substitution–permutation network rather than just read about it. In short: In cryptography, an SP-network, or substitution–permutation network (SPN), is a series of linked mathematical operations used in block cipher algorithms such as AES (Rijndael), 3-Way, Kalyna, Kuznyechik, PRESENT, SAFER, SHARK, and Square. Such a network takes a block of the plaintext and the key as inputs, and applies several alternating rounds or layers of substitution boxes (S-boxes) and permutation boxes (P-boxes…

Substitution–permutation network — main illustration
Substitution–permutation network — illustration

Key takeaways

  • Substitution–permutation network belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Substitution–permutation network to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Substitution–permutation network from memory before moving on to harder problems.

Reference excerpt

In cryptography, an SP-network, or substitution–permutation network (SPN), is a series of linked mathematical operations used in block cipher algorithms such as AES (Rijndael), 3-Way, Kalyna, Kuznyechik, PRESENT, SAFER, SHARK, and Square. Such a network takes a block of the plaintext and the key as inputs, and applies several alternating rounds or layers of substitution boxes (S-boxes) and permutation boxes (P-boxes) to produce the ciphertext block. The S-boxes and P-boxes transform (sub-)blocks of input bits into output bits. It is common for these transformations to be operations that are efficient to perform in hardware, such as exclusive or (XOR) and bitwise rotation. The key is introduced in each round, usually in the form of "round keys" derived from it. (In some designs, the S-boxes themselves depend on the key.) Decryption is done by simply reversing the process (using the inverses of the S-boxes and P-boxes and applying the round keys in reversed order).

Components An S-box substitutes a small block of bits (the input of the S-box) by another block of bits (the output of the S-box). This substitution should be one-to-one, to ensure invertibility (hence decryption). In particular, the length of the output should be the same as the length of the input (the picture on the right has S-boxes with 4 input and 4 output bits), which is different from S-boxes in general that could also change the length, as in Data Encryption Standard (DES), for example. An S-box is usually not simply a permutation of the bits. Rather, in a good S-box each output bit will be affected by every input bit. More precisely, in a good S-box each output bit will be changed with 50% probability by every input bit. Since each output bit changes with the 50% probability, about half of the output bits will actually change with an input bit change (cf. Strict avalanche criterion). A P-box is a permutation of all the bits: it takes the outputs of all the S-boxes of one round, permutes the bits, and feeds them into the S-boxes of the next round. A good P-box has the property that the output bits of any S-box are distributed to as many S-box inputs as possible. At each round, the round key (obtained from the key with some simple operations, for instance, using S-boxes and P-boxes) is combined using some group operation, typically XOR.

Properties A single typical S-box or a single P-box alone does not have much cryptographic strength: an S-box could be thought of as a substitution cipher, while a P-box could be thought of as a transposition cipher. However, a well-designed SP-network with several alternating rounds of S- and P-boxes already satisfies Shannon's confusion and diffusion properties:

The reason for diffusion is the following: If one changes one bit of the plaintext, then it is fed into an S-box, whose output will change at several bits, then all these changes are distributed by the P-box among several S-boxes, hence the outputs of all of these S-boxes are again changed at several bits, and so on. Doing several rounds, each bit changes several times back and forth, therefore, by the end, the ciphertext has changed completely, in a pseudorandom manner. In particular, for a randomly chosen input block, if one flips the i-th bit, then the probability that the j-th output bit will change is approximately a half, for any i and j, which is the strict avalanche criterion. Vice versa, if one changes one bit of the ciphertext and then attempts to decrypt it, the result is a message completely different from the original plaintext – SP-ciphers are not easily malleable. The reason for confusion is exactly the same as for diffusion: changing one bit of the key changes several of the round keys, and every change in every round key diffuses over all the bits, changing the ciphertext in a very complex manner. If an attacker somehow obtains one plaintext corresponding to one ciphertext – a known-plaintext attack, or worse, a chosen plaintext or chosen-ciphertext attack – the confusion and diffusion make it difficult for the attacker to recover the key.

Performance Although a Feistel network that uses S-boxes (such as DES) is quite similar to SP-networks, there are some differences that make either this or that more applicable in certain situations. For a given amount of confusion and diffusion, an SP-network has more "inherent parallelism" and so — given a CPU with many execution units — can be computed faster than a Feistel network. CPUs with few execution units — such as most smart cards — cannot take advantage of this inherent parallelism. Also SP-ciphers require S-boxes to be invertible (to perform decryption); Feistel inner functions have no such restriction and can be constructed as one-way functions.

See also Feistel network Product cipher Square (cipher) International Data Encryption Algorithm

References

Further reading Katz, Jonathan; Lindell, Yehuda (2007). Introduction to Modern Cryptography. CRC Press. ISBN 9781584885511. Stinson, Douglas R. (2006). Cryptography. Theory and Practice (Third ed.). Chapman & Hall/CRC. ISBN 1584885084.

Illustrations

Substitution–permutation network: A sketch of a substitution–permutation network with 3 rounds, encrypting a plaintext block of 16 bits into a ciphertext block of 16 bits. The S-boxes are the Si, the P-boxes are the same P, and the round keys are the Ki.
A sketch of a substitution–permutation network with 3 rounds, encrypting a plaintext block of 16 bits into a ciphertext block of 16 bits. The S-boxes are the Si, the P-boxes are the same P, and the round keys are the Ki.

Worked examples

Example 1 — a first encounter with Substitution–permutation network

Start with the simplest possible case. Write down what Substitution–permutation network claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Substitution–permutation network before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Substitution–permutation network ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Substitution–permutation network

In research
Substitution–permutation network appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Substitution–permutation network in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Substitution–permutation network is common in secondary-school and first-year university syllabi. It links to neighbouring topics Block ciphers, Cryptographic algorithms, Permutations, so understanding it makes those chapters shorter.
In everyday life
Look for Substitution–permutation network outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Substitution–permutation network” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Substitution–permutation network in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Substitution–permutation network means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Substitution–permutation network out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Substitution–permutation network in simple terms?

In cryptography, an SP-network, or substitution–permutation network (SPN), is a series of linked mathematical operations used in block cipher algorithms such as AES (Rijndael), 3-Way, Kalyna, Kuznyechik, PRESENT, SAFER, SHARK, and Square. Such a network takes a block of the plaintext and the key as…

Why does Substitution–permutation network matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Substitution–permutation network?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Substitution–permutation network.

Tags

  • Block ciphers
  • Cryptographic algorithms
  • Permutations

Keep exploring