Another example of the evolution of cryptographic technology is found in the Twofish algorithm, one of the finalists in the AES competition.

In summary, Twofish is a symmetric block cipher that operates on 128-bit blocks in 16 rounds that works in all standard modes. It can accept key lengths up to 256 bits. Twofish is a Feistel network in that in each round, one-half of the 128-bit block of plaintext or modified plaintext is fed into an element called the F Function box and then is XORed with the other half of the text in the network.

This one-half block is broken into two 32-bit units that are, in turn, broken into four bytes.

These four bytes are fed into four different, key-dependent S-boxes and emerge from the S-boxes as four transformed output bytes.

The four output bytes of the S-boxes are combined in a Maximum Distance Separable (MDS) matrix to form two 32-bit units.

These two 32-bit units are then combined by using a Pseudo-Hadamard Transform (PHT) and are added to two round subkeys.

The PHT is a linear operation of the form d1 = (2b1 + b2)mod 256 where b1 and b2 are the inputs, and d1 is the output.

These results are XORed with the right half of the 64 bits of the plaintext. In addition, 1-bit rotations are performed before and after the XOR.

These operations are then repeated for 15 more rounds. Twofish also employs what is termed as prewhiteningŽ and postwhitening, Ž where additional subkeys are XORed with the plaintext before the first round and after the 16th round.

This approach makes cryptanalysis more difficult, because the whitening subkeys have to be determined in addition to the algorithm key.

In the Twofish algorithm, the MDS matrix, the PHT, and key additions provide diffusion.