S-box


In cryptography, an S-box is a basic component of symmetric key algorithms which performs substitution. In block ciphers, they are typically used to obscure the relationship between the key and the ciphertextShannon's property of confusion.
In general, an S-box takes some number of input bits, m, and transforms them into some number of output bits, n, where n is not necessarily equal to m. An m×n S-box can be implemented as a lookup table with 2m words of n bits each. Fixed tables are normally used, as in the Data Encryption Standard, but in some ciphers the tables are generated dynamically from the key.
One good example of a fixed table is the S-box from DES, mapping 6-bit input into a 4-bit output:
Given a 6-bit input, the 4-bit output is found by selecting the row using the outer two bits, and the column using the inner four bits. For example, an input "011011" has outer bits "01" and inner bits "1101"; the corresponding output would be "1001".
The 8 S-boxes of DES were the subject of intense study for many years out of a concern that a backdoor — a vulnerability known only to its designers — might have been planted in the cipher. The S-box design criteria were eventually published after the public rediscovery of differential cryptanalysis, showing that they had been carefully tuned to increase resistance against this specific attack. Biham and Shamir found that even small modifications to an S-box could significantly weaken DES.
There has been a great deal of research into the design of good S-boxes, and much more is understood about their use in block ciphers than when DES was released.
Any S-box where any linear combination of output bits is produced by a bent function of the input bits is termed a perfect S-box.