3DES is the common name for the Triple Data Encryption Standard. It is an enhanced version of the DES algorithm, equivalent to applying the DES operation three times to each data block. Due to the increased key length, the security level and difficulty of cracking are higher than that of the DES algorithm.
The encryption process of the 3DES algorithm is divided into 3 steps:
1. Plaintext data grouping
2. Group encryption
3. Combining the results of group encryption
Below is a detailed explanation.
The key length of the 3DES algorithm is 24 bytes, divided into three parts K1, K2, K3 in order of 8 bytes each. If K1 = K3, the key length can be reduced to 16 bytes (in LKT’s 3DES algorithm, K1 and K3 are set equal, fixing the key length at 16 bytes). In the first step, during the encryption process, the plaintext data is divided into N groups of 8 bytes each, with any blocks less than 8 bytes requiring data padding. In the second step, each of the N groups of data undergoes encryption. Let Ek() and Dk() represent the encryption and decryption processes of the DES algorithm, Mn represent the n-th group of plaintext, Cn represent the n-th group of ciphertext, and C represent the final encryption result. The 3DES encryption process for each group of data is: Cn=Ek3(Dk2(Ek1(Mn))). In the third step, the N groups of encrypted results are concatenated together to complete the encryption operation, C = C1C2C3……Cn.
In summary, the 3DES algorithm, like DES, is a block encryption algorithm, with ciphertext data existing independently in 8-byte units. If the plaintext length is 16 bytes, changing the first 8 bytes of the plaintext will only affect the first 8 bytes of the ciphertext, while the last 8 bytes of the ciphertext remain unchanged. Therefore, in the process of encrypting data transmission over a line using the 3DES algorithm, to ensure an overall change in ciphertext, it is necessary to ensure that each block of plaintext data is changed.
When setting the key, users should be careful not to have the first and last 8 bytes of the key be identical; otherwise, it will revert to the DES algorithm, reducing security strength (users can derive this themselves based on the formula Cn=Ek3(Dk2(Ek1(Mn))). It is important to note that the last bit of each byte in the key is a check bit and does not participate in the encryption operation. For example: K1 = 0000000000000000, K2 = 0101010101010101, then the results of K1 and K2 encrypting the same group of data are the same.
I hope this article provides a more intuitive understanding of the characteristics of the 3DES algorithm, allowing for a safer and more effective use of the 3DES algorithm in designing data encryption and decryption schemes, and efficiently utilizing the built-in 3DES algorithm interface in LKT.