Twofish
Schneier and colleagues' AES finalist with key-dependent S-boxes
Overview
Twofish is a 128-bit block cipher designed by Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall and Niels Ferguson. It was one of the five AES finalists and is the successor to Blowfish.
Twofish is a 16-round Feistel network. Its round function g applies four key-dependent 8-bit S-boxes and an MDS matrix, and two g outputs are combined with a pseudo-Hadamard transform and round subkeys. Additional one-bit rotations and input and output whitening with key material complete the round. Key-dependent S-boxes make the cipher's internal tables unknown to an attacker, at the cost of a more complex key schedule.
NextSSL includes Twofish with 128-, 192- and 256-bit keys. It is available in GnuPG, VeraCrypt and many cryptographic libraries. Its key schedule can be precomputed for speed or computed on the fly to save memory, and the designers documented many implementation trade-offs. Twofish was released unpatented and free for any use.
History
1997–2001NIST calls for a successor to DES
AES selection processTwofish published
15 candidates accepted
AES selection processFive finalists: MARS, RC6, Rijndael, Serpent and Twofish
AES selection processRijndael selected
AES selection processAES published as FIPS 197
AES selection process
Security notes
No practical attacks on full Twofish are known; published results break reduced rounds only. It is slower than AES on hardware with AES instructions and is mostly used where cipher diversity is desired.
Typical uses
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| Twofish twofish |
standard | key 16–32 · block 16 | AES finalist (Twofish) | safe |
Frequently asked questions
Which Twofish variants does NextSSL include?
NextSSL registers 1 Twofish variant: twofish.