# Accounting Data Encryption Processing Based on Data Encryption Standard Algorithm

Authors: Meixi Chen
Journal: Complexity
 (2021)

---

## Abstract

With the application of computer and network technology in the field of accounting, the development of accounting informationization is an inevitable trend, and the construction of accounting statement data into the data warehouse will be the basis of intelligent decision-making. The complexity of industry accounting statements and the arbitrariness and diversity of users’ needs for obtaining information using statements limit the development, popularization, and application of industry accounting statements. As a block encryption algorithm, the Data Encryption Standard (DES) algorithm uses 64-bit packet data for encryption and decryption. Each eighth bit of the key is used as a parity bit; that is, the actual key length is 56 bits. Encryption and decryption use the same algorithm structure, but the order in which the subkeys are used is reversed. Under the control of the subkey, inputting 64-bit plaintext can produce 64-bit ciphertext output; otherwise, inputting 64-bit ciphertext can produce 64-bit plaintext output. The confidentiality of the DES algorithm depends on the key, and only a very small number of keys are considered weak keys, which can be easily avoided in practical applications. The 3DES algorithm is a cascade of the DES algorithm, and its encryption process is based on the DES algorithm principle. This article explains the encryption process of the DES algorithm and introduces the composition of the 3DES algorithm. The experimental results show that the 3DES encryption algorithm still has a better encryption effect and “avalanche effect” than before the improvement. In addition, for the 3DES algorithm, its encryption efficiency has not been greatly affected. The 3DES encryption algorithm achieves one encryption process at a time to some extent, can effectively resist exhaustive search attacks, and enhance the security of the DES algorithm.


---

## Body

## 1. Introduction

With the progress of time and the continuous update and development of industrial technology, computers have entered the homes of ordinary people from the original high-end equipment, which itself has also developed from the original Big Mac to the current compact tablet computer; while the computer is developing towards miniaturization, it is also developing towards integration. The emergence of cloud computing can be described as a revolution. At the same time, with the development of computers, the Internet is also following the rapid development of the footsteps [1–3]. Now, the Internet is becoming more and more convenient. People began to watch news and videos online and gradually developed to online shopping, online banking transactions, and so on. As long as it is needed in daily life, the Internet can basically solve day-to-day problems. However, it is precisely because of the development of the Internet and computers that criminals have more and more opportunities, and the economic loss caused by cybercrime is hundreds of billions of dollars each year. Because of these, people have higher and higher requirements for network security. The most basic thing is that people hope that the network is at least relatively safe, and their personal information and data will not be stolen and used. Encryption is one of the effective means to ensure information security, and it has extraordinary significance in all walks of life in modern times [4, 5].Accounting statements are structural statements of a company’s financial status, operating results and cash flow. Our usual accounting statements cover a lot of content. In addition to the balance sheet and the income statement, it also includes the cash flow statement and the statement of changes in owner’s equity. Accounting statements are also an important tool for managers, creditors, and shareholders to provide information about the company’s financial status, operating results, and cash flow and are an important basis for statement users to make decisions. As for information systems, the reporting part is an important part of various financial software and ERP systems. If the report technology and data warehouse technology can be combined, after the accounting report data is collected, the data can be processed and incorporated into the data warehouse. Thus, the significance of this research is not only that it can more conveniently and effectively manage the accounting reports of the industry, but also that the data can be further analyzed and mined. After analyzing and mining the data from all multiple angles, a more comprehensive and systematic analysis result can be obtained, which is important for obtaining the best solution [6–8].This article introduces the relevant knowledge of cryptography, focusing on the encryption principle of the DES encryption algorithm, including the encryption process,F function, and subkey generation, and on this basis gives the structure and principle of the 3DES encryption algorithm. Improving the DES algorithm did not reduce the encryption effect. The number of bits changed is still around 32 bits, and the distribution is relatively even. Compared with the plaintext, the ciphertext has become completely different. The improved DES algorithm still has a good “avalanche effect” phenomenon. When the input changes by one bit, the number of bits changed by the output is about 32 bits, and the distribution is relatively uniform. Running the conventional DES algorithm and the improved DES algorithm on the same machine, we can see that the running time of the two is equivalent, and the improvement does not have much impact on the operating efficiency. In view of the expansion of the application range and the stronger persuasiveness of the experimental results, more data can be considered for testing to verify its safety.


## 2. Related Work

Cryptography involves many disciplines, including information theory, mathematics, computer science, and other aspects. In the computer field, our main research interest is how to encrypt data so as to ensure the security of information in the process of network communication. Even if others get the information, they cannot understand the original meaning of the information. Encryption and decryption are mainly composed of the following parts: plaintext informationM, ciphertext C, encryption algorithm E, decryption algorithm D, encryption key KE, and decryption key KD. Encryption algorithm E, plaintext M, and encryption key KE are used as parameters. After transformation, ciphertext C is obtained from the surface, but the decryption process is just the opposite. Decryption algorithm D takes decryption key KD and ciphertext C as parameters, and after transformation, we get the original plaintext information M. DES is a symmetric encryption algorithm. Due to the rapid development of computer technology and the continuous enhancement of processing capabilities, it can no longer meet the needs of people now. The United States has recollected a new algorithm Advanced Encryption Standard (AES) and established a working group for this purpose. Their requirement is that AES is better than, faster than, and at least as secure as 3DES. The packet length of the data is 128 bits, and the length of the key is variable: 128, 192, and 256 bits.The rapid development of information technology has made big data a problem that all walks of life need to face, so the research on the security of big data has become more and more important [9]. The research on big data security mainly includes three fields: the field of scientific and engineering computing, the field of e-commerce, and the field of Internet [10]. The US Pacific Northwest National Laboratory’s exploration of big data security issues is based on the big data security analysis technology of the new software and hardware platform. The systems developed by e-commerce companies such as Amazon have developed into various research foundations related to big data security. On the platform, large Internet companies such as Google and Yahoo make full use of the massive web browsing records and user access information in their servers to conduct various research activities on big data security.Related scholars have proposed a new idea of cryptography, that is, the idea of public key cryptography, which is mainly used to solve the problem that it is difficult for symmetric encryption algorithms to transfer keys [11]. The idea is to make the encryption algorithm public, one public key for encryption and one private key for decryption. Anyone can use the encryption key to encrypt information, but only the person with the private key can decrypt the encrypted information, and it is computationally infeasible to calculate the private key from the public key, thus ensuring the security of the information. Two public key cryptographic algorithms were first proposed, namely, the Rivest–Shamir–Adleman (RSA) algorithm and the Merkle–Hellman algorithm [12–14]. However, then in 1982, the Merkle-Hellman algorithm was broken by Shamir, making the MH algorithm no longer secure.The RSA algorithm has withstood various attacks and has not been completely broken yet [15]. Therefore, the RSA algorithm has become the most widely accepted public key cryptosystem. However, because the RSA encryption and decryption speed are much slower than those of the symmetric encryption algorithm, and with the rapid development of computers, the low-bit RSA is no longer secure. Therefore, the RSA algorithm is improved to increase its encryption and decryption speed and enhance its security. Relevant scholars have proposed fast modular exponentiation calculation methods [16]. Many scholars have also proposed many algorithms to improve the encryption and decryption speed of RSA [17–19]. The remaining of the theorem is decrypted. Related scholars have proposed an improved RSA algorithm for fast decryption [20]. This algorithm is mainly aimed at the RSA algorithm that uses multiple prime numbers for encryption, and both its decryption speed and signature speed have been improved. Related scholars have proposed a fast encryption method to improve the RSA algorithm, which improves the generation of encryption keys and enhances the security of the algorithm [21].The key to the design of public key cryptosystem is to construct a one-way trapdoor function based on NP problem, so that only the decryptor can decrypt the ciphertext. When constructing public key cryptosystems, most of them are based on some complicated mathematical problems. Based on the ideas of RSA and MH algorithms, more public key cryptosystems have been proposed [22], for example, the Rabin algorithm based on the quadratic residual problem, the ElGamal algorithm based on the discrete logarithm, and the ECC algorithm based on the discrete logarithm problem on the elliptic curve. In order to give full play to the respective advantages of symmetric key algorithms and public key algorithms, scholars pointed out that the plaintext is encrypted with triple DES first, and then the keys are transmitted using public key algorithms such as RSA [23]. This mode of combining the two has become the main mode of the encryption system. However, in a public key cryptography system, since anyone can use the public key, leaving information that can be used by the attacker, protecting the public key will also become very important. Related scholars have proposed a new method to protect public keys and signature keys to ensure more secure communication [24].Related scholars put forward the idea of public key cryptosystem, which uses mathematical functions as basic tools instead of substitution and replacement [25–27]. The basic feature of the public key cryptographic algorithm is that the public key and the private key are used asymmetrically in the encryption process and the decryption process. The public key refers to one of the public keys, and the private key refers to the other secret key. Because the key of the encryption algorithm is asymmetric, it is also called an asymmetric cryptosystem. Since proposing the idea of public key algorithm, scholars have begun to explore ways to realize this idea. Researchers propose an RSA cryptosystem based on the difficulty of decomposing large prime numbers. The algorithm mainly adopts number theory structure and has the most mature and complete theoretical foundation and universal application. Recently, the rapidly developing elliptic curve cryptosystem is based on the computational difficulty of the elliptic curve discrete logarithm problem on a finite field. The algorithm uses a shorter key to obtain the same security as the RSA algorithm, and has a broad development prospect. Besides, it is considered one of the strongest asymmetric cryptosystems at this stage.


## 3. Accounting Report System

### 3.1. Analysis of the Report System

Reports are the basic measures and methods of enterprise management, the basic business requirements of the enterprise, and the basis for implementing the BI strategy. Reports can help companies access and format data and present data information to users in a reliable and safe manner. It combines computer technology with accounting report preparation methods to design software specially used for report data processing. The report system is enterprise-level report analysis software used for statistical report production and data reporting [5, 28, 29].As far as the complexity of the report structure is concerned, reports can be divided into two types: simple tables and composite tables. The structure of a composite table is much more complicated than that of a simple table. The composite table can be formed by nesting simple tables or by combining multiple simple tables. Therefore, the processing of composite tables is not as convenient as simple tables. Whether it is a simple table or a compound table, in terms of its structure, it basically consists of two parts, namely, the basic fixed table format and the data part of the table that varies with the accounting period. In the computer report processing system, the so-called report format is essentially a template saved in the computer. Using this template, forms in the same format can be copied unlimitedly for users to use.The header is used to indicate the columns of the report. Columns and column names are the most important content of the report. They determine the width of the report and each column of the report, thereby determining the basic format of the report. The simple report has only one level of columns, and the one with only one level is called the basic column. The columns of the compound report can be divided into several layers; that is, there are several small columns under the big column. This kind of column is called a combined column. Some report software also regards the title and header of the table as a whole and calls this whole the header.The main body of the report is composed of several horizontal columns and several vertical rows. The vertical table line and the horizontal table line divide the body of the table into some grids for filling in the data in the table. These grids are called table cells. Table unit is the smallest basic unit that makes up a report. Each table unit can be represented by its column coordinates and row coordinates. The elements that determine the location of a certain unit are usually called “dimensions.” The so-called area is composed of multiple cells, and its range is a rectangular cell array formed from the starting point cell to the ending point cell. The area is two-dimensional, the smallest area is a unit, and the largest area can include all the units of the entire report. In the report preparation process, there are generally only two types of content to be entered in the report unit: one is text and the other is numbers. Some of the text is used as the heading of each row (or column), which is called a table sample. The content of the sample unit is the same as the header and footer when preparing the same accounting statements for different accounting periods. Its content is fixed and unchanging, so the sample is part of the report format.The end of the table refers to the part below the table line for additional explanation. Some tables have content, and some tables have no content, but no matter whether there is content or not, the structure of the end of the table must exist in the report. The basic working principle of the accounting report processing subsystem is that the software provides users with the functions of setting the header, body, and footer. Users only need to run these functions to get the report that meets their needs.


### 3.2. Key Data Table

In order to distinguish the same table in different months, the system will ask the user to enter the value of the keyword before each report is prepared. If a report with the same keyword value already exists, the system will ask the user to confirm whether to reedit. If the user reprograms, the newly compiled table will overwrite the existing old table. Therefore, if the user has modified the table format or table formula, the report must be compiled again to get the report generated according to the new structure. During the preparation of the report, the system will check the format of the formula and will prompt if there is a grammatical or syntax error. However, it should be noted that checking the correctness does not mean that the logical relationship of the formula is correct. The system does not check the logical relationship of the formula, and it is difficult to check. The daily work of the report system is mainly to prepare reports at the end of each month and print out the prepared reports. Before preparing monthly statements, the business of the current month should be completed (including the processing of daily business as well as the processing of period-end amortization, withdrawal, and carryforward business). The preparation of quarterly and annual reports should also be handled in accordance with this principle.In terms of report output, there are two ways to output the report of the table processing system: One is screen display output; this output is mainly for users to check whether the report settings and compilation are correct or not, so in order to display as much substantive content as possible, it is not very necessary. The table line is generally not displayed. The other type of output is a printout; at this time, the output is a formal report generated according to the formal requirements. In addition, the system can generally print empty tables and user-set formula lists for users to check formula settings.


## 3.1. Analysis of the Report System

Reports are the basic measures and methods of enterprise management, the basic business requirements of the enterprise, and the basis for implementing the BI strategy. Reports can help companies access and format data and present data information to users in a reliable and safe manner. It combines computer technology with accounting report preparation methods to design software specially used for report data processing. The report system is enterprise-level report analysis software used for statistical report production and data reporting [5, 28, 29].As far as the complexity of the report structure is concerned, reports can be divided into two types: simple tables and composite tables. The structure of a composite table is much more complicated than that of a simple table. The composite table can be formed by nesting simple tables or by combining multiple simple tables. Therefore, the processing of composite tables is not as convenient as simple tables. Whether it is a simple table or a compound table, in terms of its structure, it basically consists of two parts, namely, the basic fixed table format and the data part of the table that varies with the accounting period. In the computer report processing system, the so-called report format is essentially a template saved in the computer. Using this template, forms in the same format can be copied unlimitedly for users to use.The header is used to indicate the columns of the report. Columns and column names are the most important content of the report. They determine the width of the report and each column of the report, thereby determining the basic format of the report. The simple report has only one level of columns, and the one with only one level is called the basic column. The columns of the compound report can be divided into several layers; that is, there are several small columns under the big column. This kind of column is called a combined column. Some report software also regards the title and header of the table as a whole and calls this whole the header.The main body of the report is composed of several horizontal columns and several vertical rows. The vertical table line and the horizontal table line divide the body of the table into some grids for filling in the data in the table. These grids are called table cells. Table unit is the smallest basic unit that makes up a report. Each table unit can be represented by its column coordinates and row coordinates. The elements that determine the location of a certain unit are usually called “dimensions.” The so-called area is composed of multiple cells, and its range is a rectangular cell array formed from the starting point cell to the ending point cell. The area is two-dimensional, the smallest area is a unit, and the largest area can include all the units of the entire report. In the report preparation process, there are generally only two types of content to be entered in the report unit: one is text and the other is numbers. Some of the text is used as the heading of each row (or column), which is called a table sample. The content of the sample unit is the same as the header and footer when preparing the same accounting statements for different accounting periods. Its content is fixed and unchanging, so the sample is part of the report format.The end of the table refers to the part below the table line for additional explanation. Some tables have content, and some tables have no content, but no matter whether there is content or not, the structure of the end of the table must exist in the report. The basic working principle of the accounting report processing subsystem is that the software provides users with the functions of setting the header, body, and footer. Users only need to run these functions to get the report that meets their needs.


## 3.2. Key Data Table

In order to distinguish the same table in different months, the system will ask the user to enter the value of the keyword before each report is prepared. If a report with the same keyword value already exists, the system will ask the user to confirm whether to reedit. If the user reprograms, the newly compiled table will overwrite the existing old table. Therefore, if the user has modified the table format or table formula, the report must be compiled again to get the report generated according to the new structure. During the preparation of the report, the system will check the format of the formula and will prompt if there is a grammatical or syntax error. However, it should be noted that checking the correctness does not mean that the logical relationship of the formula is correct. The system does not check the logical relationship of the formula, and it is difficult to check. The daily work of the report system is mainly to prepare reports at the end of each month and print out the prepared reports. Before preparing monthly statements, the business of the current month should be completed (including the processing of daily business as well as the processing of period-end amortization, withdrawal, and carryforward business). The preparation of quarterly and annual reports should also be handled in accordance with this principle.In terms of report output, there are two ways to output the report of the table processing system: One is screen display output; this output is mainly for users to check whether the report settings and compilation are correct or not, so in order to display as much substantive content as possible, it is not very necessary. The table line is generally not displayed. The other type of output is a printout; at this time, the output is a formal report generated according to the formal requirements. In addition, the system can generally print empty tables and user-set formula lists for users to check formula settings.


## 4. 3DES Encryption Algorithm

### 4.1. Transposition and Substitution

Transposition and substitution are the two basic operations of encryption algorithms. Transposition indicates that the position of characters in the text is rearranged, which is a linear transformation [30, 31]. Instead, it indicates that every character (bit, letter, bit combination, or letter combination) in the text is mapped to another character. Simply put, it is to replace one symbol with another to form a ciphertext. This operation mainly achieves the purpose of nonlinear transformation. Transposition is usually realized by P transform instead of S transform. The former is called P-box, which plays a role of diffusion; the latter is called S-box, which plays a role of chaos. In block ciphers, there are generally three types of P-boxes available: ordinary P-boxes, compressed P-boxes, and expanded P-boxes. The structure of the P-box is shown in Figure 1 as a, b, and c. The lines in each box in the figure represent the transposition relationship. The numbers on the left are the input data, and those on the right are the output data.Figure 1
P-box and S-box: (a) ordinary P-box; (b) compressed P-box; (c) expanded P-box; (d) S-box.
(a)(b)(c)(d)The ordinaryP-box is a transposition operation of n-bit input and n-bit output, and there are n! kinds of mapping relationships. The compressed P-box is a transposition operation with n-bit input and m-bit output (n > m). There are nm bits in the input that will not be output. It is suitable for transposition operations while reducing the number of bits to adapt to the next stage. The extended P-box is a transposition operation with n-bit input and m-bit output (m > n). mn bits in the input will be reused and output. It is suitable for transposition operation while increasing the number of bits to adapt to the next stage required. The S-box is a miniature replacement code whose input and output digits can be the same or different. It can be seen that no matter what the kind of P-box is, the position of each bit of the original data is replaced, and the original data will not be changed, while the S-box may change the position of the original data. The S-box is more complicated than the P-box, and the S-box with more bits is difficult to realize. When the number of bits is the same, the S-box has more input and output correspondences than the P-box, so it has higher security [32, 33].Combining the principles of chaos and diffusion, it can be concluded that usingP-boxes alone or S-boxes with fewer digits cannot achieve higher security, because their input and output correspondence can be monitored relatively easily, but if they are used alternately, both can greatly improve safety. The DES/3DES encryption algorithm is a combined transformation network of multiple S-boxes and P-boxes, and under the control of the key, this network is used for repeated iterations, so it has high security [34, 35].


### 4.2. 3DES Encryption Algorithm Construction

The DES algorithm is a block encryption mechanism that divides the plaintext intoN groups, then encrypts each group to form their own ciphertext, and finally merges all the grouped ciphertexts to form the final ciphertext. DES is a symmetric encryption algorithm. Its encryption key and decryption key are the same, and the algorithm is also the same. Its key length is 64 bits. During operation, the 64-bit key will be divided into 8 groups, each with 8 bits, and the last bit of each group is the check bit, so the actual key length is only 56 bits. It should be able to prevent data from being modified and leaked without authorization, and information and data can be protected with high quality. The security of the algorithm does not depend on the confidentiality of the algorithm itself but is based on the security of the key. It is also economical and practical and can be used in different occasions and fields.


#### 4.2.1.F (K, R) Function

TheF (K, R) function is the core of the DES encryption algorithm, which is mainly composed of 8 S-boxes. The S-box is the only nonlinear transformation (playing the role of S transformation) in the entire encryption process. The principle of the F function is shown in Figure 2. The right 32-bit data R in each iteration of the DES algorithm is transformed into 48 bits after an E-extended permutation. An S-box transformation results in a 32-bit output, and the 32-bit output finally undergoes a P permutation to obtain the output of the F function. Both E permutation and P permutation are linear transformations, E permutation input is 32 bits, output is 48 bits, and P permutation input and output are both 32 bits. The S-box is a lookup table with 6 inputs and 4 outputs. S1∼S8 are different from each other and are operated in parallel. E replacement, P replacement, and S-box are transformed according to the DES encryption algorithm standard.Figure 2
Principle ofF function.


#### 4.2.2. Subkey Generation

The subkey is the 48-bit key corresponding to each iteration of the encryption operation, and the generation principle is shown in Figure3. The initial 64-bit key discards the 8th, 16th, 24th, 32nd, 40th, 48th, 56th, and 64th 8-bit odd parity bits. The remaining 56 bits undergo a set change. PC-1 is used in these two steps. The 56-bit data obtained is divided into left and right parts as in the encryption process, with 28 bits on the left being C0 and 28 bits on the right being D0, then entering 16 rounds of iteration. Cn and Dn (n = 1∼16) in each round of iteration are shifted to the left, respectively, and the number of bits shifted to the left in each round is different, which is determined by the number of rounds. Each round of left shift produces the next round of Cn and Dn, and each round of Cn and Dn is spliced into 56 bits and then subjected to a compression replacement PC-2 to obtain the subkey output Kn of each round. PC-1 replacement and PC-2 replacement are converted according to the DES encryption algorithm standard.Figure 3
Principle of subkey generation.The decryption subkey is the same as the encryption subkey, but the order of use is reversed. That is, if the subkeys used for encryption areK1, K2, …, K16, the subkeys used for decryption are K16, K15, …, K1. In addition, it can be seen from the principle of subkey generation that all permutations in the process of subkey generation are linear transformations and can be replaced by one permutation. Therefore, in the actual use of subkeys, whether it is encryption or decryption, you can first use the input key to generate all subkeys at once and then select the corresponding order of use according to the needs of encryption and decryption.


#### 4.2.3. 3DES Encryption

The triple DES (3DES) algorithm is an improved scheme of the DES algorithm. It uses three keys,K1, K2, and K3, and uses DES as the basic module to encrypt and decrypt the plaintext three times. Since its effective key length reaches 168 bits (when K1, K2, and K3 are different), it greatly improves the ability to resist brute force attacks. As shown in Figure 4, when using 3DES encryption, you first use K1 for encryption, then use K2 for decryption, and finally use K3 for encryption; namely,(1)C=Ek3Dk2⋅Ek1P.Figure 4
Principle of 3DES encryption algorithm.In 3DES decryption, first you useK3 for decryption, then use K2 for encryption, and finally use K1 for decryption; namely,(2)P=Dk1Ek2⋅Dk3C.It can be seen that in 3DES decryption, except that the order of using subkeys for each DES module is opposite to the encryption process, the order of using the three input keys is also reversed, but the algorithm structure has not changed.You use the hash function shown in the following formula for calculation to obtain the desired hash address:(3)Hkey=randomkey.Among them, random is a pseudorandom function, and the pseudorandom function is used as a hash function.To use the open addressing method to resolve conflicts, you need to use the following function for calculation:(4)hi=Hkey−di100m,i=0,1,2,…,n−1.In the formula,di is the increment sequence, m is the table length, and H (key) is the hash function; let h0 = H (key).In the case of conflict, the calculation is realized according to the second detection and rehashing method, the result will be jump detection on both sides of the hash table, and the value of the increment sequencedi is(5)di=i,i<m2,−i,i≥m2.Using rehashing to handle conflicts needs to be calculated according to the following formula:(6)Hi=RHikey,i=0,1,2,…,k−1.


## 4.1. Transposition and Substitution

Transposition and substitution are the two basic operations of encryption algorithms. Transposition indicates that the position of characters in the text is rearranged, which is a linear transformation [30, 31]. Instead, it indicates that every character (bit, letter, bit combination, or letter combination) in the text is mapped to another character. Simply put, it is to replace one symbol with another to form a ciphertext. This operation mainly achieves the purpose of nonlinear transformation. Transposition is usually realized by P transform instead of S transform. The former is called P-box, which plays a role of diffusion; the latter is called S-box, which plays a role of chaos. In block ciphers, there are generally three types of P-boxes available: ordinary P-boxes, compressed P-boxes, and expanded P-boxes. The structure of the P-box is shown in Figure 1 as a, b, and c. The lines in each box in the figure represent the transposition relationship. The numbers on the left are the input data, and those on the right are the output data.Figure 1
P-box and S-box: (a) ordinary P-box; (b) compressed P-box; (c) expanded P-box; (d) S-box.
(a)(b)(c)(d)The ordinaryP-box is a transposition operation of n-bit input and n-bit output, and there are n! kinds of mapping relationships. The compressed P-box is a transposition operation with n-bit input and m-bit output (n > m). There are nm bits in the input that will not be output. It is suitable for transposition operations while reducing the number of bits to adapt to the next stage. The extended P-box is a transposition operation with n-bit input and m-bit output (m > n). mn bits in the input will be reused and output. It is suitable for transposition operation while increasing the number of bits to adapt to the next stage required. The S-box is a miniature replacement code whose input and output digits can be the same or different. It can be seen that no matter what the kind of P-box is, the position of each bit of the original data is replaced, and the original data will not be changed, while the S-box may change the position of the original data. The S-box is more complicated than the P-box, and the S-box with more bits is difficult to realize. When the number of bits is the same, the S-box has more input and output correspondences than the P-box, so it has higher security [32, 33].Combining the principles of chaos and diffusion, it can be concluded that usingP-boxes alone or S-boxes with fewer digits cannot achieve higher security, because their input and output correspondence can be monitored relatively easily, but if they are used alternately, both can greatly improve safety. The DES/3DES encryption algorithm is a combined transformation network of multiple S-boxes and P-boxes, and under the control of the key, this network is used for repeated iterations, so it has high security [34, 35].


## 4.2. 3DES Encryption Algorithm Construction

The DES algorithm is a block encryption mechanism that divides the plaintext intoN groups, then encrypts each group to form their own ciphertext, and finally merges all the grouped ciphertexts to form the final ciphertext. DES is a symmetric encryption algorithm. Its encryption key and decryption key are the same, and the algorithm is also the same. Its key length is 64 bits. During operation, the 64-bit key will be divided into 8 groups, each with 8 bits, and the last bit of each group is the check bit, so the actual key length is only 56 bits. It should be able to prevent data from being modified and leaked without authorization, and information and data can be protected with high quality. The security of the algorithm does not depend on the confidentiality of the algorithm itself but is based on the security of the key. It is also economical and practical and can be used in different occasions and fields.


### 4.2.1.F (K, R) Function

TheF (K, R) function is the core of the DES encryption algorithm, which is mainly composed of 8 S-boxes. The S-box is the only nonlinear transformation (playing the role of S transformation) in the entire encryption process. The principle of the F function is shown in Figure 2. The right 32-bit data R in each iteration of the DES algorithm is transformed into 48 bits after an E-extended permutation. An S-box transformation results in a 32-bit output, and the 32-bit output finally undergoes a P permutation to obtain the output of the F function. Both E permutation and P permutation are linear transformations, E permutation input is 32 bits, output is 48 bits, and P permutation input and output are both 32 bits. The S-box is a lookup table with 6 inputs and 4 outputs. S1∼S8 are different from each other and are operated in parallel. E replacement, P replacement, and S-box are transformed according to the DES encryption algorithm standard.Figure 2
Principle ofF function.


### 4.2.2. Subkey Generation

The subkey is the 48-bit key corresponding to each iteration of the encryption operation, and the generation principle is shown in Figure3. The initial 64-bit key discards the 8th, 16th, 24th, 32nd, 40th, 48th, 56th, and 64th 8-bit odd parity bits. The remaining 56 bits undergo a set change. PC-1 is used in these two steps. The 56-bit data obtained is divided into left and right parts as in the encryption process, with 28 bits on the left being C0 and 28 bits on the right being D0, then entering 16 rounds of iteration. Cn and Dn (n = 1∼16) in each round of iteration are shifted to the left, respectively, and the number of bits shifted to the left in each round is different, which is determined by the number of rounds. Each round of left shift produces the next round of Cn and Dn, and each round of Cn and Dn is spliced into 56 bits and then subjected to a compression replacement PC-2 to obtain the subkey output Kn of each round. PC-1 replacement and PC-2 replacement are converted according to the DES encryption algorithm standard.Figure 3
Principle of subkey generation.The decryption subkey is the same as the encryption subkey, but the order of use is reversed. That is, if the subkeys used for encryption areK1, K2, …, K16, the subkeys used for decryption are K16, K15, …, K1. In addition, it can be seen from the principle of subkey generation that all permutations in the process of subkey generation are linear transformations and can be replaced by one permutation. Therefore, in the actual use of subkeys, whether it is encryption or decryption, you can first use the input key to generate all subkeys at once and then select the corresponding order of use according to the needs of encryption and decryption.


### 4.2.3. 3DES Encryption

The triple DES (3DES) algorithm is an improved scheme of the DES algorithm. It uses three keys,K1, K2, and K3, and uses DES as the basic module to encrypt and decrypt the plaintext three times. Since its effective key length reaches 168 bits (when K1, K2, and K3 are different), it greatly improves the ability to resist brute force attacks. As shown in Figure 4, when using 3DES encryption, you first use K1 for encryption, then use K2 for decryption, and finally use K3 for encryption; namely,(1)C=Ek3Dk2⋅Ek1P.Figure 4
Principle of 3DES encryption algorithm.In 3DES decryption, first you useK3 for decryption, then use K2 for encryption, and finally use K1 for decryption; namely,(2)P=Dk1Ek2⋅Dk3C.It can be seen that in 3DES decryption, except that the order of using subkeys for each DES module is opposite to the encryption process, the order of using the three input keys is also reversed, but the algorithm structure has not changed.You use the hash function shown in the following formula for calculation to obtain the desired hash address:(3)Hkey=randomkey.Among them, random is a pseudorandom function, and the pseudorandom function is used as a hash function.To use the open addressing method to resolve conflicts, you need to use the following function for calculation:(4)hi=Hkey−di100m,i=0,1,2,…,n−1.In the formula,di is the increment sequence, m is the table length, and H (key) is the hash function; let h0 = H (key).In the case of conflict, the calculation is realized according to the second detection and rehashing method, the result will be jump detection on both sides of the hash table, and the value of the increment sequencedi is(5)di=i,i<m2,−i,i≥m2.Using rehashing to handle conflicts needs to be calculated according to the following formula:(6)Hi=RHikey,i=0,1,2,…,k−1.


## 4.2.1.F (K, R) Function

TheF (K, R) function is the core of the DES encryption algorithm, which is mainly composed of 8 S-boxes. The S-box is the only nonlinear transformation (playing the role of S transformation) in the entire encryption process. The principle of the F function is shown in Figure 2. The right 32-bit data R in each iteration of the DES algorithm is transformed into 48 bits after an E-extended permutation. An S-box transformation results in a 32-bit output, and the 32-bit output finally undergoes a P permutation to obtain the output of the F function. Both E permutation and P permutation are linear transformations, E permutation input is 32 bits, output is 48 bits, and P permutation input and output are both 32 bits. The S-box is a lookup table with 6 inputs and 4 outputs. S1∼S8 are different from each other and are operated in parallel. E replacement, P replacement, and S-box are transformed according to the DES encryption algorithm standard.Figure 2
Principle ofF function.


## 4.2.2. Subkey Generation

The subkey is the 48-bit key corresponding to each iteration of the encryption operation, and the generation principle is shown in Figure3. The initial 64-bit key discards the 8th, 16th, 24th, 32nd, 40th, 48th, 56th, and 64th 8-bit odd parity bits. The remaining 56 bits undergo a set change. PC-1 is used in these two steps. The 56-bit data obtained is divided into left and right parts as in the encryption process, with 28 bits on the left being C0 and 28 bits on the right being D0, then entering 16 rounds of iteration. Cn and Dn (n = 1∼16) in each round of iteration are shifted to the left, respectively, and the number of bits shifted to the left in each round is different, which is determined by the number of rounds. Each round of left shift produces the next round of Cn and Dn, and each round of Cn and Dn is spliced into 56 bits and then subjected to a compression replacement PC-2 to obtain the subkey output Kn of each round. PC-1 replacement and PC-2 replacement are converted according to the DES encryption algorithm standard.Figure 3
Principle of subkey generation.The decryption subkey is the same as the encryption subkey, but the order of use is reversed. That is, if the subkeys used for encryption areK1, K2, …, K16, the subkeys used for decryption are K16, K15, …, K1. In addition, it can be seen from the principle of subkey generation that all permutations in the process of subkey generation are linear transformations and can be replaced by one permutation. Therefore, in the actual use of subkeys, whether it is encryption or decryption, you can first use the input key to generate all subkeys at once and then select the corresponding order of use according to the needs of encryption and decryption.


## 4.2.3. 3DES Encryption

The triple DES (3DES) algorithm is an improved scheme of the DES algorithm. It uses three keys,K1, K2, and K3, and uses DES as the basic module to encrypt and decrypt the plaintext three times. Since its effective key length reaches 168 bits (when K1, K2, and K3 are different), it greatly improves the ability to resist brute force attacks. As shown in Figure 4, when using 3DES encryption, you first use K1 for encryption, then use K2 for decryption, and finally use K3 for encryption; namely,(1)C=Ek3Dk2⋅Ek1P.Figure 4
Principle of 3DES encryption algorithm.In 3DES decryption, first you useK3 for decryption, then use K2 for encryption, and finally use K1 for decryption; namely,(2)P=Dk1Ek2⋅Dk3C.It can be seen that in 3DES decryption, except that the order of using subkeys for each DES module is opposite to the encryption process, the order of using the three input keys is also reversed, but the algorithm structure has not changed.You use the hash function shown in the following formula for calculation to obtain the desired hash address:(3)Hkey=randomkey.Among them, random is a pseudorandom function, and the pseudorandom function is used as a hash function.To use the open addressing method to resolve conflicts, you need to use the following function for calculation:(4)hi=Hkey−di100m,i=0,1,2,…,n−1.In the formula,di is the increment sequence, m is the table length, and H (key) is the hash function; let h0 = H (key).In the case of conflict, the calculation is realized according to the second detection and rehashing method, the result will be jump detection on both sides of the hash table, and the value of the increment sequencedi is(5)di=i,i<m2,−i,i≥m2.Using rehashing to handle conflicts needs to be calculated according to the following formula:(6)Hi=RHikey,i=0,1,2,…,k−1.


## 5. Experimental Results and Analysis

### 5.1. Encryption Effect Test

According to the number of bits of data change between the encryption result and the plaintext, the encryption effect of the DES algorithm can be judged. Therefore, the encryption effect of the DES algorithm will be explained from two aspects, namely, the conventional DES algorithm and the improved DES algorithm. First, we perform conventional DES algorithm encryption and improved DES algorithm encryption on a plaintext to explain the encryption process and encryption effect in detail. Furthermore, in order to avoid the contingency of the experiment, multiple sets of experimental data are encrypted using the same method when encrypting a plaintext, so as to obtain the encryption effect of the conventional DES algorithm and the improved DES algorithm. For a certain piece of plaintext, we use the conventional DES algorithm and the improved DES algorithm to encrypt the plaintext.Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1000”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1000.”It is possible to obtain the encryption effect of using the conventional DES algorithm and the improved DES algorithm to encrypt information respectively, in which the bits of the ciphertext that have changed relative to the plaintext are represented by “1,” and the bits that have not changed are represented by “0.” In order to avoid the contingency of the experiment, the encryption experiment was performed on 10 different plaintexts using the same key. The test results are shown in Figure5. From the experimental results, it can be seen that the 3DES encryption algorithm has the same encryption effect as the conventional DES algorithm. The “change bit” is about 32 bits, which is half of the total, and it has a good encryption effect. Compared with plaintext, ciphertext has become completely unrecognizable and has good security.Figure 5
Test results of encryption effect.


### 5.2. Avalanche Effect Test

“Avalanche effect” refers to an unstable state of equilibrium. A small change in the plaintext or key will cause a significant change in the ciphertext. Therefore, this article will explain the “avalanche effect” of the original DES algorithm and the improved DES algorithm from two aspects, namely, changing one bit of the plaintext and changing one bit of the key. First, we perform an “avalanche effect” experiment in which the plaintext or the key is changed by one bit for a piece of data, and the experimental process and experimental results are explained in detail. Furthermore, in order to avoid the contingency of the experiment, the plaintext or key is changed by one bit, and multiple sets of data are used for experiments, so as to obtain the “avalanche effect” of the conventional DES algorithm and the improved DES algorithm.


#### 5.2.1. Keep the Key Unchanged and Change One Bit of the Plaintext

Let the plaintext be the ASCII code value of “abcdefgi.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 69,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1001”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1000.”We keep the key unchanged, change a bit of the plaintext, and encrypt the information with the conventional DES algorithm and the improved DES algorithm. By keeping the key unchanged and changing one bit of the plaintext, the “change number” of the ciphertext is about 32 bits, which is about half of the total.In order to avoid the contingency of the experiment, we use the same key “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08” to perform encryption experiments on 10 plaintexts with a difference of 1 bit between two adjacent test items. In the experiment, based on the plaintext “abcdefgh,” each test item is compared with the encryption result of the previous test item, and the test result is shown in Figure6. It can be seen from the experimental results that the 3DES encryption algorithm has the same “avalanche effect” compared to the conventional DES algorithm. When the plaintext changes by one bit, the ciphertext “changes the number of bits” to around 32 bits, reaching half of the total, which has a good “avalanche effect.”Figure 6
Test results of “avalanche effect” changing the plaintext.


#### 5.2.2. Keep the Plaintext Unchanged and Change One Bit of the Key

Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1000”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 09,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1001.”We keep the plaintext unchanged, change one bit of the key, and encrypt the information with the conventional DES algorithm and the improved DES algorithm. Both the conventional DES algorithm and the improved DES algorithm have a good “avalanche effect.” By keeping the plaintext unchanged and changing one bit of the key, the ciphertext “changes the number of bits” to about 32 bits, which is about half of the total.In order to avoid the contingency of the experiment, an encryption experiment was performed on the same plaintext “abcdefgh” with 10 keys that differ by 1 bit between two adjacent test items. In the experiment, based on the key “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” each test item is compared with the encryption result of the previous test item. The test result is shown in Figure7. It can be seen from the experimental results that the 3DES encryption algorithm has the same “avalanche effect” compared to the conventional DES algorithm. When the key is changed by one bit, the ciphertext “changes the number of bits” to about 32 bits, reaching half of the total, which has a good “avalanche effect.”Figure 7
“Avalanche effect” test results of changing the key.


### 5.3. Run Time Test

The running time is also part of the algorithm performance, so the following will test the running time of the conventional DES algorithm and the improved DES algorithm. First, we perform conventional DES algorithm encryption and improved DES algorithm encryption on a plaintext to get its running time, and explain its test process and running time in detail. Furthermore, in order to avoid the contingency of the experiment, multiple sets of experimental data are tested to obtain the running time of the conventional DES algorithm and the improved DES algorithm.Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68.” The key is the ASCII code value of “12345678,” and the hexadecimal format is “0 × 31, 0 × 32, 0 × 33, 0 × 34, 0 × 35, 0 × 36, 0 × 37, 0 × 38.” Encryption experiments are performed on 10 different plaintexts, and the test results are shown in Figure8.Figure 8
Encryption run time.According to the experimental results of a plaintext, it can be seen that the time required for encryption using the conventional DES algorithm is almost the same as that using the improved DES algorithm for encryption. In order to avoid the contingency of the experiment, the same key “12345678” was used to perform encryption experiments on 14 different plaintexts. From the experimental results, it can be seen that the 3DES encryption algorithm and the conventional DES algorithm have the same running time under the same operating conditions. Although the operating time will fluctuate under the same operating conditions, it is generally maintained at about 0.002 s.The operating system version used in the above experiment is Windows 7 Flagship Edition, the CPU is Intel (R) Core (TM) i5-2430M @ 2.40 GHz, the memory is 8 GB, with 64-bit operating system, and the operating environment is Visual Studio 2015. In order to make the experimental data more representative and change the operating environment of the experiment, the operating system version is Windows 10 Home Chinese Edition, the CPU is Intel (R) Core (TM) i5-5200U @ 2.20 GHz 2.19 GHz, the memory is 8 GB, with 64-bit operating system, and the running environment is VMware Workstation. Through the experiment, you can get the data of the encryption effect test and the avalanche effect test. The operating system version is Windows 7 Ultimate, the CPU is Intel (R) Core (TM) i5-2430M @ 2.40 GHz 2.40 GHz, the memory is 4 GB, and the data is the same when the operating environment and the development environment are Visual Studio 2013. The data of the run time test will be different. Encryption experiments are performed on 14 different plaintexts, and the test results are shown in Figure9.Figure 9
Algorithm encryption running time.It can be seen from the experimental results that although changing the operating environment will have an impact on the running time of the program, in general, the 3DES encryption algorithm and the conventional DES algorithm have the same running time under the same operating conditions.


## 5.1. Encryption Effect Test

According to the number of bits of data change between the encryption result and the plaintext, the encryption effect of the DES algorithm can be judged. Therefore, the encryption effect of the DES algorithm will be explained from two aspects, namely, the conventional DES algorithm and the improved DES algorithm. First, we perform conventional DES algorithm encryption and improved DES algorithm encryption on a plaintext to explain the encryption process and encryption effect in detail. Furthermore, in order to avoid the contingency of the experiment, multiple sets of experimental data are encrypted using the same method when encrypting a plaintext, so as to obtain the encryption effect of the conventional DES algorithm and the improved DES algorithm. For a certain piece of plaintext, we use the conventional DES algorithm and the improved DES algorithm to encrypt the plaintext.Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1000”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1000.”It is possible to obtain the encryption effect of using the conventional DES algorithm and the improved DES algorithm to encrypt information respectively, in which the bits of the ciphertext that have changed relative to the plaintext are represented by “1,” and the bits that have not changed are represented by “0.” In order to avoid the contingency of the experiment, the encryption experiment was performed on 10 different plaintexts using the same key. The test results are shown in Figure5. From the experimental results, it can be seen that the 3DES encryption algorithm has the same encryption effect as the conventional DES algorithm. The “change bit” is about 32 bits, which is half of the total, and it has a good encryption effect. Compared with plaintext, ciphertext has become completely unrecognizable and has good security.Figure 5
Test results of encryption effect.


## 5.2. Avalanche Effect Test

“Avalanche effect” refers to an unstable state of equilibrium. A small change in the plaintext or key will cause a significant change in the ciphertext. Therefore, this article will explain the “avalanche effect” of the original DES algorithm and the improved DES algorithm from two aspects, namely, changing one bit of the plaintext and changing one bit of the key. First, we perform an “avalanche effect” experiment in which the plaintext or the key is changed by one bit for a piece of data, and the experimental process and experimental results are explained in detail. Furthermore, in order to avoid the contingency of the experiment, the plaintext or key is changed by one bit, and multiple sets of data are used for experiments, so as to obtain the “avalanche effect” of the conventional DES algorithm and the improved DES algorithm.


### 5.2.1. Keep the Key Unchanged and Change One Bit of the Plaintext

Let the plaintext be the ASCII code value of “abcdefgi.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 69,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1001”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1000.”We keep the key unchanged, change a bit of the plaintext, and encrypt the information with the conventional DES algorithm and the improved DES algorithm. By keeping the key unchanged and changing one bit of the plaintext, the “change number” of the ciphertext is about 32 bits, which is about half of the total.In order to avoid the contingency of the experiment, we use the same key “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08” to perform encryption experiments on 10 plaintexts with a difference of 1 bit between two adjacent test items. In the experiment, based on the plaintext “abcdefgh,” each test item is compared with the encryption result of the previous test item, and the test result is shown in Figure6. It can be seen from the experimental results that the 3DES encryption algorithm has the same “avalanche effect” compared to the conventional DES algorithm. When the plaintext changes by one bit, the ciphertext “changes the number of bits” to around 32 bits, reaching half of the total, which has a good “avalanche effect.”Figure 6
Test results of “avalanche effect” changing the plaintext.


### 5.2.2. Keep the Plaintext Unchanged and Change One Bit of the Key

Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1000”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 09,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1001.”We keep the plaintext unchanged, change one bit of the key, and encrypt the information with the conventional DES algorithm and the improved DES algorithm. Both the conventional DES algorithm and the improved DES algorithm have a good “avalanche effect.” By keeping the plaintext unchanged and changing one bit of the key, the ciphertext “changes the number of bits” to about 32 bits, which is about half of the total.In order to avoid the contingency of the experiment, an encryption experiment was performed on the same plaintext “abcdefgh” with 10 keys that differ by 1 bit between two adjacent test items. In the experiment, based on the key “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” each test item is compared with the encryption result of the previous test item. The test result is shown in Figure7. It can be seen from the experimental results that the 3DES encryption algorithm has the same “avalanche effect” compared to the conventional DES algorithm. When the key is changed by one bit, the ciphertext “changes the number of bits” to about 32 bits, reaching half of the total, which has a good “avalanche effect.”Figure 7
“Avalanche effect” test results of changing the key.


## 5.2.1. Keep the Key Unchanged and Change One Bit of the Plaintext

Let the plaintext be the ASCII code value of “abcdefgi.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 69,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1001”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1000.”We keep the key unchanged, change a bit of the plaintext, and encrypt the information with the conventional DES algorithm and the improved DES algorithm. By keeping the key unchanged and changing one bit of the plaintext, the “change number” of the ciphertext is about 32 bits, which is about half of the total.In order to avoid the contingency of the experiment, we use the same key “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08” to perform encryption experiments on 10 plaintexts with a difference of 1 bit between two adjacent test items. In the experiment, based on the plaintext “abcdefgh,” each test item is compared with the encryption result of the previous test item, and the test result is shown in Figure6. It can be seen from the experimental results that the 3DES encryption algorithm has the same “avalanche effect” compared to the conventional DES algorithm. When the plaintext changes by one bit, the ciphertext “changes the number of bits” to around 32 bits, reaching half of the total, which has a good “avalanche effect.”Figure 6
Test results of “avalanche effect” changing the plaintext.


## 5.2.2. Keep the Plaintext Unchanged and Change One Bit of the Key

Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68,” and the binary form is “0110 0001 0110 00100110 0011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1000”; the key is the hexadecimal number “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 09,” and the binary form is “0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 01110000 1001.”We keep the plaintext unchanged, change one bit of the key, and encrypt the information with the conventional DES algorithm and the improved DES algorithm. Both the conventional DES algorithm and the improved DES algorithm have a good “avalanche effect.” By keeping the plaintext unchanged and changing one bit of the key, the ciphertext “changes the number of bits” to about 32 bits, which is about half of the total.In order to avoid the contingency of the experiment, an encryption experiment was performed on the same plaintext “abcdefgh” with 10 keys that differ by 1 bit between two adjacent test items. In the experiment, based on the key “0 × 01, 0 × 02, 0 × 03, 0 × 04, 0 × 05, 0 × 06, 0 × 07, 0 × 08,” each test item is compared with the encryption result of the previous test item. The test result is shown in Figure7. It can be seen from the experimental results that the 3DES encryption algorithm has the same “avalanche effect” compared to the conventional DES algorithm. When the key is changed by one bit, the ciphertext “changes the number of bits” to about 32 bits, reaching half of the total, which has a good “avalanche effect.”Figure 7
“Avalanche effect” test results of changing the key.


## 5.3. Run Time Test

The running time is also part of the algorithm performance, so the following will test the running time of the conventional DES algorithm and the improved DES algorithm. First, we perform conventional DES algorithm encryption and improved DES algorithm encryption on a plaintext to get its running time, and explain its test process and running time in detail. Furthermore, in order to avoid the contingency of the experiment, multiple sets of experimental data are tested to obtain the running time of the conventional DES algorithm and the improved DES algorithm.Let the plaintext be the ASCII code value of “abcdefgh.” Its hexadecimal form is “0 × 61, 0 × 62, 0 × 63, 0 × 64, 0 × 65, 0 × 66, 0 × 67, 0 × 68.” The key is the ASCII code value of “12345678,” and the hexadecimal format is “0 × 31, 0 × 32, 0 × 33, 0 × 34, 0 × 35, 0 × 36, 0 × 37, 0 × 38.” Encryption experiments are performed on 10 different plaintexts, and the test results are shown in Figure8.Figure 8
Encryption run time.According to the experimental results of a plaintext, it can be seen that the time required for encryption using the conventional DES algorithm is almost the same as that using the improved DES algorithm for encryption. In order to avoid the contingency of the experiment, the same key “12345678” was used to perform encryption experiments on 14 different plaintexts. From the experimental results, it can be seen that the 3DES encryption algorithm and the conventional DES algorithm have the same running time under the same operating conditions. Although the operating time will fluctuate under the same operating conditions, it is generally maintained at about 0.002 s.The operating system version used in the above experiment is Windows 7 Flagship Edition, the CPU is Intel (R) Core (TM) i5-2430M @ 2.40 GHz, the memory is 8 GB, with 64-bit operating system, and the operating environment is Visual Studio 2015. In order to make the experimental data more representative and change the operating environment of the experiment, the operating system version is Windows 10 Home Chinese Edition, the CPU is Intel (R) Core (TM) i5-5200U @ 2.20 GHz 2.19 GHz, the memory is 8 GB, with 64-bit operating system, and the running environment is VMware Workstation. Through the experiment, you can get the data of the encryption effect test and the avalanche effect test. The operating system version is Windows 7 Ultimate, the CPU is Intel (R) Core (TM) i5-2430M @ 2.40 GHz 2.40 GHz, the memory is 4 GB, and the data is the same when the operating environment and the development environment are Visual Studio 2013. The data of the run time test will be different. Encryption experiments are performed on 14 different plaintexts, and the test results are shown in Figure9.Figure 9
Algorithm encryption running time.It can be seen from the experimental results that although changing the operating environment will have an impact on the running time of the program, in general, the 3DES encryption algorithm and the conventional DES algorithm have the same running time under the same operating conditions.


## 6. Conclusion

With the new demand of economic development for accounting informatization, how to efficiently collect and use industry accounting statement data through scientific and effective financial analysis methods has become a major issue of general concern in all walks of life. The industry accounting report data warehouse is built together, the report is used to collect industry accounting report data, and the collected data is built into the data warehouse. The main weakness of the DES algorithm is that the key length used for encryption is too short, which is vulnerable to exhaustive attacks. Aiming at the weaknesses of the DES algorithm, we find a way to make the encryption process of the DES algorithm one encryption process at a time, thereby increasing the security of the DES algorithm. From a theoretical point of view, the 3DES encryption algorithm only changes the order in which the subkeys are used but retains the data encryption part of the DES algorithm intact, which also retains the good structural characteristics of the DES algorithm. Besides, the good structure of the DES algorithm can effectively resist common attacks except exhaustive search, so the improved DES algorithm is compared with the conventional DES algorithm, and its security becomes better; from the experimental point of view, the 3DES encryption algorithm still has a good avalanche effect. In addition, because the DES algorithm is very fast in encryption, compared with the conventional DES algorithm, the 3DES encryption algorithm has not changed much in terms of time. The improved DES algorithm increases security and makes it more reliable. In this article, the encrypted QR code obtained after a series of operations is directly transmitted to the recipient for decryption, and the obtained QR code is not printed out. The subsequent operations are performed by scanning the printed QR code, so in the follow-up work, relevant research can be carried out on the identification of QR codes according to actual needs.



---

*Source: 7212688-2021-06-04.xml*