Substitution–permutation network


In cryptography, an SP-network, or substitution–permutation network, is a series of linked mathematical operations used in block cipher algorithms such as AES, 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 and permutation boxes to produce the ciphertext block. The S-boxes and P-boxes transform 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 and bitwise rotation. The key is introduced in each round, usually in the form of "round keys" derived from it.
Decryption is done by simply reversing the process.
An S-box substitutes a small block of bits by another block of bits. This substitution should be one-to-one, to ensure invertibility. In particular, the length of the output should be the same as the length of the input, which is different from S-boxes in general that could also change the length, as in DES, for example. An S-box is usually not simply a permutation of the bits. Rather, a good S-box will have the property that changing one input bit will change about half of the output bits. It will also have the property that each output bit will depend on every input bit.
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 is combined using some group operation, typically XOR.
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:
Although a Feistel network that uses S-boxes 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 ; Feistel inner functions have no such restriction and can be constructed as one-way functions.