<P> In cryptography, an S - box (substitution - 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 ciphertext--Shannon's property of confusion . </P> <P> 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 2 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). </P> <P> One good example of a fixed table is the S - box from DES (S), mapping 6 - bit input into a 4 - bit output: </P> <Table> <Tr> <Th_colspan="2"> S </Th> <Th_colspan="16"> Middle 4 bits of input </Th> </Tr> <Tr> <Th> 0000 </Th> <Th> 0001 </Th> <Th> 0010 </Th> <Th> 0011 </Th> <Th> 0100 </Th> <Th> 0101 </Th> <Th> 0110 </Th> <Th> 0111 </Th> <Th> 1000 </Th> <Th> 1001 </Th> <Th> 1010 </Th> <Th> 1011 </Th> <Th> 1100 </Th> <Th> 1101 </Th> <Th> 1110 </Th> <Th> 1111 </Th> </Tr> <Tr> <Th> Outer bits </Th> <Th> 00 </Th> <Td> 0010 </Td> <Td> 1100 </Td> <Td> 0100 </Td> <Td> 0001 </Td> <Td> 0111 </Td> <Td> 1010 </Td> <Td> 1011 </Td> <Td> 0110 </Td> <Td> 1000 </Td> <Td> 0101 </Td> <Td> 0011 </Td> <Td> 1111 </Td> <Td> 1101 </Td> <Td> 0000 </Td> <Td> 1110 </Td> <Td> 1001 </Td> </Tr> <Tr> <Th> 01 </Th> <Td> 1110 </Td> <Td> 1011 </Td> <Td> 0010 </Td> <Td> 1100 </Td> <Td> 0100 </Td> <Td> 0111 </Td> <Td> 1101 </Td> <Td> 0001 </Td> <Td> 0101 </Td> <Td> 0000 </Td> <Td> 1111 </Td> <Td> 1010 </Td> <Td> 0011 </Td> <Td> 1001 </Td> <Td> 1000 </Td> <Td> 0110 </Td> </Tr> <Tr> <Th> 10 </Th> <Td> 0100 </Td> <Td> 0010 </Td> <Td> 0001 </Td> <Td> 1011 </Td> <Td> 1010 </Td> <Td> 1101 </Td> <Td> 0111 </Td> <Td> 1000 </Td> <Td> 1111 </Td> <Td> 1001 </Td> <Td> 1100 </Td> <Td> 0101 </Td> <Td> 0110 </Td> <Td> 0011 </Td> <Td> 0000 </Td> <Td> 1110 </Td> </Tr> <Tr> <Th> 11 </Th> <Td> 1011 </Td> <Td> 1000 </Td> <Td> 1100 </Td> <Td> 0111 </Td> <Td> 0001 </Td> <Td> 1110 </Td> <Td> 0010 </Td> <Td> 1101 </Td> <Td> 0110 </Td> <Td> 1111 </Td> <Td> 0000 </Td> <Td> 1001 </Td> <Td> 1010 </Td> <Td> 0100 </Td> <Td> 0101 </Td> <Td> 0011 </Td> </Tr> </Table>

S-boxes are special data structures that control substitutions in block ciphers