An image encryption method, system, storage medium and computer device

By combining an improved Henon mapping system and a hyperchaotic Lü system for image scrambling and diffusion respectively, the problems of key reuse and insufficient security in existing image encryption are solved, and a highly secure image encryption method is realized.

CN116366776BActive Publication Date: 2026-07-14GUANGDONG SHENGLI MEDICAL TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG SHENGLI MEDICAL TECH CO LTD
Filing Date
2023-02-23
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing classical encryption algorithms are inefficient and have poor security in image encryption. Image encryption of a single chaotic system suffers from problems such as key reuse and insufficient key space.

Method used

An improved Henon mapping system is used for image scrambling, combined with a hyperchaotic Lü system for image diffusion. The R, G, and B layers of the color image are processed separately. By generating chaotic sequences for scrambling and diffusion, the security of image encryption is improved.

Benefits of technology

It effectively avoids the reuse of keys, improves the security of encryption methods, enhances the key parameter space and key sensitivity, and can resist exhaustive attacks and pixel value statistics attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116366776B_ABST
    Figure CN116366776B_ABST
Patent Text Reader

Abstract

The application relates to an image encryption method, system, storage medium and computer equipment, which comprises the following steps: S1, acquiring a color image; S2, converting the color image into a two-dimensional matrix of R, G and B layers; S3, generating a chaotic sequence of an improved Henon mapping system, generating a row scrambling matrix and a column scrambling matrix through the chaotic sequence, completing scrambling of the R, G and B layers of the image, and obtaining a scrambled two-dimensional matrix; S4, generating a chaotic sequence of a hyperchaotic Lue system, generating a diffusion matrix through the chaotic sequence, and performing twice diffusion operation on the scrambled image two-dimensional matrix to obtain a diffused image two-dimensional matrix; and S5, combining the diffused two-dimensional matrix to obtain an encrypted image. The improved Henon mapping system and the hyperchaotic Lue system are respectively used for image scrambling and image diffusion, the problem that a key is repeatedly used is effectively avoided, and the security of the encryption method is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing, computer communication and data security, and in particular to a method, system, storage medium and computer device for image encryption. Background Technology

[0002] With the rapid development of computer and internet communication technologies, image information has become one of the main forms of information exchange, and how to securely and effectively encrypt images has become a research hotspot. Classical encryption algorithms include RSA public-key encryption, Data Encryption Standard (DES), and International Data Encryption (IDEA). However, due to the large data volume and strong correlation between adjacent pixels in images, using classic encryption algorithms generally suffers from low encryption efficiency and poor security. Chaotic systems, due to their high sensitivity to initial conditions and system parameters, nonlinearity and uncertainty, and good pseudo-randomness, are increasingly being applied in the field of image encryption. Chaotic systems can be divided into ordinary chaotic systems and hyperchaotic systems. A hyperchaotic system is defined as a system with four or more dimensions of differential equations and at least two positive Lyapunov exponents. Compared with ordinary chaotic systems, hyperchaotic systems exhibit more complex nonlinear dynamic behavior and have higher application value in the field of image encryption.

[0003] Image encryption algorithms based on chaotic systems mainly consist of two parts: image scrambling and image diffusion. Using a single chaotic system for image scrambling and diffusion suffers from drawbacks such as structural simplicity, key reuse, and insufficient key space. Therefore, this invention provides an image encryption method based on chaotic mapping and hyperchaotic systems. This method uses chaotic mapping and hyperchaotic systems for image scrambling and image diffusion respectively to complete image encryption, effectively overcoming the shortcomings of using a single chaotic system for image encryption. Summary of the Invention

[0004] To address the technical problems existing in the prior art, this invention provides a method, system, storage medium, and computer device for image encryption. By using an improved Henon mapping system and a hyperchaotic Lü system for image scrambling and image diffusion, respectively, the problem of key reuse is effectively avoided, thereby improving the security of the encryption method.

[0005] The method of this invention is implemented using the following technical solution: a method for image encryption.

[0006] S1. Select a color image of size M×N. The color image consists of three parts: R, G, and B. Denote the color image as Image(M,N,3).

[0007] S2. Perform image layering, converting the color image Image(M,N,3) into two-dimensional matrices of R, G, and B layers, denoted as ImageR(M,N), ImageG(M,N), and ImageB(M,N) respectively.

[0008] S3. Perform image scrambling to generate a chaotic sequence of the improved Henon mapping system. Generate row scrambling matrix and column scrambling matrix through the chaotic sequence to complete the scrambling of the R, G, and B layers of the image, and obtain the scrambled two-dimensional matrices ImageRR(M,N), ImageGG(M,N) and ImageBB(M,N).

[0009] S4. Perform image diffusion to generate a chaotic sequence of the hyperchaotic Lü system. Generate a diffusion matrix through the chaotic sequence. Perform two diffusion operations on the scrambled image two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N) to obtain the diffused image two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N).

[0010] S5. Perform image combination: Combine the two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N) of the R, G, and B layers after image scrambling and image diffusion to obtain the encrypted color image ImageS(M,N,3).

[0011] The system of this invention is implemented using the following technical solution: an image encryption system.

[0012] Acquisition module: Used to acquire a color image Image(M,N,3);

[0013] Layered module: used to convert color images into two-dimensional matrices ImageR(M,N), ImageG(M,N), and ImageB(M,N) at the R, G, and B levels;

[0014] The scrambling module is used to generate chaotic sequences of the improved Henon mapping system. It generates row scrambling and column scrambling matrices from the chaotic sequences, completes the scrambling of the R, G, and B layers of the image, and obtains the scrambled two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N).

[0015] The diffusion module is used to generate chaotic sequences of the hyperchaotic Lü system. It generates diffusion matrices from the chaotic sequences and performs two diffusion operations on the scrambled image two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N) to obtain the diffused image two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N).

[0016] The synthesis module is used to combine the two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N) of the R, G, and B layers of the image after image scrambling and image diffusion to obtain the encrypted color image ImageS(M,N,3).

[0017] The present invention also proposes a storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the image encryption method of the present invention are implemented.

[0018] The present invention also proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the image encryption method of the present invention.

[0019] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0020] 1. This invention improves upon the traditional Henon mapping system, effectively overcoming the shortcomings of the traditional Henon mapping system's small and discontinuous chaotic interval, expanding the chaotic interval of the Henon mapping system and making it continuous, thereby increasing the complexity of the Henon mapping system.

[0021] 2. This invention combines an improved Henon mapping system and a hyperchaotic Lü system and applies them to image encryption, giving the image encryption method the characteristics of a large key parameter space, a large number of keys, and high key sensitivity, which can effectively resist brute-force attacks.

[0022] 3. By using the improved Henon mapping system and the hyperchaotic Lü system for image scrambling and image diffusion respectively, this invention effectively avoids the problem of key reuse and improves the security of the encryption method.

[0023] 4. This invention applies plaintext information of the image to the generation process of the encryption key sequence, giving the image encryption method strong plaintext sensitivity and good statistical properties, which can effectively resist pixel value statistical attacks and differential attacks. Attached Figure Description

[0024] Figure 1 This is a flowchart of the method of the present invention;

[0025] Figure 2 (a) is the original Lena image of the image encryption method of the present invention;

[0026] Figure 2 (b) is the Lena image encryption diagram of the image encryption method of the present invention;

[0027] Figure 2 (c) is the Lena image decryption diagram of the image encryption method of the present invention;

[0028] Figure 3 (a) is the original Baboon image of the image encryption method of the present invention;

[0029] Figure 3 (b) is the Baboon image encryption diagram of the image encryption method of the present invention;

[0030] Figure 3 (c) is the Baboon image decryption diagram of the image encryption method of the present invention;

[0031] Figure 4 (a) is the original Peppers image of the image encryption method of the present invention;

[0032] Figure 4 (b) is a Peppers image encryption diagram of the image encryption method of the present invention;

[0033] Figure 4 (c) is a Peppers image decryption diagram of the image encryption method of the present invention;

[0034] Figure 5 (a) is the original experimental image of the Lena image key sensitivity analysis of the present invention;

[0035] Figure 5 (b) is an experimental encryption diagram of the Lena image key sensitivity analysis of the present invention;

[0036] Figure 5 (c) is an experimental error decryption diagram of the Lena image key sensitivity analysis of the present invention;

[0037] Figure 5 (d) is the experimentally correct decryption diagram of the Lena image key sensitivity analysis of the present invention;

[0038] Figure 6 (a) is the grayscale histogram of the R layer of the original Lena image of the present invention;

[0039] Figure 6 (b) is the grayscale histogram of the G layer of the original Lena image of the present invention;

[0040] Figure 6 (c) is the grayscale histogram of layer B of the original Lena image of the present invention;

[0041] Figure 6 (d) is the grayscale histogram of the R layer of the Lena image encryption image according to the present invention;

[0042] Figure 6 (e) is the grayscale histogram of the G layer of the Lena image encryption image of the present invention;

[0043] Figure 6 (f) is the grayscale histogram of layer B of the Lena image encryption image of the present invention;

[0044] Figure 7 (a) is a horizontal correlation distribution diagram of the original image of the Lena image of the present invention, showing the correlation between adjacent pixels.

[0045] Figure 7 (b) is a horizontal correlation distribution map of adjacent pixels in the encrypted image of the Lena image of the present invention;

[0046] Figure 8 (a) is a vertical correlation distribution diagram of the original image of the Lena image of the present invention, showing the correlation between adjacent pixels.

[0047] Figure 8 (b) is a vertical correlation distribution diagram of adjacent pixels in the encrypted image of the Lena image of the present invention;

[0048] Figure 9 (a) is a correlation distribution diagram of adjacent pixels in the diagonal direction of the original image of the Lena image of the present invention;

[0049] Figure 9 (b) is a correlation distribution diagram of adjacent pixels in the diagonal direction of the encrypted image of the Lena image of the present invention;

[0050] Figure 10 This is a schematic diagram of the system modules of the present invention. Detailed Implementation

[0051] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.

[0052] Example

[0053] like Figure 1 As shown in the figure, this embodiment of an image encryption method includes the following steps:

[0054] S1. Select a color image of size M×N. The color image consists of three parts: R, G, and B. Denote the color image as Image(M,N,3).

[0055] S2. Perform image layering, converting the color image Image(M,N,3) into a two-dimensional matrix of R, G, and B layers, denoted as ImageR(M,N), ImageG(M,N), and ImageB(M,N) respectively. Each element in ImageR(M,N), ImageG(M,N), and ImageB(M,N) is the pixel gray value of the image, ranging from 0 to 255.

[0056] S3. Perform image scrambling to generate a chaotic sequence of the improved Henon mapping system. Generate row scrambling matrix and column scrambling matrix through the chaotic sequence to complete the scrambling of the R, G, and B layers of the image, and obtain the scrambled two-dimensional matrices ImageRR(M,N), ImageGG(M,N) and ImageBB(M,N).

[0057] S4. Perform image diffusion to generate a chaotic sequence of the hyperchaotic Lü system. Generate a diffusion matrix through the chaotic sequence. Perform two diffusion operations on the scrambled image two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N) to obtain the diffused image two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N).

[0058] S5. Perform image combination: Combine the two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N) of the R, G, and B layers after image scrambling and image diffusion to obtain the encrypted color image ImageS(M,N,3).

[0059] Specifically, in this embodiment, step S2 further includes the following steps:

[0060] S21. Calculate the average value avgR of the two-dimensional matrix ImageR(M,N) of the R layer of the color image, and adjust avgR according to formula (1) to obtain the adjusted average value avgsR. The specific formula is as follows:

[0061]

[0062] in, This represents the average value, where t is a positive integer. round(·) means rounding to the nearest integer, and mod(·) means modulo operation. In this embodiment, the value of t is 8.

[0063] S22. According to the calculation process in step S21, calculate and adjust the average values ​​of the two-dimensional matrix ImageG(M,N) of image layer G and the two-dimensional matrix ImageB(M,N) of image layer B, respectively, and denot them as avgsG and avgsB.

[0064] Specifically, in this embodiment, the equation model of the improved Henon mapping system in step S3 is as follows:

[0065]

[0066] Where p and q are the system's state variables, and a, b, and c are the system's control parameters; when the system's control parameters are set to a = 1.8, c = 0.2, and b ∈ [1.92, +∞), the system has a positive Lyapunov exponent and is in a chaotic state.

[0067] In this embodiment, the improved Henon mapping system is also called the Henon-S mapping system.

[0068] Specifically, in this embodiment, the process of generating the chaotic sequence of the Henon-S mapping system includes:

[0069] S311. Select initial values ​​p0 and q0 for state variables and control parameters a, b, and c as the operating parameters of the Henon-S mapping system. The Henon-S mapping system generates a chaotic sequence {p} during operation. i} and {q i}, respectively remove the chaotic sequence {p i} and {q i The first l1 transition data;

[0070] S312, Extracting the chaotic sequence {p i The first to the second M elements of} yield a chaotic sequence {pl} of length 2M. i |i=1,2,…,2M};Truncate the chaotic sequence {q i The first to the 2Nth elements of} yield a chaotic sequence of length 2N and {ql}. i |i=1,2,…,2N};Use formula (3) to analyze the chaotic sequence {pl i} and {ql i After preprocessing, an improved chaotic sequence {u} is obtained. i |i=1,2,…,2M} and {v i |i=1,2,…,2N}, Formula (3) is as follows:

[0071]

[0072] Where X represents a chaotic sequence, k is a positive integer, and round(·) represents the operation of taking the nearest integer. In this embodiment, the value of k is 5.

[0073] S313, Take the chaotic sequence {u i The odd-numbered positions of} form a sequence {ul} of length M. i |i=1,2,…,M};Take the chaotic sequence {v i The even-numbered digits form a sequence of length N, {vl} i |i=1,2,…,N};

[0074] S314, For the sequence {ul i} and {vl i Arrange them in ascending order, then rearrange the original sequence {ul}. i} and {vl i The position index of each element in the sequence is arranged according to the corresponding element in the new sequence, resulting in the position index sequence {Dul}. i} and {Dvl i}

[0075] Specifically, the implementation process of step S314 is illustrated below:

[0076] Construct an integer sequence A = [16 2 9 11 8 7 6 15] of length 8. Arrange the sequence A in ascending order to obtain the sequence AT = [2 6 7 8 9 11 15 16]. Arrange the position index of each element in the original sequence A according to the corresponding element in the new sequence AT to obtain the position index sequence AP = [2 7 6 5 3 4 8 1].

[0077] Specifically, in this embodiment, the process of image scrambling in step S3 further includes:

[0078] S321. Construct a zero matrix of size M×M, and assign the corresponding index sequence {Dul} to each row of the matrix. i} Set the column values ​​of the elements to 1 to obtain the row scrambled matrix RMatrix(M,M); construct a zero matrix of size N×N, and set the corresponding index sequence {Dvl} in each column of the matrix. i Setting the row values ​​of each element to 1 results in a column-randomized matrix CMatrix(N,N);

[0079] S322. Scramble the two-dimensional matrix ImageR(M,N) of image layer R to obtain the scrambled two-dimensional matrix ImageRR(M,N), with the following specific expression:

[0080] ImageRR(M,N)=RMatrix(M,M)×ImageR(M,N)×CMatrix(N,N) (4)

[0081] S323. Repeat step S322 to scramble the two-dimensional matrix ImageG(M,N) of image layer G and the two-dimensional matrix ImageB(M,N) of image layer B, respectively, to obtain the scrambled two-dimensional matrix ImageGG(M,N) and ImageBB(M,N).

[0082] Specifically, in this embodiment, the equations of the hyperchaotic Lü system in step S4 are expressed as follows:

[0083]

[0084] Where x, y, z, and w are the state variables of the system, and d, e, f, and g are the control parameters of the system. When the control parameters of the system are set to d = 36, e = 20, f = 3, and g ∈ (0.35, 1.3], the system has two positive Lyapunov exponents and is in a hyperchaotic state.

[0085] Specifically, in this embodiment, step S4 includes two image diffusion operations. The specific process of the first image diffusion is as follows:

[0086] S411. Select initial values ​​of state variables x0, y0, z0, w0 and control parameters d, e, f, g as the operating parameters of the hyperchaotic Lü system. Use the fourth-order Runge-Kutta method to calculate the equations of the hyperchaotic Lü system and run it to generate a chaotic sequence {xa}. i}、{ya i}、{za i}、{wa i}, respectively remove the chaotic sequence {xa i}、{ya i}、{za i}、{wa i The first 12 transition data in};

[0087] S412. Perform a first diffusion on the image R layer and extract the chaotic sequence {xa}. i}、{ya i}、{za i}、{wa i The elements from the avgsRth to the avgsR+Lth (L=M×N)th elements of} yield a chaotic sequence {xal} of length L. i |i=1,2,…,L}、{yal i |i=1,2,…,L}、{zal i |i=1,2,…,L}、{wal i|i=1,2,…,L}, using the above formula (3) to analyze the chaotic sequence {xal i}、{yal i}、{zal i}、{wal i After preprocessing, an improved chaotic sequence {Xal} is obtained. i |i=1,2,…,L}、{Yal i |i=1,2,…,L}、{Zal i |i=1,2,…,L}、{Wal i |i=1,2,…,L};

[0088] S413, Regarding the chaotic sequence {Xal} i}、{Yal i}、{Zal i}、{Wal i The normalization process is performed using the following formula:

[0089]

[0090] Where X represents a chaotic sequence, X i The elements of the chaotic sequence are represented by max(·), where max(·) represents the maximum value and min(·) represents the minimum value.

[0091] Then, using formula (7), it is mapped to the interval [0, 255], and converted into a chaotic sequence {XU} in uint8 format. i |i=1,2,…,L}、{YU i |i=1,2,…,L}、{ZU i |i=1,2,…,L}、{WU i |i=1,2,…,L}, Formula (7) is as follows:

[0092] X i =int(X i ×255)1≤i≤L (7)

[0093] Among them, X i This represents the element value of the chaotic sequence; int(·) indicates integer operation.

[0094] S414, The chaotic sequence {XU i}、{YU i}、{ZU i}、{WU i The sequences XU(M,N), YU(M,N), ZU(M,N), and WU(M,N) are arranged into an M×N two-dimensional chaotic sequence matrix.

[0095] S415. For each element in the two-dimensional matrix ImageRR(M,N) obtained after scrambling the original image R layer, the index value Index1 (Index1∈[0,3]) is obtained through formula (8). The specific formula (8) is as follows:

[0096] Index1=mod(i+j,4)1≤i≤M,1≤j≤N (8)

[0097] Where mod(·) represents the modulo operation, and i and j represent the coordinates of the two-dimensional matrix;

[0098] Each element in the two-dimensional matrix ImageRR(M,N) is XORed with the corresponding chaotic sequence matrices XU(M,N), YU(M,N), ZU(M,N), and WU(M,N) according to the index value Index1, according to formula (9), to complete the first diffusion of the image R layer and obtain the two-dimensional image matrix ImageRT(M,N);

[0099]

[0100] Where ⊕ represents the XOR operation, i and j represent the coordinates of the two-dimensional matrix, and img(·) represents the element value of the two-dimensional matrix;

[0101] S416. Repeat steps S412-S415 to complete the first diffusion of the image G layer and B layer respectively, and obtain the two-dimensional image matrices ImageGT(M,N) and ImageBT(M,N).

[0102] Specifically, in this embodiment, the second image diffusion process in step S4 is as follows:

[0103] S421. Select appropriate initial values ​​x1, y1, z1, w1 and control parameters d, e, f, g as the operating parameters of the hyperchaotic Lü system. Use the fourth-order Runge-Kutta method to calculate the equations of the hyperchaotic Lü system and run it to generate a chaotic sequence {xb}. i}、{yb i}、{zb i}、{wb i}, respectively remove the chaotic sequence {xb i}、{yb i}、{zb i}、{wb i The first 12 transition data in};

[0104] S422. Perform a second diffusion on the image R layer and extract the chaotic sequence {xb}. i}、{yb i}、{zb i}、{wb iThe elements from the avgsRth to the avgsR+Lth (L=M×N)th elements of} yield a chaotic sequence {xb} of length L. i |i=1,2,…,L}、{yb i |i=1,2,…,L}、{zb i |i=1,2,…,L}、{wb i |i=1,2,…,L}, using the above formula (3) for the chaotic sequence {xb i}、{yb i}、{zb i}、{wb i After preprocessing, an improved chaotic sequence {Xbl} is obtained. i |i=1,2,…,L}、{Ybl i |i=1,2,…,L}、{Zbl i |i=1,2,…,L}、{Wbl i |i=1,2,…,L};

[0105] S423. Using the above formula (6) to process the chaotic sequence {Xbl i}、{Ybl i}、{Zbl i}、{Wbl i After normalization, the sequence is mapped to the interval [0, 255] using the formula (7) above, and then converted into a chaotic sequence {XV} in uint8 format. i |i=1,2,…,L}、{YV i |i=1,2,…,L}、{ZV i |i=1,2,…,L}、{WV i |i=1,2,…,L};

[0106] S424, The chaotic sequence {XV i}、{YV i}、{ZV i}、{WV i The sequences XV(M,N), YV(M,N), ZV(M,N), and WV(M,N) are arranged into an M×N two-dimensional chaotic sequence matrix.

[0107] S425. For each element in the two-dimensional matrix ImageRT(M,N) obtained after scrambling and first diffusion of the original image R layer, the index value Index2 (Index2∈[0,3]) is obtained through formula (10). Each element in the two-dimensional matrix ImageRT(M,N) is XORed with the corresponding chaotic sequence matrices XV(M,N), YV(M,N), ZV(M,N), and WV(M,N) according to formula (11) based on the index value Index2, to complete the second diffusion of the image R layer and obtain the two-dimensional matrix ImageRS(M,N) of the image R layer. The specific formulas (10) and (11) are as follows:

[0108] Index2=mod(img(i,j),4)1≤i≤M,1≤j≤N(10)

[0109] Where mod(·) represents the modulo operation, i and j represent the coordinates of the two-dimensional matrix, and img(·) represents the element value in the two-dimensional matrix;

[0110]

[0111] Where ⊕ represents the XOR operation, i and j represent the coordinates of the two-dimensional matrix, and img(·) represents the element value of the two-dimensional matrix;

[0112] S426. Repeat steps S422-S425 to complete the second diffusion of image layers G and B respectively, and obtain the two-dimensional matrices ImageGS(M,N) and ImageBS(M,N) of image layers G and B respectively.

[0113] To verify the effectiveness of the image encryption method proposed in this invention, this embodiment provides experimental data and analysis of experimental results.

[0114] Three color images—Lena, Baboon, and Peppers—were selected as experimental images, each with a size of 512×512×3. Control parameters a = 1.8, b = 6.95, c = 0.2, and initial state variables p0 = 0.2 and q0 = 0.1 were chosen as the operating parameters of the Henon-S mapping system and the key for image scrambling (hereinafter referred to as key a). Control parameters d = 36, e = 20, f = 3, g = 0.8, and initial state variables x0 = 1.5, y0 = 1.0, z0 = 0.6, w0 = 1.8 and x1 = 0.8, y1 = 0.5, z1 = 1, w1 = 1.5 were chosen as the operating parameters of the hyperchaotic Lü system and the key for image diffusion (hereinafter referred to as key b). Key a and key b together constitute key 1. The Henon-S mapping system and the hyperchaotic Lü system were run, and the image encryption was completed according to the steps of this embodiment. Image decryption is the inverse process of image encryption; therefore, the same key was used to decrypt the encrypted image to complete the image decryption. The experimental results of image encryption and decryption are as follows: Figures 2-4 As shown, Figure 2 (a) Figure 3 (a) Figure 4 (a) is the original color image; Figure 2 (b) Figure 3 (b) Figure 4 (b) is the encrypted image; such as Figure 2 (c) Figure 3 (c) Figure 4 (c) is the decrypted image.

[0115] This embodiment analyzes experimental results from aspects such as key sensitivity, key space, histogram statistics, pixel correlation, information entropy, and plaintext sensitivity, as detailed below:

[0116] 1. Key sensitivity analysis

[0117] The Lena image was selected as the test image for key sensitivity analysis. First, the Lena image was encrypted using key 1. Then, one parameter of key b was slightly modified, and x0 = 1.5, y0 = 1.0, z0 = 0.6, w0 = 1.8 and x1 = 0.8, y1 = 0.5, z1 = 1.000000000000001, w1 = 1.5 were selected as key b-1. Key a and key b-1 together constitute key 2. The encrypted image was then decrypted using key 1 and key 2 respectively. The experimental test results are as follows: Figure 5 (a)~ Figure 5 As shown in (d). Figure 5 (a) is the original image of Lena; Figure 5 (b) is the image encrypted using key 1; Figure 5 (c) is the image after decryption using key 2; Figure 5 (d) shows the image decrypted using key 1. Test results indicate that image decryption only succeeds when the decryption key and encryption key are identical; otherwise, the original image cannot be decrypted. -15 Even slight alterations can prevent the correct decryption of the original image. Therefore, the image encryption method provided by this invention is highly sensitive to the key.

[0118] 2. Key Space Analysis

[0119] The Henon-S mapping system has two initial values ​​and one control parameter, while the hyperchaotic Lü system has one control parameter and eight initial values ​​that can be used as keys. Since the key is for 10... -15 It is highly sensitive to minute changes; therefore, the calculation precision can be set to 10. -15 Calculations show that the theoretical key space of this method is 10. 180 The key space is much larger than 2 100 The image encryption method provided by this invention has a very large key space, which can effectively resist brute-force attacks.

[0120] 3. Histogram statistical analysis

[0121] An image histogram represents the frequency of occurrence of pixels at each gray level in an image. The horizontal axis of the histogram represents the gray level, and the vertical axis represents the frequency of occurrence of each gray level. Histogram features can effectively reflect the distribution of gray-level pixels in an image. The Lena image was selected as the test image for histogram statistical analysis. Figure 6 (a) Figure 6 (b) Figure 6 (c) is the grayscale histogram of the R, G, and B layers of the original image. Figure 6 (d) Figure 6 (e) Figure 6 (f) shows the grayscale histograms of the R, G, and B layers of the encrypted image. Figure 6 (a)~ Figure 6 (f) It can be seen that the gray-level pixels in the R, G, and B layers of the original image exhibit a concentrated distribution, while the gray-level pixels in the R, G, and B layers of the encrypted image exhibit a uniform distribution. Therefore, the encrypted image can effectively hide the distribution characteristics of the gray-level pixels in the original image, making it difficult to decrypt and recover the original image using gray-level pixel statistical analysis. Therefore, the image encryption method proposed in this invention can effectively resist attacks based on gray-level pixel statistics.

[0122] 4. Pixel Correlation Analysis

[0123] Adjacent pixels in an arbitrary image are highly correlated. After encryption, adjacent pixels should be uncorrelated, and the correlation coefficient between adjacent pixels in the encrypted image should be close to 0. The correlation coefficient is calculated using formulas (12) to (14), specifically as follows:

[0124]

[0125]

[0126]

[0127] Where x and y are the values ​​of adjacent pixels in the image, E(·) is the expected value, and D(·) is the variance.

[0128] Tables 1-1 to 1-3 below list the correlation coefficients of the Lena image in the horizontal, vertical, and diagonal directions of the R, G, and B layers before and after encryption using this method, and compare the results with those of method [1,2]. From the data in Tables 1-1 to 1-3, it can be seen that the correlation coefficients of adjacent pixels in the R, G, and B layers of the original image are close to 1 in the horizontal, vertical, and diagonal directions, indicating a strong correlation; the correlation coefficients of adjacent pixels in the R, G, and B layers of the encrypted image are close to 0 in these directions, indicating almost no correlation; compared with method [1,2], the overall correlation of adjacent pixels in the encrypted image obtained by this method is smaller. Specifically, Tables 1-1 to 1-3 are shown below:

[0129] Table 1-1 Correlation coefficients and comparisons of adjacent pixels in the R layer of Lena's images.

[0130]

[0131] Table 1-2 Correlation coefficients and comparisons of adjacent pixels in the G layer of Lena images.

[0132]

[0133] Table 1-3 Correlation coefficients and comparisons of adjacent pixels in Layer B of Lena images

[0134]

[0135]

[0136] Among them, the method [1] refers to: Yao Lisha, Zhu Zhenyuan, Cheng Jiaxing. Encryption of color images of DNA sequence and fractional-order Chen hyperchaotic system [J]. Progress in Laser & Optoelectronics, 2016, 53(9):92-101.

[0137] Method [2] refers to: XiuliChai, XianglongFu, ZhihuaGan, YangLu, YiranChen.A colorimage cryptosystem based on dynamic DNA encryptio and chaos[J].SignalProcessing, 2019, 155:44-62.

[0138] Table 2 below lists the correlation coefficients of the original images of Lena, Baboon, and Peppers and their respective encrypted images at the R, G, and B layers. As can be seen from the data in Table 2, the correlation between the original images and the encrypted images is very small. Specifically, Table 2 is shown below:

[0139] Table 2. Correlation coefficients between the original image and the encrypted image.

[0140]

[0141] In the R layer of the original Lena image and the encrypted image, the correlation of the middle 2500 neighboring pixels in the horizontal, vertical, and diagonal directions is compared as follows: Figure 7 (a) Figure 7 (b) Figure 8 (a) Figure 8 (b) Figure 9 (a) Figure 9 As shown in (b). From Figure 7 (a) Figure 7 (b) Figure 8 (a) Figure 8 (b) Figure 9 (a) Figure 9 (b) It can be seen that the adjacent pixels in the original image exhibit a clear linear aggregation distribution, while the adjacent pixels in the encrypted image exhibit a random scatter distribution.

[0142] 5. Information Entropy Analysis

[0143] Information entropy is mainly used to measure the degree of randomness of information. Therefore, it can be used to represent the randomness of image information. Its calculation method is shown in Equation (15):

[0144]

[0145] Where m represents the information source, and P(·) represents the probability of the information source appearing. For an image, m has 256 states, with a minimum value of 0 and a maximum value of 255. The information entropy value of an ideal random image is equal to 8. Table 3 lists the information entropy values ​​of Lena, Baboon, and Peppers images before and after encryption. As can be seen from the data in Table 3, the information entropy values ​​of the encrypted images are all very close to 8, indicating that the randomness of the encrypted images is very good. Specifically, Table 3 is shown below:

[0146] Table 3 Information Entropy of Original Image and Encrypted Image

[0147]

[0148]

[0149] 6. Plaintext Sensitivity Analysis

[0150] Plaintext sensitivity refers to the degree of change in an encrypted image when a small change occurs in the plaintext image. The greater the degree of change in the encrypted image, the higher the plaintext sensitivity of the image encryption method, and the stronger its resistance to differential attacks. Pixel change rate (NPCR) and normalized average change intensity of pixel values ​​(UACI) are commonly used to quantitatively measure the sensitivity of an image encryption method to plaintext images. The definitions of NPCR and UACI are shown in formulas (16) and (17).

[0151]

[0152]

[0153]

[0154] Where M and N represent the length and width of the image, respectively, and P1(i,j) and P2(i,j) represent the pixel values ​​of the corresponding encrypted images before and after the plaintext image is changed. For a 256-level image, when the NPCR value is greater than 99% and the UACI value is greater than 33%, the image encryption method has high sensitivity to plaintext images and strong resistance to differential attacks.

[0155] The pixel values ​​at position (1,1) of the original images of Lena, Baboon, and Peppers are changed to obtain new plaintext images Lena1, Baboon1, and Peppers1. The same key is used to encrypt the three plaintext images (Lena and Lena1, Baboon and Baboon1, Peppers and Peppers1) to form three sets of encrypted images. The NPCR and UACI values ​​of the R, G, and B layers of the three encrypted images are calculated using equations (16)-(18), and the results are shown in Table 4. From the data in Table 4, it can be seen that the NPCR values ​​of the R, G, and B layers are all greater than 99%, and the UACI values ​​are all greater than 33%, indicating that even with slight changes to the original images, the encrypted images obtained using this method show a significant improvement.

[0156] Therefore, the image encryption method proposed in this invention has high sensitivity to plaintext images and strong resistance to differential attacks. Specifically, Table 4 is shown below:

[0157] Table 4. NPCR and UACI values ​​of encrypted images with different combinations.

[0158]

[0159] Based on the same inventive concept, such as Figure 10 As shown, the present invention also proposes an image encryption system, comprising:

[0160] Acquisition module: Used to acquire a color image Image(M,N,3);

[0161] Layered module: used to convert color images into two-dimensional matrices ImageR(M,N), ImageG(M,N), and ImageB(M,N) at the R, G, and B levels;

[0162] The scrambling module is used to generate chaotic sequences of the improved Henon mapping system. It generates row scrambling and column scrambling matrices from the chaotic sequences, completes the scrambling of the R, G, and B layers of the image, and obtains the scrambled two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N).

[0163] The diffusion module is used to generate chaotic sequences of the hyperchaotic Lü system. It generates diffusion matrices from the chaotic sequences and performs two diffusion operations on the scrambled image two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N) to obtain the diffused image two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N).

[0164] The synthesis module is used to combine the two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N) of the R, G, and B layers of the image after image scrambling and image diffusion to obtain the encrypted color image ImageS(M,N,3).

[0165] Furthermore, the present invention also proposes a storage medium and a computer device. The storage medium stores a computer program, which, when executed by a processor, implements steps S1-S6 of the image encryption method of the present invention. The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the image encryption method of the present invention, i.e., the process including the aforementioned steps S1-S6.

[0166] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.

Claims

1. A method for image encryption, characterized in that, Includes the following steps: S1. Select a color image of size M×N. The color image consists of three parts: R, G, and B. Denote the color image as Image(M,N,3). S2. Perform image layering, converting the color image Image(M,N,3) into two-dimensional matrices of R, G, and B layers, denoted as ImageR(M,N), ImageG(M,N), and ImageB(M,N) respectively. S3. Perform image scrambling to generate a chaotic sequence of the improved Henon mapping system. Generate row scrambling matrix and column scrambling matrix through the chaotic sequence to complete the scrambling of the R, G, and B layers of the image, and obtain the scrambled two-dimensional matrices ImageRR(M,N), ImageGG(M,N) and ImageBB(M,N). S4. Perform image diffusion to generate a chaotic sequence of the hyperchaotic Lü system. Generate a diffusion matrix through the chaotic sequence. Perform two diffusion operations on the scrambled image two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N) to obtain the diffused image two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N). S5. Perform image combination: Combine the two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N) of the R, G, and B layers of the image after image scrambling and image diffusion to obtain the encrypted color image ImageS(M,N,3). The specific process of step S2 also includes: S21. Calculate the average value avgR of the two-dimensional matrix ImageR(M,N) of the R layer of the color image, and adjust avgR according to formula (1) to obtain the adjusted average value avgsR. The specific formula is as follows: in, This represents the average value, where t is a positive integer. round(·) means rounding to the nearest integer, and mod(·) means modulo operation. S22. According to the calculation process in step S21, calculate and adjust the average values ​​of the two-dimensional matrix ImageG(M,N) of image layer G and the two-dimensional matrix ImageB(M,N) of image layer B respectively, and denot them as avgsG and avgsB respectively. Step S4 includes two image diffusion operations. The specific process of the first image diffusion is as follows: S411. Select initial values ​​for state variables. , , , Using control parameters d, e, f, and g as the operating parameters of the hyperchaotic Lü system, the equations of the hyperchaotic Lü system are calculated using the fourth-order Runge-Kutta method, and the system is run to generate chaotic sequences. }、{ }、{ }、{ }, respectively remove the chaotic sequence { }、{ }、{ }、{ The front of} One transitional data; S412. Perform a first diffusion on the image R layer and extract the chaotic sequence { }、{ }、{ }、{ The elements from the avgsRth to the avgsR+Lth (L=M×N)th elements of} yield a chaotic sequence of length L. }、{ }、{ }、{ }, using formula For chaotic sequences { }、{ }、{ }、{ Preprocessing is performed to obtain an improved chaotic sequence. }、{ }、{ }、{ }; S413, Regarding chaotic sequences { }、{ }、{ }、{ The normalization process is performed using the following formula: Where X represents a chaotic sequence, The elements of the chaotic sequence are represented by max(·), where max(·) represents the maximum value and min(·) represents the minimum value. Then, using formula (7), it is mapped to the interval [0, 255], and converted into a chaotic sequence in uint8 format { }、{ }、{ }、{ Formula (7) is as follows: in, This represents the element value of the chaotic sequence; int(·) indicates integer operation. S414, The chaotic sequence { }、{ }、{ }、{ The sequences XU(M,N), YU(M,N), ZU(M,N), and WU(M,N) are arranged into an M×N two-dimensional chaotic sequence matrix. S415. For each element in the two-dimensional matrix ImageRR(M,N) obtained after scrambling the original image R layer, the index value Index1 is obtained through formula (8). [0,3]), Formula (8) is as follows: Where mod(·) represents the modulo operation, and i and j represent the coordinates of the two-dimensional matrix; Each element in the two-dimensional matrix ImageRR(M,N) is XORed with the corresponding chaotic sequence matrices XU(M,N), YU(M,N), ZU(M,N), and WU(M,N) according to the index value Index1, according to formula (9), to complete the first diffusion of the image R layer and obtain the two-dimensional image matrix ImageRT(M,N); in, This represents an XOR operation, where i and j represent the coordinates of the two-dimensional matrix, and img(·) represents the element value of the two-dimensional matrix. S416. Repeat steps S412-S415 to complete the first diffusion of the image G layer and B layer respectively, and obtain the two-dimensional image matrices ImageGT(M,N) and ImageBT(M,N).

2. The image encryption method according to claim 1, characterized in that, The equation model of the improved Henon mapping system in step S3 is shown below: Where p and q are the system's state variables, and a, b, and c are the system's control parameters; The specific process of generating chaotic sequences for the improved Henon mapping system includes: S311. Select initial values ​​for state variables. , The control parameters a, b, and c are used as the operating parameters of the improved Henon mapping system. The operation of the improved Henon mapping system generates chaotic sequences. }and{ }, respectively remove the chaotic sequence { }and{ } before One transitional data; S312, Extracting chaotic sequences { The first to the second M elements of} yield a chaotic sequence of length 2M. }; Extracting chaotic sequences { The first to the 2Nth elements of} yield a chaotic sequence of length 2N. }; Using formula (3) to analyze the chaotic sequence { }and{ Preprocessing is performed to obtain an improved chaotic sequence. }and{ Formula (3) is as follows: Where X represents a chaotic sequence, k is a positive integer, and round(·) represents the operation of taking the nearest integer; S313, Take the chaotic sequence { The odd-numbered positions of} form a sequence of length M. }; Take the chaotic sequence { A sequence of length N is formed by even-numbered digits. }; S314, for the sequence { }and{ Arrange the sequences in ascending order, then rearrange the original sequence { }and{ The position index of each element in the sequence { is arranged according to the corresponding element in the new sequence, resulting in the position index sequence { }and{ } 3. The image encryption method according to claim 1, characterized in that, The specific process of image scrambling in step S3 also includes: S321. Construct a zero matrix of size M×M, and assign the corresponding index sequence to each row of the matrix { } Set the column values ​​of each element to 1 to obtain the row scrambled matrix RMatrix(M,M); construct a zero matrix of size N×N, and set the corresponding index sequence in each column of the matrix { Setting the row values ​​of each element to 1 results in a column-randomized matrix CMatrix(N,N); S322. The two-dimensional matrix ImageR(M,N) of the image R layer is scrambled using formula (4) to obtain the scrambled two-dimensional matrix ImageRR(M,N). The specific expression is as follows: S323. Repeat step S322 to scramble the two-dimensional matrix ImageG(M,N) of image layer G and the two-dimensional matrix ImageB(M,N) of image layer B, respectively, to obtain the scrambled two-dimensional matrix ImageGG(M,N) and ImageBB(M,N).

4. The image encryption method according to claim 1, characterized in that, The equations for the hyperchaotic Lü system in step S4 are expressed as follows: Where x, y, z, and w are the system's state variables, and d, e, f, and g are the system's control parameters.

5. The image encryption method according to claim 1, characterized in that, The specific process of the second image diffusion in step S4 is as follows: S421. Select initial value , , , Using control parameters d, e, f, and g as the operating parameters of the hyperchaotic Lü system, the equations of the hyperchaotic Lü system are calculated using the fourth-order Runge-Kutta method, and the system is run to generate chaotic sequences. }、{ }、{ }、{ }, respectively remove the chaotic sequence { }、{ }、{ }、{ The front of} One transitional data; S422. Perform a second diffusion on the image R layer to extract the chaotic sequence. }、{ }、{ }、{ The elements from the avgsRth to the avgsR+Lth (L=M×N)th elements of} yield a chaotic sequence of length L. }、{ }、{ }、{ }, using formula For chaotic sequences { }、{ }、{ }、{ Preprocessing is performed to obtain an improved chaotic sequence. }、{ }、{ }、{ }; S423. Using the above formula (6) to process the chaotic sequence { }、{ }、{ }、{ The sequence is normalized and then mapped to the interval [0, 255] using the formula (7) above, thus converting it into a chaotic sequence in uint8 format. }、{ }、{ }、{ }; S424, The chaotic sequence { }、{ }、{ }、{ The sequences XV(M,N), YV(M,N), ZV(M,N), and WV(M,N) are arranged into an M×N two-dimensional chaotic sequence matrix. S425. The index value Index2 of each element in the two-dimensional matrix ImageRT(M,N) obtained by scrambling and first diffusion of the original image R layer is obtained by formula (10). [0,3]); Each element in the two-dimensional matrix ImageRT(M,N) is XORed with the corresponding chaotic sequence matrices XV(M,N), YV(M,N), ZV(M,N), and WV(M,N) according to the index value Index2, according to formula (11), to complete the second diffusion of the image R layer and obtain the two-dimensional matrix ImageRS(M,N) of the image R layer; Formulas (10) and (11) are as follows: Where mod(·) represents the modulo operation, i and j represent the coordinates of the two-dimensional matrix, and img(·) represents the element value in the two-dimensional matrix; in, This represents an XOR operation, where i and j represent the coordinates of the two-dimensional matrix, and img(·) represents the element value of the two-dimensional matrix. S426. Repeat steps S422-S425 to complete the second diffusion of image layer G and layer B respectively, and obtain the two-dimensional matrices ImageGS(M,N) and ImageBS(M,N) of image layer G and layer B.

6. A system for image encryption, implementing the image encryption method of claim 1, characterized in that, include: Acquisition module: Used to acquire a color image Image(M,N,3); Layered module: Used to convert color images into two-dimensional matrices ImageR(M,N), ImageG(M,N), and ImageB(M,N) at the R, G, and B levels; The scrambling module is used to generate chaotic sequences of the improved Henon mapping system. It generates row scrambling and column scrambling matrices from the chaotic sequences, completes the scrambling of the R, G, and B layers of the image, and obtains the scrambled two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N). The diffusion module is used to generate chaotic sequences of the hyperchaotic Lü system. It generates diffusion matrices from the chaotic sequences and performs two diffusion operations on the scrambled image two-dimensional matrices ImageRR(M,N), ImageGG(M,N), and ImageBB(M,N) to obtain the diffused image two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N). The synthesis module is used to combine the two-dimensional matrices ImageRS(M,N), ImageGS(M,N), and ImageBS(M,N) of the R, G, and B layers of the image after image scrambling and image diffusion to obtain the encrypted color image ImageS(M,N,3).

7. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the image encryption method according to any one of claims 1-5.

8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the image encryption method according to any one of claims 1-5.