DES explanation

        The DES encryption algorithm is divided into two parts as a whole: the plaintext part and the key part. The two parts are processed separately and then merged, and continue to perform some operations to form the ciphertext. Its security depends on the unpredictability of the key, not the secrecy of the encryption method. In fact, every step of the operation is public, but the key cannot be cracked. The reason why it cannot be cracked is that the key is 8 bytes, that is, 64-bit binary, which is very difficult to crack.

        Since a series of operations are based on 8 bytes, the plaintext input should be 8 bytes. Obviously, the plaintext can only be input with 8 bytes, which is unreasonable, so it is necessary to group the plaintext, every 8 bytes. , fill with 0 if it is less than 8 bytes. (There is actually a problem here. Of course, it is possible to encrypt with 0, but when decrypting, how to judge whether the 0 is a complement of 0 or a 0 of the plaintext itself, so the selection of the complement bit is very important, and those who are interested can discuss it together.)

        Here 3 loop variables i, j, k are set. j represents the number of plaintext groups, i code the number of times the plaintext cycle (that is, the number of plaintext groups), k represents the number of key cycles.

        The main modules involved in the plaintext are: initial permutation, extended transformation, etc.

        The modules mainly involved in the key are: permutation selection 1, cyclic shift, etc., permutation selection 2.

        The plaintext and the ciphertext are combined by the product transformation, which includes the S-box operation, the permutation operation P, and the initial inverse permutation, so that the ciphertext can be formed.

        One of the most important modules is the S box. The S box mainly provides the necessary obfuscation effect of block cipher algorithms and is the only nonlinear component of many cipher algorithms. Its cipher strength determines the security strength of the entire cipher algorithm.

        The attachment is the flow chart of DES, please refer to the attachment for the specific operation steps and methods. The flow chart may have some non-standard places, welcome to correct it.

        The decryption of DES is the inverse process of the above.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327067792&siteId=291194637