Cryptographic algorithm Detailed--des

Source: Internet
Author: User
Tags rounds

0 des Introduction

In the late the 1960s, IBM established a Computer cryptography research project by Horst Feistel. The project was concluded in 1971 after the design of the algorithm Lucifer. Lucifer was sold to Lloyd's in London for use in a cash-distribution system developed by IBM. Lucifer is a group cipher with a packet length of 64 bits, a key length of 128 bits, and a Feistel structure . Because Lucifer was very successful, IBM decided to develop a commercial cryptographic product suitable for chip implementations. This time, led by Walter Tuchman and Carl Meyer, the participants were not only IBM researchers, but also technical advisers to the National Security Agency (NSA). The result of this effort is to give a revised version of the Lucifer, which is more resistant to cryptanalysis, and the key length is reduced to 56 bits, so it is suitable for use in a single-chip computer environment.

In 1973, when the United States National Standards Office (NBS) sought the United States Code standard program, IBM submitted the Tuchman-meyer solution to NBS, which was the best of all the candidates, so 1977 NBS adopted it as a data encryption standard, DES.

The above content comes directly from the reference [1], the reference [2] gives a more detailed introduction, and is interested to read.

1 Feistel

Cryptography commonly used in the structure of SP, feistel[3], Lai-massey, Misty, and so on, wherein the use of Feistel structure is more common, not only des used, the follow-up of a lot of classical algorithms are involved, it is introduced in this first.

1.1 Feistel Introduction

Feistel was named after the inventor Horst Feistel. The principle of adding and decrypting is as shown in Figure 1, the encryption process on the left, and the decryption process on the right.

In each round of encryption, the plaintext is divided into two parts.

The encryption and decryption formulas are as follows:

The difference is that during the encryption process, the number of turns and the key of the wheel are incremented from the beginning, while decryption is the opposite, decreasing from the maximum.

As can be seen, the last round of encryption operation is different from the previous one, the last round of the two parts are not exchanged, so that the decryption can use and encrypt the same hardware structure.

But what is the most essential characteristic of Feistel structure, I have not quite understood, the more obvious point is that only half of the bit changes each time, the two outside half directly as the next round of input.

1.2 A simple example

Assuming clear text is (L0,R0), a total of two rounds of calculation, each round of the key is K0, K1, plus decryption process 2.

2 Algorithmic Flow

The DES algorithm is based on the diagram on the right, and the relevant parameters are:

      • Clear Text group length: bits
      • Key length: + Bits
      • Number of rounds: 16 rounds

The entire operation can be divided into 3 parts:

      • Initial displacement and inverse initial displacement : This is a pair of reversible operations, a set of numbers after the initial displacement (or inverse initial displacement), and then the inverse of the initial displacement (or initial displacement) can restore the original value;
      • each round of encryption and decryption operations : 64-bit plaintext and 48 for the key through a certain operation, output 64-bit ciphertext;
      • Wheel Key calculation : 64-bit initial key after replacement, cyclic shift and so on to get 16 rounds of key, each round key length is 48 bits.

The following three core operations are described separately.

  Feel around the number of times than more, a variety of replacement, expansion, extraction and other operations, see may be more tired, first from the overall grasp it, and then slowly the details to clear, (^ω^).

2.1 Initial displacement and inverse initial permutation

The operations of the permutation are as follows in Table 1, table 2, and a 64-bit input is obtained with a new 64-bit output by the reference of each of you. Observations can be found in x = IP-1 (IP (x)) = IP (IP-1 (x)).

  One thing to note is that the index values in the graph start from 1 (the numbers below are also similar), some of which start from 0, and if you start from zero, all numbers are reduced by 1.

2.2 Operation per round

Each round of the process 4, you can see that DES uses the Feistel structure. F is the contents of the dashed box in the figure.

Figure 4 Wheel Operation Flow

Each round is mainly involved in 3 operations:

      • Expansion/Displacement: expands the 32-bit input into 48-bit output, as shown in table 3;
      • s box: Divide the 48-bit input into 8 groups as input for 8 S-boxes, each set of 6-bit, highest and lowest bits as the row index, and the middle 4 bits as the column index, get a value of X (0<=x<=15), denoted as binary is 4 bits, 8 s box output and together exactly 32 bits. Table 4 is the value of S1;
      • Displacement: A bit change in the 32-bit input, the output is still 32 bits, such as table 5.

2.3-Wheel Key expansion

As can be obtained from figures 1 and 4, the key expansion process can be expressed as follows:

1) 64-bit initial key p for displacement selection 1, to obtain 56-bit output k;

2) The K cycle to the left a certain number of digits, and then replace the choice 2 to obtain 48-bit output K1 (i.e. the first round of the key);

3) Loop Step 2) until the 16-round key is obtained (K1, K2 、......、 k16);

4) end.

The values of displacement selection 1, displacement selection 2, and left shift are shown in table 6, table 7, and table 8, respectively.

 

3 Other cryptographic algorithms

Recently introduced the DES, AES and SIMON3 cipher algorithms, they are grouped cipher algorithm, for the stream cipher algorithm, public key cryptography, hash function (hash algorithm) will not be introduced in the near future, the subsequent time to update. Readers are interested to refer to the "cryptography and cyber security-principles and practices" and online related information, the basic principle of the algorithm is almost the same, as long as the basic idea, code implementation is not too difficult.

4 references

[1] William Stallings, Wang Zhangyi and other translations. Cryptography and cyber security-principles and Practices (fifth edition) [M]. Beijing: Electronic industry Press, 2012.1.

[2] Http://en.wikipedia.org/wiki/Data_Encryption_Standard

[3] Http://en.wikipedia.org/wiki/Feistel_cipher

[4] Https://github.com/tarequeh/DES

Cryptographic algorithm Detailed--des

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.