Skip to content
uencoder

Twofish

Twofish is a symmetric block cipher designed by Bruce Schneier et al. for the AES competition, using 128-bit blocks with 128/192/256-bit keys; it was one of the AES finalists.

Purpose

It offered a secure alternative in the AES competition, adopting a different structure (Feistel + key-dependent S-boxes) to diversify analysis.

Mechanism

It is a 16-round Feistel network on 128-bit blocks. It uses four key-dependent S-boxes (determined by the key), combined with an MDS matrix and a pseudo-Hadamard transform. The key schedule is relatively complex but provides whitening (input/output key XORs).

Use cases

  • AES competition historical research
  • An optional algorithm in some crypto libraries
  • Cryptography teaching
  • A high-security alternative

Examples

  • Input
    key=256bit, data=16bytes
    Output
    16-byte ciphertext

    AES finalist

Common errors

Mistaking Twofish for the AES standard
AES ultimately selected Rijndael

Related terms

Related tools

References