3DES classification

3DES
3DES is divided into two types, one is double-length 3DES, and the other is triple-length 3DES.
If it is double-length 3DES, the key is 32 bytes long, press left and right, respectively, LK (16 bytes on the left of the key), RK (16 bytes on the right of the key). The encrypted content DATA is 16 bytes.
Assume that the single-length DES encryption process is: DES( data, key, dest ), where data is the encrypted data, key is the encryption key, and dest is the encryption result. The single-length DES decryption process is: UDES(data, key, dest ), where data is the decrypted data, key is the decryption key, and dest is the decryption result.
Then, the encryption method of double-length 3DES is:
DES( DATA, LK, TMP1 );
UDES( TMP1, RK, TMP2 );
DES( DATA, LK, DEST );
DEST is the final ciphertext. The specific process is briefly described as follows:
1) Use the first 16 bytes of the key to encrypt the data DATA to obtain the encrypted result TMP1;
2) Use the last 16 bytes of the key to decrypt the first calculation result TMP1 , get the decrypted result TMP2;
3) Use the first 16 bytes of the key again to encrypt the second calculation result TMP2 to get the encrypted result DEST. DEST is the final result.
For triple-length 3DES, the key length is 48 bytes long. It can be divided into LK (the left 16 bytes of the key), CK (the middle 16 bytes of the key), and RK (the left 16 bytes of the key). The encryption process is basically the same as that of double-length 3DES, except that the key LK is used for the first calculation; the key CK is used for the second calculation; the key LK is used for the third calculation. The basic process is as follows:
DES( DATA, LK, TMP1 );
UDES(TMP1,CK,TMP2);
DES( TMP2, RK, DEST );

Double-length 3DES encryption method:
DES( DATA, LK, TMP1 );
UDES( TMP1, RK, TMP2 );
DES(TMP2 , LK, DEST );

refer to:

Generally, most of the 3Des algorithms we use refer to the double-length key algorithm. Recently, when reading the technical documents of a well-known company, I found that the 3DES algorithm also has a triple-length key algorithm.
write picture description here

So what is the difference between these two algorithms?

3DES is divided into two types, one is double-length 3DES, and the other is triple-length 3DES.
If it is double-length 3DES, the key is 16 bytes long, press left and right, respectively, LK (8 bytes on the left of the key), RK (8 bytes on the right of the key). The maximum length of encrypted content DATA is 24 bytes.

Assumption

The single-length DES encryption process is: DES( data, key, dest ), where data is the encrypted data, key is the encryption key, and dest is the encryption result.
The single-length DES decryption process is: UDES(data, key, dest ), where data is the decrypted data, key is the decryption key, and dest is the decryption result.

Double-length 3DES encryption method:

DES (DATA, LK, TMP1);
UDES (TMP1, RK, TMP2);
DES (TMP2, LK, DEST);

DEST is the resulting ciphertext. The specific process is briefly described as follows:
1) Use the first 8 bytes of the key to encrypt the data DATA to obtain the encrypted result TMP1;
2) Use the last 8 bytes of the key to decrypt the first calculation result TMP1 , get the decrypted result TMP2;
3) Use the first 8 bytes of the key again to encrypt the second calculation result TMP2 to get the encrypted result DEST. DEST is the final result.

Encryption method of triple-length 3DES:

For triple-length 3DES, the key length is 24 sections long. It can be divided into LK (the left 8 bytes of the key), CK (the middle 8 bytes of the key), and RK (the left 8 bytes of the key). It is basically the same as the encryption process of double-length 3DES,

Only the first calculation uses the key LK; the second calculation uses the key CK; the third calculation uses the key LK. The basic process is as follows:
DES( DATA, LK, TMP1 );
UDES( TMP1, CK, TMP2 );
DES( TMP2, RK, DEST );

3 times longer key decryption process:

Decrypt the above process in reverse, and note that the key sequence needs to be used in reverse.

DES( TMP2, RK, DEST );

UDES( TMP1, CK, TMP2 );

DES( DATA, LK, TMP1 );

Summarize the difference between the three algorithms:

write picture description here

Reference: https://blog.csdn.net/lvxiangan/article/details/72529221

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325993114&siteId=291194637