Lably
Skip to content

S-box

Basic component of symmetric key algorithms

  • 2 min read
  • 2 chapters

Explore on Lably

ToursExplore Lably’s 3D tours

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 (DES), but in some ciphers the tables are generated dynamically from the key (e.g. the Blowfish and the Twofish encryption algorithms).

Example

One good example of a fixed table is the S-box from DES (S5), 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 (the first and last 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".

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication