Introduction to the

In the previous article, we talked about the Blowfish algorithm. Since the blocks are small and only 64bits per encryption, it is not recommended to use Blowfish to encrypt files larger than 4G. At the same time because of the small encryption block will also lead to birthday attacks. Hence Blowfish’s successor, Twofish.

Today, let’s take a look at the Twofish encryption algorithm.

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.

The Advanced Encryption Standard is a Standard symmetric block Encryption technology approved by The National Institute of Standards and Technology (NIST).

AES was publicly selected from 1997 to 2000. It was created primarily to replace DES. Because DES has only 56 bit keys, it is vulnerable to violent attacks.

NIST announced on January 2, 1997 that they wished to select a successor to DES, known as AES. Like DES, it should be “an undisclosed, public encryption algorithm that well protected sensitive government information well into the 20th century.” But rather than simply naming a successor, NIST conducts an open selection process in which candidates are required to provide evidence that they are better than DES. The open solicitation immediately generated a lot of interest.

In the months that followed, NIST received 15 proposals from multiple countries. They are CAST-256, Crypton, Deal, DFC, E2, Frog, HPC, Loki97, Magenta, Mars, RC6, Rijndael, Safer +, Serpent and Twofish.

In a subsequent evaluation, the candidates were evaluated on factors including security, performance and limited environment operation, and five finalists were announced in August 1999: MARS, RC6, Rijndael, SERPent and Twofish.

Finally, on October 2, 2000,NIST announced that Rijndael had been selected as the final AES algorithm. It became an official AES standard on November 26, 2001.

Twofish may not be the final AES standard, but it’s pretty good 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 chosen as the AES standard. However, it performed better on the 256-bit keys than Rijndael.

But as Rijndael became the standard for AES, more and more hardware was optimized for AES, resulting in a widening gap between Twofish and Rijndael.

Twofish, like Blowfish, is free.

The principle of twofish

Twofish is an evolution of Blowfish. Let’s take a look at how Twofish works:

Twofish, like DES, also uses Feistel structure.

Firstly, the 128bits plaintext is divided into 4 parts, and then XOR operation is conducted with K0,K1,K2 and K3 respectively to generate 4 results, which are called A1, A2, A3 and A4.

The dotted line is the function F.

A1, A2 as the input of F generated results and A3, and then move to the right one, and A4 moved to the left one result of the XOR operation, and then exchange the left and right parts of the position.

The output of the last round is XOR with the four extended key words without exchange to get the ciphertext C.

Let’s look at the function F.

F is the substitution function associated with the key on 64-bit data. It takes three parameters, two inputs, R1 and R2, and an R denote the number of rounds of the subitems.

R1 and R2 first go through S-box transformation, and then multiply by MDS matrix, and then carry out PHT transformation, and finally carry out XOR operation with sub-keys.

This article has been included in

The most popular interpretation, the most profound dry goods, the most concise tutorial, many you do not know the tips to wait for you to discover!