S-boxAn s-box (or substitution box) is a way of reducing linearity within cryptosystems, in order to defeat certain kinds of cryptanalysis and are commonly a part of many block ciphers. Essentially, s-boxes are invertible functions that transform a series of input bits in order to reduce linearity, generally through a fixed lookup table (as in the Data Encryption Standard) or through a lookup table created using key and plaintext material (as in the Blowfish encryption algorithm and the Twofish encryption algorithm).
An s-box can often be treated as a simple substitution:
- 1 -> 3
- 2 -> 1
- 3 -> 4
- 4 -> 2
In order to decipher the output text, it is simply fed into the s-box in reverse, giving the original inputs.