Introduction to the
In the previous article, we talked about blowfish because of the small size of 64bits at a time, it is not recommended to use blowfish to encrypt files larger than 4 gigabytes. At the same time because the encryption block is small will also lead to birthday attacks. Hence Blowfish’s successor, Twofish.
Today we’re going to take a look at twofish.
The origin of twofish
Twofish, like Blowfish, is a symmetric encryption algorithm. The difference is that twofish’s block size is 128bits, while its key length is 256bits.
AES is a Standard symmetric block cipher technology approved by The National Institute of Standards and Technology (NIST).
AES was selected from 1997 to 2000. It was created primarily to replace DES. Because DES has only a 56-bit key, it is vulnerable to violent attacks.
NIST announced on January 2, 1997 that they wished to choose a successor to DES, AES. Like DES, it was supposed to be “an unpublished, public encryption algorithm that protected sensitive government information well before the 20th century.” However, rather than simply naming a successor, NIST conducted an open selection process in which candidates were required to provide relevant information that they were superior to DES. There was immediate interest in the open solicitation.
In the following months, NIST received 15 proposals from a number of countries. They are CAST-256, CRYPTON, DEAL, DFC, E2, FROG, HPC, LOKI97, MAGENTA, MARS, RC6, Rijndael, SAFER +, Serpent and Twofish.
In subsequent evaluations, cryptography researchers evaluated the candidate algorithms for security, performance, and limited environment operation, and announced five finalists in August 1999: MARS, RC6, Rijndael, Serpent, and Twofish.
Finally, on October 2, 2000,NIST announced the selection of Rijndael as the final AES algorithm. It was adopted as the official AES standard on November 26, 2001.
Twofish isn’t the final AES standard, but it’s pretty impressive to be in the top 5.
The performance of the twofish
In 2000, Twofish was slower than Rijndael on 128-bit Keys for most platforms, which is why Rijndael was selected as the AES standard. However, Rijndael performed better in 256-bit Keys.
However, as Rijndael is used as AES standard, more and more hardware are optimized based on AES, resulting in a larger gap between Twofish and Rijndael.
Twofish, like Blowfish, is free.
The principle of twofish
Twofish is derived from Blowfish. Let’s take a look at twofish in action:
Twofish, like DES, also uses Feistel structure.
Firstly, the 128bit plaintext is divided into four parts, and then xor operations are performed with K0,K1,K2 and K3 respectively to generate four results, which are called A1, A2, A3 and A4.
The part enclosed by the dotted line is F.
A1 and A2, as the result of F input, perform xOR operation with A3, and then move to the right one bit, and xOR operation with the result of A4 moving to the left one bit, and then switch the position of the left and right parts.
The output of the last round is xOR directly with the four extended key words without exchange to get ciphertext C.
Let’s look at the F function.
F is the key-related permutation function on 64-bit data. It takes three parameters, two inputs, R1 and R2, and an r to represent the number of rounds of the subterm.
R1 and R2 go through s-box transformation first, then multiply by MDS matrix, then perform PHT transformation, and finally perform xOR operation with subkey.
This article is available at www.flydean.com/twofish/
The most popular interpretation, the most profound dry goods, the most concise tutorial, many tips you didn’t know waiting for you to discover!