A chaotic image encryption and decryption method based on dynamic correlation of plaintext pixels

The keys are generated through the SHA-512 algorithm and the variable parameter two-dimensional Logistic hyperchaotic system, combined with dynamic chaos and diffusion, and the problems of poor correlation between keys and plaintext and multiple rounds of encryption in the existing technology are solved, and efficient and secure chaotic image encryption and decryption are achieved.

CN116599644BActive Publication Date: 2025-08-19GANSU PROVINCIAL COMPUTING CENT
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310598851.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-25
Publication Date
2025-08-19
Estimated Expiration
2043-05-25

AI Technical Summary

Technical Problem

In the existing chaotic image encryption methods, the key and plaintext correlation are poor, they cannot effectively resist differential attacks, and require multiple rounds of encryption, resulting in insecurity and inefficiency.

Method used

The SHA-512 algorithm is used to generate the key, combined with the variable parameter two-dimensional Logistic hyperchaotic system, and the key is generated through a dynamic chaos and diffusion process, which improves the correlation between the encryption results and the plain text image, and implements the encryption and decryption through reversible XOR operation.

Benefits of technology

It significantly improves the correlation between encryption results and plaintext images, can effectively prevent plaintext attacks, improves encryption efficiency, only one round of encryption can meet security requirements, and has a large key space and high sensitivity, resists statistical analysis and differential attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116599644B_ABST
    Figure CN116599644B_ABST
Patent Text Reader

Abstract

The present invention provides a chaotic image encryption and decryption method dynamically correlated with plaintext pixels. This method, which belongs to the field of image encryption, includes key generation, image encryption, and image decryption. The key generation step proposes a plaintext pixel-correlated key generation algorithm to improve the correlation between the encryption result and the plaintext image, effectively preventing chosen-plaintext attacks. The image encryption step includes a dynamic scrambling and diffusion method, combining the scrambling and diffusion processes. Each operation is dynamically modified by the encryption result, enhancing the randomness of the encryption process. This dynamic scrambling and diffusion encryption method allows the plaintext image to be securely encrypted with only a single round of encryption. The present invention possesses a large key space and high key sensitivity, and is resistant to common key analysis methods such as statistical analysis, differential analysis, and chosen-plaintext analysis, providing a high level of security for the storage and transmission of digital images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of encryption and decryption, and relates to a chaotic image encryption and decryption method dynamically correlated with plaintext pixels. Background Art

[0002] Decades of exploration in the field of digital image encryption have yielded numerous excellent methods. However, with the continuous improvement of modern computer performance and the advancement of cryptographic techniques, the security of many methods has been challenged, and methods previously considered highly secure have been proven insecure. In the process of researching encryption methods, in addition to ensuring that they can effectively encrypt image information, it is also crucial to enhance their ability to resist various attack methods.

[0003] To defend against chosen-plaintext attacks, Li et al. in 2018 designed a plaintext-dependent keystream generation method. In the scrambling phase, the total pixel value of the entire image and input parameters are used to generate the key; in the diffusion phase, the pixel values at nine fixed positions in the diffusion result are used to generate the key. This method uses different keystream generation methods in each phase, and both keystream generation methods are associated with the plaintext image, making it capable of defending against chosen-plaintext attacks. However, this method is complex, and the key generation in the diffusion phase is only dependent on the values of nine specific positions. An attacker could exploit this flaw, resulting in security vulnerabilities. In 2022, Chen et al. used a hash algorithm to generate some initial parameters of a chaotic system, thereby increasing the correlation between the encryption method and the plaintext image. However, to ensure the parameter range of the chaotic system, this key generation method also used manually entered parameters, which could result in the same encryption key for different input images, making it less resistant to chosen-plaintext attacks. Later, Peng et al. developed a plaintext-dependent scrambling method that effectively resists chosen-plaintext attacks. However, this method requires multiple rounds of encryption, each of which involves multiple rounds of scrambling and diffusion. Because the scrambling process is related to the plaintext, this method is resistant to chosen-plaintext attacks, and the multiple rounds of encryption enhance its security. However, its drawbacks include high complexity, a long process time, and low encryption efficiency.

[0004] The inventor has retrieved a Chinese invention patent related to this technical field. The patent title is: Chaotic Image Encryption and Transmission Method Based on Public Key System and Hash Algorithm, application number: 202110654294.X. The technical features that distinguish the present invention from the above patent are as follows, and the above patent is referred to as the "comparative document":

[0005] 1. The comparative document involves a public key system and a private key system, using the private key system to encrypt the image, and then using the public key system to encrypt and transmit the private key. The present invention only involves the image encryption and decryption process, that is, only includes the private key system;

[0006] 2. Both the comparative document and the present invention use a hash algorithm as a means of associating images. The hash algorithm can generate different hash values for different images. Even if the images are not very different, completely different hash values will be generated. This is a common operation in the field of image encryption. However, the specific algorithms used and the ways in which the hash values are utilized are different.

[0007] Specifically, the comparative document uses a hash algorithm to encrypt and decrypt images, but the document does not specify the type of hash algorithm used and how it is used. The present invention uses the SHA-512 hash algorithm to generate a hash value from the image, and then uses a self-designed key generation algorithm to generate parameters for generating random numbers from the hash value. The key generation algorithm is also a technical feature of the present invention.

[0008] 3. The private key system in the comparative document and the image encryption and decryption system in the present invention both include image scrambling and diffusion operations. This operation is a common concept in the field of image encryption, but the specific implementation methods are completely different. At the same time, due to the reversibility of the XOR operation in the diffusion operation, XOR is also a common basic operation in the field of image encryption and has no similarity. The scrambling process of the comparative document belongs to the scrambling operation of the bit plane, that is, a pixel value ranging from 0 to 256 is converted into 8-bit binary, and then the specified bits in the binary are combined (forming a square matrix), and then the row and column shift operations are performed after the combination. After the scrambling operation is completed, it is restored to the pixel-level image matrix (8-bit binary is converted into pixel values of 0 to 255). In the diffusion process, a random number matrix of the same size as the image is generated from the chaotic system, and each pixel in the image is XORed with the random number at the corresponding position in the random number matrix, and then XORed with the pixel value below or to the right of the pixel according to the rules to obtain the encrypted image.

[0009] Specifically, the differences between the two implementations of scrambling and diffusion are:

[0010] ① The comparative document first performs bit-plane scrambling on the image and then performs pixel-level diffusion. The present invention combines scrambling and diffusion, completing pixel-level scrambling and diffusion in one operation. The scrambling and diffusion methods are different from those in the comparative document. It can be understood that the encryption operation of the file requires two steps, while the encryption operation of the present invention only requires one step.

[0011] ② In the diffusion stage, the comparison file uses chaotic decimals multiplied by 255 to generate formatted random numbers. The present invention uses chaotic decimals multiplied by 10 16Multiply and then take the modulus with 255 to format the random number. Different formatting methods will produce different formatting results, and thus the degree of utilization of the random decimal is also different. Taking the random decimal 0.8147 generated by Matlab as an example, the formatting result of the comparison file is 207, and the formatting result of the present invention is 230;

[0012] ③ In the diffusion stage, the comparison file stores the encryption results in two-dimensional form. After XOR, it is determined whether there are adjacent results (to the right and below) in the two-dimensional space. If so, XOR is performed (at most twice). The encryption results of the present invention are stored in a one-dimensional array. After each XOR, it is XORed again with the previous XOR result and stored (only XORed once). Different storage methods and different XOR times and objects will produce completely different encryption effects. Summary of the Invention

[0013] The purpose of the present invention is to address the problems existing in the prior art and provide a chaotic image encryption and decryption method dynamically correlated with plaintext pixels, which solves the problems in traditional encryption methods such as poor correlation between keys and plaintext, inability to resist differential attacks, and the need for multiple rounds of encryption.

[0014] To this end, the present invention adopts the following technical solutions:

[0015] A chaotic image encryption and decryption method dynamically correlated with plaintext pixels, including key generation, image encryption and image decryption;

[0016] The key generation includes the following steps:

[0017] Step A1. Obtaining a hash value: Using the SHA-512 algorithm to calculate a hash value K from the plaintext image to be encrypted. The hash value K is 512 bits long and is a binary string.

[0018] Step A2. Hash value segmentation: Split the 512-bit hash value K into 8-bits to obtain k1, k2, k3, ..., k 64 There are 64 binary numbers of length 8 in total;

[0019] Step A3. Calculate intermediate parameters: Perform an XOR operation on the split binary number to calculate four intermediate values h1, h2, h3, and h4. The calculation method is as follows:

[0020]

[0021] Step A4. Calculation of control parameters and initial values: Calculate the three parameters α, x1, and y1 required for the variable parameter two-dimensional logistic hyperchaotic system based on the intermediate parameters. The calculation method is shown in the following formula:

[0022]

[0023] Where mod(x, y) represents the modulo calculation of x on y;

[0024] The image encryption comprises the following steps:

[0025] Input: key KEY = α, x1, y1 generated in step A4, plaintext image P of size M × N;

[0026] Step B1. Obtaining a random array: Input the key KEY into a variable-parameter two-dimensional logistic hyperchaotic system and perform M×N+T iterations, where T is a constant. In the present invention, T=1000. To eliminate transient phenomena that may exist in the chaotic system, the first T sequences of the output are removed to obtain two-dimensional random number arrays X and Y of size M×N.

[0027] Step B2. Based on the rules for dynamic scrambling and diffusion of random arrays, sum the rows and columns of the M×N two-dimensional random array X, sort the sums in descending order, and use the sorted positions as row and column numbers to construct a scrambling rule S consisting of row and column numbers. The diffusion rule is the random number matrix Y;

[0028] Step B3. Let the encryption result be C, which is a one-dimensional matrix of size M×N. The encryption process is the process of traversing the scrambling rule S. Set the traversal direction flag FLAG; when FLAG = 0, traversal is performed from top to bottom and from left to right. When FLAG = 1, traversal is performed from bottom to top and from right to left.

[0029] In the process of traversing the scrambling rule S, the position label (S i , S j ), which represents the row and column numbers of the two-dimensional matrix, and selects the pixel value P(S i , S j ), this is the scrambling process; the selected pixel value and the random number Y(S i , S j ) Diffusion encryption is performed according to the rules shown in the following formula, which is the diffusion process;

[0030]

[0031] Where k∈[1, M×N] represents the location where the encryption result is stored in the ciphertext. The encryption process selects images from the plaintext image in a disordered order, and the encryption result is stored in the ciphertext image in order. floor(x) represents the ceiling function.

[0032] After each diffusion, the FLAG flag is recalculated to determine the position of the next scrambling. The initial scrambling position is determined by the control parameters of the chaotic system, and the calculation method is shown in the following formula:

[0033]

[0034] After the scrambling rule S is traversed, the encryption process is completed, and the matrix C is converted into a two-dimensional matrix of size M×N to obtain the encryption result.

[0035] The image decryption comprises the following steps:

[0036] Input: key KEY = α, x1, y1, ciphertext image C of size M × N;

[0037] Step C1. Obtain encryption rules: Use the scrambling rule S and diffusion rule Y obtained in step B1 of the image encryption process;

[0038] Step C2. Inverse diffusion process: convert the ciphertext matrix C into a one-dimensional matrix, traverse the ciphertext matrix C in reverse order, and first calculate the FLAG flag to obtain the position label (S i , S j ), perform reverse XOR on the pixel values to obtain the scrambled pixel values, and then place the pixel values into the intermediate matrix P1 according to the traversal direction indicated by FLAG;

[0039] The method to obtain pixel values is as follows:

[0040]

[0041] Where k represents the subscript of the currently traversed ciphertext matrix C, k = M × N, M × N-1, ..., 1;

[0042] Step C3. The reverse scrambling process is as follows:

[0043] P(S i , S j )=P1(i,j)

[0044] Among them, i∈[1,M], j∈[1,N];

[0045] After the traversal is completed, P is the decrypted plaintext image.

[0046] The beneficial effects of the present invention are:

[0047] 1. This invention proposes a key generation method related to plaintext pixels, which can significantly improve the correlation between the encryption result and the plaintext image, thereby effectively preventing chosen-plaintext attacks;

[0048] 2. The present invention proposes a dynamic scrambling and diffusion method, which combines the scrambling and diffusion processes. Each step of the operation is dynamically selected by the encryption rules, which improves the randomness of the encryption process and thus improves the encryption effect. This method only requires one round of encryption to meet the security requirements of data image encryption, thereby improving the efficiency of the encryption algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A flowchart of key generation according to the present invention;

[0050] Figure 2 This is a flow chart of the encryption method of the present invention;

[0051] Figure 3 Generate an example graph for the scrambling rules of the present invention;

[0052] Figure 4 This is a diagram of the simulation encryption and decryption results of the present invention;

[0053] Figure 5 This is a diagram showing the key sensitivity analysis results of the present invention;

[0054] Figure 6 is the histogram analysis result of the present invention;

[0055] Figure 7 The distribution map of adjacent pixels before and after encryption of the Lena map of the present invention;

[0056] Figure 8 This is a diagram of the differential analysis results of the present invention. DETAILED DESCRIPTION

[0057] The technical solution of the present invention is described below in conjunction with the accompanying drawings and implementation methods.

[0058] First, some basic concepts are introduced.

[0059] Chaotic image encryption: The most common encryption method in chaotic image encryption systems is symmetric encryption, which uses the same key to complete the encryption and decryption processes. There is an established premise that, in addition to the key, the detailed encryption and decryption steps are public. The chaotic image encryption system is a concretization of the application of cryptography. The elements it contains are the same as cryptography, but they are more specific.

[0060] A chaotic image encryption method usually includes the following:

[0061] (1) Key: Parameters used for encryption and decryption. In chaotic image encryption, the key is usually composed of two forms: the first is composed of the control parameters and constants of the chaotic system; the second is composed of certain specific information of the image;

[0062] (2) Chaotic system: Chaotic system mainly provides pseudo-random sequences for image encryption methods. Encryption methods use the random characteristics of pseudo-random sequences to encrypt images, so chaotic systems can also be called random number generators.

[0063] (3) Plaintext image: The image to be encrypted generally carries information that can be recognized by the human eye. For a 256-level grayscale image, it can be regarded as a two-dimensional matrix with values between 0 and 255. If it is a color image, it can be divided into multiple two-dimensional matrices according to the color space;

[0064] (4) Ciphertext image: The image after the plaintext image is converted, in which the information that can be recognized by the human eye in the plaintext image is encrypted, and is generally displayed as an image composed of random noise;

[0065] (5) Encryption method: the method used to convert plaintext into ciphertext;

[0066] (6) Decryption method: The method used to convert ciphertext into plaintext.

[0067] (7) 2D-LHMVP chaotic system: The full name is the variable parameter two-dimensional logistic hyperchaotic system, which is defined as:

[0068]

[0069] Where n represents the number of iterations of the current chaotic system, α∈[0, 6] is the control parameter of the system, and x0∈[0, 1] and y0∈[0, 1] are the initial values.

[0070] like Figure 1 As shown, a chaotic image encryption and decryption method dynamically correlated with plaintext pixels includes key generation, image encryption and image decryption;

[0071] The key generation includes the following steps:

[0072] Step A1. Obtaining a hash value: Using the SHA-512 algorithm to calculate a hash value K from the plaintext image to be encrypted. The hash value K is 512 bits long and is a binary string.

[0073] Step A2. Hash value segmentation: Split the 512-bit hash value K into 8-bits to obtain k1, k2, k3, ..., k 64 There are 64 binary numbers of length 8 in total;

[0074] Step A3. Calculate intermediate parameters: Perform an XOR operation on the split binary number to calculate four intermediate values h1, h2, h3, and h4. The calculation method is as follows:

[0075]

[0076] Step A4. Calculation of control parameters and initial values: Calculate the three parameters α, x1, and y1 required for the 2D-LHMVP hyperchaotic system based on the intermediate parameters. The calculation method is shown in the following formula:

[0077]

[0078] Where mod(x, y) represents the modulo calculation of x on y;

[0079] In order to ensure that the generated control parameters are within the 2D-LHMVP hyperchaotic interval, initial values are added to the generation of α. After calculation, the range of the initial parameters is α∈[1, 6], x1∈[0, 1], y1∈[0, 1].

[0080] like Figure 2 As shown in the figure, the initial parameters are input into the 2D-LHMVP chaotic system for iteration, and the two outputs are recorded as x and y respectively. The scrambling rules are formulated based on the x output, and y is used as the diffusion parameter. After each diffusion operation, the rules for the next scrambling and diffusion are dynamically adjusted according to the diffusion results. This is a dynamic scrambling and diffusion method. The entire encryption method only needs one round of scrambling and diffusion to generate an encrypted image, and it meets the strength requirements of digital image encryption methods in terms of security and effectiveness.

[0081] Specifically, image encryption includes the following steps:

[0082] Input: key KEY = α, x1, y1 generated in step A4, plaintext image P of size M × N;

[0083] Step B1. Obtaining a random array: Input the key KEY into the 2D-LHMVP chaotic system and perform M×N+T iterations, where T is a constant. In the present invention, T=1000. To eliminate transient phenomena that may exist in the chaotic system, the first T sequences of the output are removed to obtain two-dimensional random number arrays X and Y, both of size M×N.

[0084] Step B2. According to the rules for dynamic scrambling and diffusion of random arrays, sum the two-dimensional random array X of size M×N according to rows and columns respectively, arrange the summed results in descending order, and use the arranged positions as row and column numbers to construct a scrambling rule S consisting of row and column numbers, such as Figure 3 As shown, the diffusion rule is the random number matrix Y;

[0085] Step B3. Let the encryption result be C, which is a one-dimensional matrix of size M×N. The encryption process is the process of traversing the scrambling rule S. Set the traversal direction flag FLAG; when FLAG = 0, traversal is performed from top to bottom and from left to right. When FLAG = 1, traversal is performed from bottom to top and from right to left.

[0086] In the process of traversing the scrambling rule S, the position label (S i , S j ), which represents the row and column numbers of the two-dimensional matrix, and selects the pixel value P(S i , S j ), this is the scrambling process;

[0087] The selected pixel value and the random number Y(S i , S j ) Diffusion encryption is performed according to the rules shown in the following formula, which is the diffusion process;

[0088]

[0089] Where k∈[1, M×N] represents the location where the encryption result is stored in the ciphertext. The encryption process selects images from the plaintext image in a disordered order, and the encryption result is stored in the ciphertext image in order. floor(x) represents the ceiling function.

[0090] After each diffusion, the FLAG flag is recalculated to determine the position of the next scrambling. The initial scrambling position is determined by the control parameters of the chaotic system, and the calculation method is shown in the following formula:

[0091]

[0092] After the scrambling rule S is traversed, the encryption process is completed, and the matrix C is converted into a two-dimensional matrix of size M×N to obtain the encryption result.

[0093] Since the encryption process is implemented using a reversible XOR operation, the encrypted image can be decrypted through the inverse process.

[0094] Specifically, image decryption includes the following steps:

[0095] Input: key KEY = α, x1, y1, ciphertext image C of size M × N;

[0096] Step C1. Obtain encryption rules: Use the scrambling rule S and diffusion rule Y obtained in step B1 of the image encryption process;

[0097] Step C2. Inverse diffusion process: Convert the ciphertext matrix C into a one-dimensional matrix. Since the encrypted pixel values are placed in the encryption matrix C in positive order, the encryption matrix C is traversed in reverse order. During the traversal process, the FLAG flag is first calculated to obtain the position label (S i , S j ), perform reverse XOR on the pixel values to obtain the scrambled pixel values, and then place the pixel values into the intermediate matrix P1 according to the traversal direction indicated by FLAG;

[0098] The method to obtain pixel values is as follows:

[0099]

[0100] Where k represents the subscript of the currently traversed ciphertext matrix C, k = M × N, M × N-1, ..., 1;

[0101] Step C3: Place the pixels after inverse diffusion decryption to the correct position according to the scrambling rules. The inverse scrambling process is as follows:

[0102] P(S i , S j )=P1(i,j)

[0103] Among them, i∈[1,M], j∈[1,N];

[0104] After the traversal is completed, P is the decrypted plaintext image.

[0105] In order to analyze the security and feasibility of the method proposed in the present invention, representative Lena images, Baboon images, X-ray images and text images are selected as test images to simulate the method in the present invention, and the key space, key sensitivity, histogram, correlation between adjacent pixels and differential attacks are analyzed.

[0106] The hardware environment for the experimental simulation is CPU Intel Core i7 2.6GHz, RAM 16GB, operating system is MacOS Monterey, and software environment is MATLAB 2016b.

[0107] (1) Experimental simulation is as follows:

[0108] Figure 4 The encryption and decryption results of the encryption system proposed in this invention for each test image are shown, where the first column is the original test image, the second column is the corresponding encryption result, and the third column is the decryption result of the encrypted image using the decryption method.

[0109] from Figure 4It can be seen that the encryption method of the present invention can encrypt various images that can be recognized by the human eye into encrypted images that are similar to random noise, thereby completely hiding the original image information, and the decryption method can completely restore the encrypted image. The method proposed in the present invention can still destroy its original rules, which shows that the method can resist chosen plaintext attacks. The experimental results show that the method is suitable for encryption and decryption of various images and has high security.

[0110] (2) Key space analysis:

[0111] The present invention uses the SHA-512 algorithm to obtain a 512-bit sequence from the plaintext image and linearly combines it with the initial value to finally generate the initial value and control parameters used by the encryption system. Therefore, its key space is 2 512 ,Based on the computing performance of current computers, it is impossible to crack it using brute force methods.

[0112] (3) Key sensitivity analysis:

[0113] The encryption method of the present invention has three initial parameters, namely the control parameter α and the initial values x1 and y1. In order to test the key sensitivity of the encryption method, the three initial parameters are added with 10 -16 Then it is used to decrypt the encrypted result. The test results using the Lena graph are as follows: Figure 5 shown.

[0114] from Figure 5 It can be seen from the figure that even if the key changes very slightly, it is still impossible to obtain useful information from the ciphertext image using the wrong key, which shows that the method proposed in the present invention is extremely sensitive to the change of the key.

[0115] (4) Histogram analysis:

[0116] One of the reasons why digital images can carry information that can be recognized by the human eye is that the distribution of pixel values in their color channels is clustered; the histogram can intuitively reflect this clustering. Figure 6 The histogram of the test image before and after encryption is shown.

[0117] from Figure 6 It can be seen from the figure that the histograms before encryption are all clustered, and there are regularities in the pixel distribution. However, the pixel distribution of the histogram after encryption is relatively uniform, and no regularities between pixels can be obtained from it. This shows that the method proposed in the present invention can better hide the statistical characteristics of the image and is capable of resisting attacks targeting the statistical characteristics of the image.

[0118] (5) Correlation analysis between adjacent pixels:

[0119] Natural images have extremely high correlation between adjacent pixels. Encryption methods can destroy this correlation through scrambling and diffusion. In order to evaluate the ability of encryption methods to destroy the correlation of adjacent pixels, Figure 7 As shown in the figure, taking the Lena image as an example, 5000 pixels are randomly selected from the image before and after encryption, and the distribution of pixel values is displayed in three directions: horizontally, vertically, and diagonally.

[0120] from Figure 7 It can be seen that the pixel values of the Lena image before encryption are obviously concentrated in all directions, while the pixel values of the encrypted image are distributed uniformly and randomly, indicating that the encryption method of the present invention destroys the correlation between adjacent pixels of the image more thoroughly.

[0121] (6) Differential attack analysis:

[0122] A differential attack is a type of chosen-plaintext attack. The analyst exploits changes in pixel values in a plaintext image to derive the corresponding ciphertext. This allows the analyst to analyze the patterns between the plaintext and ciphertext changes and ultimately identify the encryption key. A secure encryption method must be resistant to differential attacks. Even if only a single pixel in the plaintext image changes, the encrypted image should still appear random.

[0123] Here, the number of pixels change rate (NPCR) and the uniform average changing intensity (UACI) are used to evaluate the difference between the two images after encryption. The comparison images are P1 and P2, both of which are M×N in size and have 256 grayscale levels.

[0124] The calculation methods of pixel change rate NPCR and consistent change intensity UACI are as follows:

[0125]

[0126] For 256-level grayscale images, the theoretical values of pixel change rate NPCR and consistent change intensity UACI are 99.6094% and 33.4635% respectively. When the calculated results reach the theoretical values, it means that the two images being compared can be regarded as two random and completely unrelated images.

[0127] In order to test the ability of the method of the present invention to resist differential attacks, a pixel in the test image is randomly selected, and the pixel value is randomly increased or decreased by 1. The unchanged plaintext and the changed plaintext are encrypted using the method of the present invention respectively. Then, the two indices of the two encrypted images are calculated, and this process is repeated 150 times.

[0128] Table 1 shows the average results of each indicator after calculation. Figure 8 The distribution of results from 150 calculations is shown.

[0129] Table 1. Differential analysis results of test images

[0130] Test image Lena picture Baboon Diagram X-ray images Text Image NPCR (%) 99.6100 99.6079 99.6090 99.6101 UACI (%) 33.4538 33.4871 33.4309 33.4653

[0131] As can be seen from Table 1, the images encrypted by the present invention have good performance in both indicators, and the difference between the average value and the theoretical value is within 0.5%. This shows that even if the plaintext is modified very slightly, the two encrypted images can be regarded as two random unrelated images, and the attacker cannot obtain useful information from the differential attack. Figure 8 It can be seen that in 150 random calculations, the values of the five indicators are all around the theoretical values, indicating that the encryption effect of this method is relatively stable. Experiments show that the method of the present invention can effectively resist differential attacks.

Claims

1. A chaotic image encryption and decryption method dynamically correlated with plaintext pixels, characterized in that: Including key generation, image encryption and image decryption; The key generation includes the following steps: Step A1. Obtaining a hash value: Using the SHA-512 algorithm to calculate a hash value K from the plaintext image to be encrypted. The hash value K is 512 bits long and is a binary string. Step A2. Hash value segmentation: Split the 512-bit hash value K into 8-bits to obtain k1, k2, k3, ..., k 64 There are a total of 64 binary numbers of length 8; Step A3. Calculate intermediate parameters: Perform an XOR operation on the split binary number to calculate four intermediate values h1, h2, h3, and h4. The calculation method is as follows: Step A4. Calculation of control parameters and initial values: Calculate the three parameters α, x1, and y1 required for the variable parameter two-dimensional logistic hyperchaotic system based on the intermediate parameters. The calculation method is shown in the following formula: Among them, mod(x,y) represents the modulus calculation of x to y; The image encryption comprises the following steps: Input: The key KEY = α, x1, y1 generated in step A4, and a plaintext image P of size M × N. Step B1. Obtaining a random array: Input the key KEY into a variable-parameter two-dimensional logistic hyperchaotic system and perform M×N+T iterations, where T is a constant and T=1000. To eliminate transient phenomena that may exist in the chaotic system, remove the first T sequences of the output to obtain two-dimensional random number arrays X and Y of size M×N. Step B2. Based on the rules for dynamic scrambling and diffusion of random arrays, sum the rows and columns of the M×N two-dimensional random array X, sort the sums in descending order, and use the sorted positions as row and column numbers to construct a scrambling rule S consisting of row and column numbers. The diffusion rule is the random number matrix Y; Step B3. Let the encryption result be C, which is a one-dimensional matrix of size M×N. The encryption process is the process of traversing the scrambling rule S. Set the traversal direction flag FLAG; when GLAG = 0, traversal is performed from top to bottom and from left to right. When FLAG = 1, traversal is performed from bottom to top and from right to left. In the process of traversing the scrambling rule S, the position label (S i ,S j ), which represents the row and column numbers of the two-dimensional matrix, and selects pixel values from the plaintext image P according to the row and column numbers P(S i ,S j ), this is the scrambling process; the selected pixel value and the random number Y(S i ,S j ) Diffusion encryption is performed according to the rules shown in the following formula, which is the diffusion process; Where k∈[1,M×N] represents the location where the encryption result is stored in the ciphertext. The encryption process selects images from the plaintext image in a disordered order, and the encryption result is stored in the ciphertext image in order. floor(x) represents the ceiling function. After each diffusion, the flag FLAG is recalculated to determine the next scrambling position. The initial scrambling position is determined by the control parameters of the chaotic system, and the calculation method is shown in the following formula: After the scrambling rule S is traversed, the encryption process is completed, and the matrix C is converted into a two-dimensional matrix of size M×N to obtain the encryption result.

2. The chaotic image encryption and decryption method according to claim 1 is characterized in that: The image decryption comprises the following steps: Input: key KEY = α, x1, y1, ciphertext image C of size M × N; Step C1. Obtain encryption rules: Use the scrambling rule S and diffusion rule Y obtained in step B1 of the image encryption process; Step C2. Inverse diffusion process: convert the ciphertext matrix C into a one-dimensional matrix, traverse the ciphertext matrix C in reverse order, and first calculate the flag FLAG to obtain the position label (S i ,S j ), perform reverse XOR on the pixel values to obtain the scrambled pixel values, and then place the pixel values into the intermediate matrix P1 according to the traversal direction indicated by FLAG; The method to obtain pixel values is as follows: Where k represents the subscript of the currently traversed ciphertext matrix C, k = M×N, M×N-1,…,1; Step C3. The reverse scrambling process is as follows: P(S i ,S j )=P1(i,j) Among them, i∈[1,M], j∈[1,N]; After the traversal is completed, the decrypted plaintext image P is obtained.

Citation Information

Patent Citations

  • Chaotic image encryption and transmission method based on public key system and Hash algorithm

    CN113364573A

  • Single-round image encryption method based on hybrid chaotic mapping

    CN111682932A

  • Novel hyperchaos-based scrambling and plaintext pixel dynamic correlation image encryption method

    CN113470126A