Introduction to DES encryption algorithm Learning

Source: Internet
Author: User

 

I have read about DES encryption over the past few days. If I have read it carefully, this algorithm is not difficult. Sometimes I feel that it is difficult because I cannot read it. The vast sea of people, and their own people.

<! -- [Endif] -->

To learn about the DES encryption algorithm, I think we should first understand the following points:

<! -- [If! Supportlists] --> 1. <! -- [Endif] --> modulo 2 addition operation

This is easy to understand, that is, adding two numbers and then Division 2 to get the remainder.

<! -- [If! Supportlists] --> 2. <! -- [Endif] --> understand the replacement

At the beginning, the plaintext is replaced by the initial IP Address:

<! -- [Endif] -->

The meaning of this table is that the first 58 is the 58th elements in your plain text. You need to place it at the position of 1, then place the 50th elements in the plain text at the position of 2, and so on.

<! -- [If! Supportlists] --> 3. <! -- [Endif] --> subkey generation

<! -- [Endif] -->

Sub-key generation is divided into three steps:

The first step, first remove the parity in the key, and then according to the choice of replacement PC-1, the remaining key is divided into two C0 and D0;

In the second step, the C0 and D0 are cyclically shifted to the left, after the transformation, C1 and D1 are generated, then C1 and D1 are merged, and the Child key K1 is generated by selecting the replacement PC-2;

Step 3, C1 and D1 are converted to the left after the loop again, and C2, D2, C2 and D2 are generated and merged. The child key K2 is generated by selecting the replacement PC-2;

Step 4, and so on, pay attention to the number of digits in the left shift of the loop. A total of sixteen shifts are made to the left of the loop. Here, LS1 (first time), ls2 (second time), LS9, ls16 shifts one digit to the left of the loop, and the rest shifts two places to the left.

<! -- [If! Supportlists] --> 4. <! -- [Endif] --> des core -- encryption function <! -- [If! VML] --> <! -- [Endif] -->

The encryption process of the encryption function can also take three steps:

The first step is to replace R0 through the bit selection function E. In fact, this is an extended replacement, because R0 itself is a 32-bit (remember this first, the generated sub-key is 48 bits, so you need to expand it to perform bitwise operations.

Step 2: Perform the modulo 2 addition operation on the expanded R0 and sub-key K1 to obtain a 48-Bit String, which is divided into eight groups from left to right, each group contains 6 characters. The eight groups are B1, B2, B3, B4, B5, B6, B7, and B8 respectively. Bj = b1b2b3b4b5b6.

Step 3: compress the data in the S box. Place b1b6 in each group in decimal format and b2b3b4b5 in decimal format. B1b6 represents the row mark in the S box, And b2b3b4b5 represents the column mark. For example, if b1 = 011111, b1b6 is equal to 1 in decimal format, b2b3b4b5 is equal to 15 in decimal format, that is, the first row in the S1 block of the table (note that it is not 0 rows), and 15 columns, that is, 8, and then convert 8 to binary 1000. This completes the S-box contraction transformation, and then outputs a 32-bit string through the S-box.

<! -- [Endif] -->

Step 4: replace the 32-bit string with the replacement function P, and the result is the product of this core function.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.