Twofish is an Advanced Encryption Standard (AES) blockcypher algorithm. Twofish is not vulnerable to a simple brute force attack and is not inherently insecure against side-channel attacks.
Let’s explore Twofish here.
In 1997, Twofish was entered into a NIST competition to replace the DES algorithm. Among the most successful cryptographic algorithms, DES was widely criticized due to its closed-door design process.
So, the goal of the NIST competition was to develop a block cipher algorithm that can flexibly handle a variety of properties:
Specifically, the NIST design criteria called for algorithms with 128-bit symmetric block ciphers that can handle 128- to 256-bit key lengths, with no weak keys, a simple design for analysis and processing in low-power devices, and implementable on a variety of platforms and applications.
Developers of the Twofish algorithm aimed to achieve these goals with a block cipher algorithm that is not vulnerable to a chosen plaintext attack with an arbitrarily large key length. Specifically, the authors aimed to develop a 16-round Twofish algorithm with no attack for 2^80 chosen plaintexts and a 12-round Twofish with no key-attack for less than 2^64 chosen plaintexts.
(Related reading: how encryption works & data encryption methods to use.)
The proposed Twofish algorithm achieved this goal by using the following capabilities and cryptographic structure:
A transformation function that takes the input data, divides it in equal blocks, each processed through a series of encryption rounds depending on the encryption keys derived from either blocks.
A non-linear substitution between block ciphers based on a predefined substitution table. The idea is to introduce small changes in the form of substitutions, which can result in significant changes on the output. This process obscures the relationship between the input and output data and can have an avalanche effect: changing a single data bit can cause a significant proportion of the corresponding block output to change.
The Maximum Distance Separable (MDS) refers to the linear distance between two field elements. This process applies a restriction on two distinct data vectors, such that the minimum distance between two elements is as large as possible.
A mathematical operation that retains the desired properties of the data transformation using fewer mathematical computations.
The process of introducing randomness with each encryption round. The mathematical operation of XOR is applied to the data before the first round and at the end of the final encryption round. Two fish uses a 128-bit text block and applies the XOR operation to four key words.
A process to ensure that subkeys used in every encryption round are different and not easily predictable.
The structure of the Twofish algorithm is as follows:
This algorithm structure is illustrated in the image below:
Twofish was designed to perform well on small devices that contain low-power processing capabilities. The performance advantage emerges from the key schedule, where twofish makes key-dependent S-box and round-subkeys with several variations depending on the application:
The encryption and decryption process can take either variation, depending on the performance capabilities of the underlying hardware and performance requirements for the applications.
At the NIST competition, the Rijndael algorithm was chosen as the winner over the Twofish algorithm due to two important factors.
Nevertheless, both the AES and Twofish algorithms have yet to be cracked. While some would argue that a longer key-length Twofish implementation may be more secure than a standard AES implementation, the choice comes down to ease of implementation, memory consumption and computational performance.
Check out our key management explainer and explore our three-part series on quantum computing: what it means for your encryptions.
See an error or have a suggestion? Please let us know by emailing ssg-blogs@splunk.com.
This posting does not necessarily represent Splunk's position, strategies or opinion.
The Splunk platform removes the barriers between data and action, empowering observability, IT and security teams to ensure their organizations are secure, resilient and innovative.
Founded in 2003, Splunk is a global company — with over 7,500 employees, Splunkers have received over 1,020 patents to date and availability in 21 regions around the world — and offers an open, extensible data platform that supports shared data across any environment so that all teams in an organization can get end-to-end visibility, with context, for every interaction and business process. Build a strong data foundation with Splunk.