Data encryption standard DES
The original idea of DES can refer to Engelmar machine in Germany during World War II, and the basic idea is basically the same. Traditional cryptographic encryption originated from the ancient idea of cyclic shift, and Enigma machine diffused fuzziness on this basis. But the essential principle is the same. Modern DES does the same thing at the binary level: it replaces fuzziness and increases the difficulty of analysis.
Encryption principle
DES uses a 56-bit key and an additional 8-bit parity bit to generate packets with a maximum of 64 bits. This is an iterative block cipher, which uses a technique called Feistel, in which the encrypted text block is divided into two halves. Using subkeys to apply a cyclic function to half of them, and then XOR the output with the other half; Then the two halves are exchanged, and this process will continue, but the last cycle will not be exchanged. DES uses 16 cycles and uses four basic operations: XOR, permutation, substitution and shift.
fundamental principle
fundamental principle
There are three entry parameters: key, data and mode. Key is the key used for encryption and decryption, data is the encrypted and decrypted data, and mode is its working mode. When the mode is encryption mode, plaintext is grouped by 64 bits to form plaintext group. The key is used to encrypt data, and when the mode is decryption mode, the key is used to decrypt data. In practical application, the key only uses 56 of 64 bits, so it has high security.
Key generation
Get the key
Obtain a password key with a length of 64 bits from the user (unless otherwise specified, it refers to binary bits), remove the 8th, 16, 24, 32, 40, 48, 56 and 64 bits in the 64-bit password as check bits, and use the remaining 56 bits as valid input keys.