Image encryption method and device and computer equipment

The image encryption method of integer operation through the two-stage butterfly module and the equivalent key generated by the chaotic pseudo-random number generator solves the problems of poor real-time and weak system sensitivity in the prior art, and realizes efficient image information protection.

CN120378653APending Publication Date: 2025-07-25JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410236411.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-01
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing chaotic system image encryption algorithm has poor real-time performance and weak system sensitivity in floating-point operation mode, so it cannot effectively protect image information security.

Method used

The two-stage butterfly module is used for scrambling processing, combined with the chaotic pseudo-random number generator to generate the first and second equivalent keys, and image encryption is performed through integer operations. The multiple scrambling processing of the butterfly module and the addition and modulus operation of the key are used to achieve rapid disruption and encryption of image information.

Benefits of technology

It improves the encryption computing efficiency, reduces the time complexity, enhances the security and diffusion effect of image information, and can more effectively protect the security of image information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120378653A_ABST
    Figure CN120378653A_ABST
Patent Text Reader

Abstract

The invention provides an image encryption method and device and computer equipment. The method comprises the following steps: converting a plaintext image into a one-dimensional vector and dividing the one-dimensional vector into a plurality of groups of sequences; inputting each group into a two-stage butterfly module to obtain a plurality of groups of first output sequences, merging the first output sequences into a sequence, turning over to obtain a second output sequence, dividing the second output sequence into a plurality of groups of subsequences, inputting each group into a butterfly module to obtain a plurality of groups of third output sequences, merging and converting the third output sequences into a final sequence with the same dimension as a plaintext image, and outputting the final sequence to a display module. The image is an encrypted ciphertext image; the two-stage butterfly module is used for converting each group of input sequences into first intermediate sequences through scrambling processing of two equivalent keys, adding corresponding elements of each group of first intermediate sequences and corresponding elements of the first intermediate sequences of the previous group according to a grouping sequence to obtain moduli, scrambling the moduli through the two equivalent keys, and outputting the moduli after scrambling the moduli through the two equivalent keys. According to the scheme, the problems that an image encryption algorithm of an existing chaotic system is poor in real-time performance and weak in system sensitivity in a floating-point number operation mode are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image information security, and particularly relates to an image encryption method, device and computer equipment. Background Art

[0002] The biggest challenge brought by the popularization of high-speed communication is the information security problem. The digitization and networking of people's personal information and property make information security closely related to people's happiness index. Among them, the information security problem of multimedia information such as images is particularly prominent. How to effectively protect people's image information security has become a research hotspot in network information security.

[0003] Image encryption requires a large amount of pseudo-random number resources. A chaotic system with a large Lyanpunov exponent is often used as a pseudo-random number generator, and the initial value or parameter of the chaotic system is used as the key of the image encryption system. Image encryption must include a non-linear module to achieve a high-security transformation of image information. The scrambling box S-Box is the most commonly used non-linear module. In order to achieve fast encryption, the non-linear transformation of image information is generally realized by means of the lookup algorithm of the S-Box.

[0004] Due to the characteristics of large data volume and large amount of redundant information in images, traditional text encryption methods, such as DES, AES, and SM4, are no longer applicable to image encryption applications. These text encryption algorithms have disadvantages such as texture information leakage and slow encryption speed when encrypting image information. Some existing image encryption algorithms based on chaotic systems have disadvantages such as poor real-time performance and weak system sensitivity during the encryption process, accompanied by the iteration of the chaotic system, and the scheme works in the floating-point operation mode. Summary of the Invention

[0005] In order to solve the problems of poor real-time performance and weak system sensitivity of the existing image encryption algorithm of the chaotic system in the floating-point operation mode, the present invention provides an image encryption method, device and computer equipment.

[0006] In order to achieve the above object, the present invention provides the following technical solutions:

[0007] An image encryption method, comprising the following steps:

[0008] Using a chaotic pseudo-random number generator to convert an external key into a first equivalent key and a second equivalent key;

[0009] Converting a plaintext image into a one-dimensional vector, and dividing the one-dimensional vector into multiple groups of sequences; inputting each group of sequences as an input sequence into a two-stage butterfly module, and obtaining multiple groups of first output sequences after scrambling processing;

[0010] After merging all the first output sequences into one sequence, perform a flipping process to obtain a second output sequence;

[0011] Divide the second output sequence into multiple groups of subsequences, and use each group of subsequences as an input sequence to input into a two-level butterfly module. After scrambling processing, multiple groups of third output sequences are obtained;

[0012] After merging all the third output sequences into one final sequence, then convert the final sequence into a matrix with the same dimension as the plaintext image, and this matrix is the encrypted ciphertext image;

[0013] The scrambling processing steps of the two-level butterfly module include:

[0014] Perform scrambling processing based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences;

[0015] According to the grouping order, add the corresponding elements of the first intermediate sequence of each group and the first intermediate sequence of the previous group and take the modulus, and then perform scrambling processing based on the first equivalent key and the second equivalent key as the output.

[0016] Further, the specific steps of performing scrambling processing based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences include:

[0017] Divide two adjacent elements in each group of sequences into a group. After each group of elements passes through a connection matrix transformation, two first scrambling values are obtained. The connection matrix is composed of the elements in the first equivalent key and the second equivalent key after being scrambled by a scrambling box;

[0018] Randomly group two of all the first scrambling values into a group; after each group of first scrambling values passes through a connection matrix transformation, two second scrambling values are obtained;

[0019] After each second scrambling value passes through cyclic shift and scrambling box scrambling processing respectively, the corresponding third scrambling value is obtained;

[0020] Randomly group two of all the third scrambling values into a group. After each group of third scrambling values passes through a connection matrix transformation, two fourth scrambling values are obtained;

[0021] Randomly group two of all the fourth scrambling values into a group. After each group of fourth scrambling values passes through a connection matrix transformation respectively, the first output sequence is obtained.

[0022] Further, the connection matrix is:

[0023]

[0024] Among them, is the connection matrix of the k-th group, is the value within the first equivalent key, is the value within the second equivalent key, and respectively represent the values obtained by querying MSbox1 and querying MSbox2. MSbox1, MSbox2, MSbox3, and MSbox4 are scrambling boxes, and the values are in the integer interval [1, 255].

[0025] Furthermore, the relational formula for the cyclic shift and the scrambling box scrambling process is:

[0026]

[0027] where "<<<" represents a cyclic left shift, Sbox1, Sbox2, Sbox3, and Sbox4 are scrambling boxes, out2 is the second scrambled value, and in4 is the third scrambled value.

[0028] Furthermore, the steps of generating the first equivalent key and the second equivalent key from the external key using a chaotic pseudorandom number generator include:

[0029] Dividing the external key into multiple groups of first sub-keys according to a set length;

[0030] After scrambling all the first sub-keys, multiple groups of second sub-keys are obtained;

[0031] After subjecting all the second sub-keys to multiple cyclic iteration processes using a chaotic pseudorandom number generator composed of a piecewise linear chaotic map and a cat map, two third sub-keys are obtained;

[0032] After subjecting the two third sub-keys to a pseudorandom function process respectively, the first equivalent key and the second equivalent key are obtained.

[0033] Furthermore, the pseudorandom function formula is:

[0034] u n = floor(x n × 10 10 ) mod 255 + 1

[0035] v n = floor(y n × 10 10 ) mod 255 + 1

[0036] where x n and y n are the two third sub-keys, floor represents the floor function, and mod represents the modulo operation.

[0037] Further, the relevant formula of the chaotic pseudo-random number generator is as follows:

[0038]

[0039]

[0040]

[0041] Among them, w9, w 10 , w 11 and w 12 are the second sub-keys, p is the control parameter of this mapping, mod represents the modulo operation, and max represents the maximum value operation.

[0042] Further, the scrambling box is recreated based on the method of generating the S-box in the AES algorithm.

[0043] An image encryption device includes:

[0044] A key conversion module, configured to use a chaotic pseudo-random number generator to convert an external key into a first equivalent key and a second equivalent key;

[0045] A first scrambling module, configured to convert a plaintext image into a one-dimensional vector, divide the one-dimensional vector into multiple groups of sequences, input each group of sequences as an input sequence into a two-stage butterfly module, and obtain multiple groups of first output sequences after scrambling processing;

[0046] A second scrambling module, configured to merge all the first output sequences into one sequence and then perform a flipping process to obtain a second output sequence;

[0047] A third scrambling module, configured to divide the second output sequence into multiple groups of subsequences, input each group of subsequences as an input sequence into a two-stage butterfly module, and obtain multiple groups of third output sequences after scrambling processing;

[0048] An encryption module, configured to merge all the third output sequences into a final sequence, and then convert the final sequence into a matrix with the same dimension as the plaintext image, and the matrix is the encrypted ciphertext image;

[0049] The two-stage butterfly module includes:

[0050] A first-stage butterfly module, configured to perform scrambling processing based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences;

[0051] A second-stage butterfly module, configured to add and take the modulo of the corresponding elements of the first intermediate sequence of each group and the first intermediate sequence of the previous group in the grouping order, and then perform scrambling processing based on the first equivalent key and the second equivalent key as the output.

[0052] A computer device includes a memory and a processor. Computer-executable instructions are stored in the memory, and the processor executes the computer-executable instructions stored in the memory to implement the above-mentioned image encryption method.

[0053] The image encryption method provided by the present invention has the following beneficial effects:

[0054] First, an external key is used to generate a first equivalent key and a second equivalent key by a chaotic pseudo-random number generator, which can reduce the time complexity in the scrambling process and improve the scrambling speed. Next, the plaintext image is converted into a one-dimensional vector, and the one-dimensional vector is divided into multiple groups of sequences. After reducing the multi-dimensional image to a one-dimensional image, the subsequent computational amount can be greatly reduced, improving the encryption operation efficiency. Then, each group of sequences is used as an input sequence and input into a two-stage butterfly module for scrambling processing to obtain multiple groups of first output sequences. After all the first output sequences are combined into one sequence and subjected to a flipping process, a second output sequence is obtained. The second output sequence is divided into multiple groups of subsequences, and each group of subsequences is used as an input sequence and input into a two-stage butterfly module for scrambling processing to obtain multiple groups of third output sequences. After all the third output sequences are combined into a final sequence, the final sequence is then converted into a matrix with the same dimension as the plaintext image, and this matrix is the encrypted ciphertext image. First, information is scrambled by adding elements and taking the modulus, and then scrambling processing is performed using the key. The double encryption processing can make the encryption effect of the image better. Among them, the two-stage butterfly module scrambling processing steps include performing scrambling processing based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences; in the order of grouping, adding the corresponding elements of each group of first intermediate sequences to the corresponding elements of the first intermediate sequences of the previous group and taking the modulus, and then performing scrambling processing based on the first equivalent key and the second equivalent key as the output. This solution uses a two-stage butterfly module for multiple scrambling encryption processes. The encryption process is based on integer operations. Compared with the existing encryption methods, the method of the present invention has a lower time complexity, a better scrambling effect, and faster diffusion of image information, and can more effectively protect the security of image information. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] To more clearly illustrate the embodiments of the present invention and its design, the accompanying drawings required for the present embodiments will be briefly introduced below. The accompanying drawings in the following description are only partial embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0056] Figure 1 It is the phase diagram of PWLCM when p = 0.301 in the method embodiment of the present invention.

[0057] Figure 2It is a mapping relationship diagram of the new PWLCM in the method embodiment of the present invention.

[0058] Figure 3 It is the phase diagram and frequency diagram of the new PWLCM in the method embodiment of the present invention:

[0059] Among them, Figure 3 (a) of it is the phase diagram of state xn; Figure 3 (b) of it is the phase diagram of state yn; Figure 3 (c) of it is the frequency diagram of state xn; Figure 3 (d) of it is the frequency diagram of state yn.

[0060] Figure 4 It is a schematic structural diagram of the butterfly knot algorithm in the method embodiment of the present invention.

[0061] Figure 5 It is a schematic structural diagram of the butterfly encoding module of the encryption structure in the method embodiment of the present invention.

[0062] Figure 6 It is a flow chart of the image encryption and decryption system in the method embodiment of the present invention.

[0063] Figure 7 It is a schematic structural diagram of the equivalent key converter in the method embodiment of the present invention.

[0064] Figure 8 It is a schematic diagram of the experimental results of image encryption and decryption in the method embodiment of the present invention:

[0065] Among them, Figure 8 (a)-(e) of it are the original images; Figure 8 (f)-(j) of it are the encrypted images; Figure 8 (f)-(o) of it are the decrypted images. Specific implementation manners

[0066] In order to enable those skilled in the art to better understand the technical solution of the present invention and be able to implement it, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0067] Method embodiment

[0068] The present invention provides an image encryption method. In the method of this embodiment, 4 S-boxes are used, one of which is the S-box cited from the AES algorithm, and the other three are new S-boxes created by means of the method for generating S-boxes in the AES algorithm.

[0069] The S-Box used in the AES algorithm is a lookup table with a length of 256, containing 256 integer elements from 0 to 255, which realizes the non-linear transformation function, that is, when inputting an element a from 0 to 255, the transformed element b will be output. The method for AES to generate the S-box is a bijection, and its generation method is as follows:

[0070]

[0071] Equation (1) performs bitwise operations, where,

[0072]

[0073] a -1 represents the inverse element of a, based on the field GF(2 8 ), using the irreducible polynomial p(x) = x 8 +x 4 +x 3 +x+1, represents the bitwise AND operation, B = [0 1 1 0 0 0 1 1] T .

[0074] The S-box of the AES algorithm, denoted as Sbox1, is shown in Table 1, and the inverse box of Sbox1 is denoted as ISbox1.

[0075] Table 1 S-Box in the AES Algorithm

[0076]

[0077] The method of finding a new good S-box by changing the values of A and B with the help of Equation (1) is too simple because AES has selected the optimal irreducible polynomial. In addition, the irreducible polynomial x 8 +x 6 +x 5 +x 3 +1 is also a preferred irreducible polynomial.

[0078] The following introduces the methods for generating the other three new S-boxes:

[0079] 1) In Equation (1), keep A unchanged and set B to the new B = [0 1 1 1 1 0 1 1] T , and the generated S-box, denoted as Sbox2, is shown in Table 2, and the inverse box of Sbox2 is denoted as ISbox2.

[0080] Table 2 Sbox2

[0081]

[0082] 2) In Equation (1), keeping A unchanged, set B to the new B = [1 0 1 1 0 0 0 1] T , the generated S-box, denoted as Sbox3, is shown in Table 3. The inverse box of Sbox3 is denoted as ISbox3.

[0083] Table 3 Sbox3

[0084]

[0085] 3) In Equation (1), set A to the new

[0086]

[0087] Set B to the new B = [1 1 0 0 1 1 1 0] T , the generated S-box, denoted as Sbox4, is shown in Table 4. The inverse box of Sbox4 is denoted as ISbox4.

[0088] Table 4 Sbox4

[0089]

[0090] This embodiment uses a piece-wise linear chaotic map (PWLCM), which is expressed as

[0091]

[0092] where the parameter 0 < p < 0.5, and its Lyapunov exponent is λ = -0.5ln[p(0.5 - p)]. When p = 0.25, it takes the minimum value of λ min = 2ln2. When p = 0.301, the phase diagram is as Figure 1 shown, and its probability density function is ρ(x) = 1.0.

[0093] In Figure 1 , the straight line represented by y = x has 3 intersections with the PWLCM, and these intersections are all first-order fixed points. To avoid the first-order fixed points, based on Equation (4), a new PWLCM is proposed, as shown in Equation (5).

[0094]

[0095] The Lyapunov exponent of the new PWLCM is λ = -0.5ln[2p(1 - 2p)]. When p = 0.25, it takes the minimum value of λ min = ln2. When p = 0.301, the phase diagram is as Figure 2 shown, and from Figure 2It can be seen that although the Lyapunov exponent decreases, the new PWLCM maintains the symmetry of the phase diagram about the axis x = 0.5, which makes the probability density function of the new mapping be

[0096]

[0097] To increase the value of the Lyapunov exponent, combine the PWLCM shown in Figure 2 with the Arnold map (cat map) to form a chaotic system as shown in Eq. (7),

[0098]

[0099] It is easy to know that when p = 0.25, a >> 1 and a >> b > 0, the state sequence generated by Eq. (7) is approximately uniformly distributed, and the largest Lyapunov exponent of the whole system is approximately the positive eigenvalue of the Arnold map, that is For example, when a = 26.79, b = 3.82, p = 0.25, x0 = 0.7247, y0 = 0.3038, the phase diagram and the frequency diagram of the state sequence with a length of 5000 are as shown in Figure 3 shown.

[0100] Comparing Figure 3 (a) of Figure 3 (b) of Figure 2 and Figure 3 (c) of Figure 3 (d) of Figure 3 shown, it can be seen that the states of the chaotic system Eq. (7) are uniformly dispersed in the value space of the whole phase diagram.

[0101] Define the correlation coefficient r between two sequences s1 and s2 with length n as

[0102]

[0103] where

[0104] Cov(s1,s2) = E((s1 - E(s1))(s2 - E(s2))) (9)

[0105] D(s1) = E(s1 - E(s1)) 2 (10)

[0106]

[0107] The sensitivity of the initial values \(x_0\) and \(y_0\) of the parameters \(a\), \(b\) and the mapping \(g\) in formula (7) is illustrated by means of the correlation coefficient \(r\). Given that the value range of the parameter \(a\) is \([20, 2000]\) and the resolution accuracy is 10 -12 ; the value range of the parameter \(b\) is \([1, 10]\) and the resolution accuracy is 10 -14 ; the value range of \(x_0\) is all \([0, 1]\) and the resolution accuracy is 10 -12 ; the value range of \(y_0\) is all \([0, 1]\) and the resolution accuracy is 10 -15 . Randomly generate a set of \(\{a, b, x_0, y_0\}\), and generate two state sequences of length 10000 by means of formula (7) and Then, slightly change the value of the parameter \(a\), and the size of the change is 10 -13 ; use the changed parameter combination \(\{a, b, x_0, y_0\}\) (only \(a\) has a slight change), and generate a new sequence of length 10000 by means of formula (7) and Calculate the correlation coefficients of these two groups of corresponding sequences. Repeat this experiment 300 times, and find the minimum value, maximum value and average value of the absolute value of the correlation coefficient. If the calculated value of the correlation coefficient tends to 0, it indicates that the parameter \(a\) is sensitive. In the same way, verify the sensitivity of the parameters \(b\) and the initial values \(x_0\) and \(y_0\). The test results are listed in Table 5

[0108] Table 5 Sensitivity Test Results - I

[0109]

[0110]

[0111] As can be seen from Table 5, for any one of \(\{a, b, x_0, y_0\}\), the average value of the absolute value of the correlation coefficient of the two state sequences obtained before and after changing it is less than 0.01, and the maximum value is less than 0.05, indicating that these parameters or initial values have strong sensitivity

[0112] Define the ratio of the Hamming distance between two bit sequences to the length of the bit sequence as \(p\). When two completely uncorrelated sequences, as their lengths tend to infinity, the value of \(p\) tends to 0.5. Use formula (12) and formula (13) to generate pseudo-random sequences \(\{u\) n} and \(\{v\) n} respectively from the state sequences \(\{x n}\) and \(\{y n}\),

[0113] u n = floor(x n × 1010 ) mod 255 + 1 (12)

[0114] v n = floor(y n × 10 10 ) mod 255 + 1 (13)

[0115] Where floor(x) represents the integer part of the positive number x, and mod represents the modulo operation.

[0116] Now, randomly generate a set {a, b, x0, y0}, increase the value of a by 10 -12 , and use {a, b, x0, y0} before and after the change of a to generate two sets of sequences {u 1n} of length 125000 and {v 1n} with the help of equations (7), (12), and (13) respectively. 2n} and {u 2n} and {v 6} (converted into bit sequences of length 10. Note that in order to reflect the balance, in equations (12) and (13) for generating pseudo-random sequences here, modulo 255 + 1 is replaced by modulo 256), calculate the p-value between {u 1n} and {u 2n}, and the p-value between {v 1n} and {v 2n}. Then, repeat the above experiment 300 times to obtain the minimum, maximum, and average values of the p-value. After that, conduct similar experiments for b, x0, and y0, where the change amount of b is set to 10 -14 , the change amount of x0 is set to 10 -12 , and the change amount of y0 is set to 10 -15 . The experimental results are listed in Table 6.

[0117] Table 6 Sensitivity Test Results - II

[0118]

[0119]

[0120] As can be seen from Table 6, for any small change in any element in the parameter combination {a, b, x0, y0}, the p-value between the generated bit sequences is close to the theoretical value of 0.5, which further indicates that all parameters in {a, b, x0, y0} are sensitive.

[0121] Now randomly generate a set {a, b, x0, y0}, and use equations (7), (12), and (13) to generate sequences {u n} and {v n} of length 125000 (the sequence length is 10​6 (bits), these two sequences are tested by means of the NIST SP800-22 pseudo-randomness test standard. Each test obtains a p-value. When the value of the p-value is greater than 0.01, the test is qualified; otherwise, the test is unqualified. This experiment is repeated 300 times, and the passing rates of the p-values of the tests are listed in Table 7.

[0122] Table 7 Pseudo-randomness Test Results

[0123]

[0124]

[0125] In Table 7, the minimum passing rate is 97.33%, indicating that the proposed algorithm for generating chaotic sequences is feasible and can be used as a pseudo-random number generator for an image cryptosystem to generate pseudo-random sequences for image encryption.

[0126] The meanings of the symbols used in the encryption algorithm in this embodiment are listed in Table 8.

[0127] Table 8 Table of Symbol Meanings

[0128]

[0129]

[0130] The core component of the encryption algorithm used is the Figure 4 butterfly knot as shown.

[0131] In Figure 4 is a butterfly knot, which has two input terminals, denoted as x1 and x2; it has two output terminals, denoted as y1 and y2. The connection matrix between the input and the output is denoted as

[0132]

[0133] The transformation from the input to the output is

[0134]

[0135] In Equation (14), a 11 and a 12 come from the equivalent key set, and a 21 and a 22 are the values obtained after looking up the table through Sbox for a 11 and a 12 respectively. In Equation (14), the values obtained by applying the transformation A to {x1, x2} are assigned to the variables y1 and y2.

[0136] The values of the elements of the connection matrix are integers between [1, 255], and the corresponding 4 S-boxes are the S-boxes modified on the original basis. The modification method is as follows: Let Sbox1

[83] =Sbox1

[256] =22, discard Sbox1

[256] ; Let Sbox2

[223] =Sbox2

[256] =49, discard Sbox2

[256] ; Let Sbox3

[103] =Sbox3

[256] =251, discard Sbox3

[256] ; Let Sbox4

[254] =Sbox4

[256] =222, discard Sbox4

[256] . The modified S-box is denoted as MSbox.

[0137] From Equation (15), x1 and x2 can be obtained from y1 and y2, that is

[0138]

[0139] The multiplication, addition, and matrix inversion operations in Equation (15) and Equation (16) are all based on GF(2 8 ), and the irreducible polynomial is x 8 +x 4 +x 3 +x+1. If then let a 11 =(77 + MSbox2(a 11 )) mod (255)+1.

[0140] The basic unit of the encryption structure is called the butterfly coding module. As Figure 5 shown, it includes 5 layers and can simultaneously process 8-byte data.

[0141] In Figure 5 , the butterfly module has 8 input terminals and 8 output terminals. The specific connection matrices of each layer are as follows:

[0142] (1) In the first layer (Layer 1).

[0143] The first layer contains 4 butterflies. The connection matrix of the first butterfly with IN1 and IN2 as inputs is

[0144]

[0145] The connection matrices of the other three butterflies are

[0146]

[0147] The and of each of the above connection matrices directly come from the equivalent key, k = {r, g, b, t}, while and respectively represent check MSbox1 and the values obtained by checking MSbox2.

[0148] (2) In the second layer (Layer 2).

[0149] The output of the first layer is directly used as the input of the second layer. The second layer contains 4 bowties, and the connection matrix of each bowtie is related to the connection matrix of the bowtie in the first layer. Among them, the connection matrix of the first bowtie is:

[0150]

[0151] Similarly, the connection matrices of the other three bowties are:

[0152]

[0153] (3) In the third layer (Layer 3).

[0154] In Figure 5 let the outputs of the second layer from top to bottom be i = 1, 2,..., 8. Let the inputs of the fourth layer from top to bottom be i = 1, 2,..., 8. The third layer connects the second layer and the fourth layer, and the implemented processing is as follows:

[0155]

[0156] where, "<<<" represents a cyclic left shift.

[0157] (4) In the fourth layer (Layer 4).

[0158] The fourth layer contains 4 bowties, and the connection matrix of each bowtie is

[0159]

[0160] (5) In the fifth layer (Layer 5).

[0161] The fifth layer contains 4 bowties, and the connection matrix of each bowtie is

[0162]

[0163] In Figure 5 the butterfly module shown, the proposed image encryption and decryption system is as Figure 6 shown.

[0164] In Figure 6 the external key K generates an equivalent key with the help of a chaotic pseudo-random number generator, denoted as {ui}, and {v i} where i = 1, 2, …, MN / 2, and M and N are the width and height of the plaintext image, satisfying Mod(MN, 8) = 0. The plaintext image P is transformed into a one-dimensional vector X, which is successively passed through the butterfly encoding algorithm, sequence flipping, and another butterfly encoding algorithm, and the resulting sequence is transformed into an M×N matrix, which is the ciphertext image. The decryption process is the inverse process of the encryption process, and the butterfly decoding module therein is the inverse module of the butterfly encoding module, using the inverse matrix of the connection matrix of each layer.

[0165] Combined with Figure 6 , the image encryption algorithm proposed in this embodiment will be described in detail below.

[0166] The steps of the equivalent key generation process in this embodiment are as follows:

[0167] Step 1: Input an external key K of length 256 bits, divide K into words of length 32 bits, denoted as {w i}}, i = 1, 2, …, 8, and generate a new K = {w Figure 7}}, i = 9, 10, …, 16 in the manner shown in i . In Figure 7 , "S" in the G function uses Sbox2, and "S" in the H function uses Sbox4.

[0168] Figure 7 The purpose of

[0169] is to scramble trivial keys such as all 0s or all 1s as input to obtain an irregular key. 10 11 12 Step 2: Generate the parameters a, b and the initial values x0, y0 in formula (7) from w9, w

[0170]

[0171] Substitute the parameters a, b and the initial values x0, y0 into formula (7) and iterate 30 times to obtain a new state, denoted as {x 30 , y 30}, then use w 13 to update the value of y 30 , and the updated state is still denoted as {x0, y0}, that is

[0172]

[0173] Substitute the new {x0, y0} above into formula (7) and iterate 30 times to obtain the state {x 30 , y 30 ​​}。The above process is executed cyclically 3 times. In each cycle, w 14 , w 15 , w 16 are successively used to update y 30 , and a new state is obtained and denoted as {x0, y0}. After substituting it into Equation (7) and iterating 30 times, the state {x 30 , y 30} is obtained. The state {x 30 , y 30} obtained in the last cycle is regarded as the state {x0, y0}, and it is continued to iterate MN / 2 times to obtain two state sequences {x i} and {y i}, where i = 1, 2,..., MN / 2. Here, M and N represent the width and height of the plaintext image.

[0174] Step 3: {x i} and {y i} are used to generate integer sequences {u i} and {v i} with the aid of Equations (12) and (13), where i = 1, 2,..., MN / 2. Here, {u i} and {v i} are equivalent keys.

[0175] Specifically, the steps of the encryption process are as follows:

[0176] Step 1: The grayscale image P with size M×N is expanded by rows to obtain a one-dimensional vector, denoted as X = {x i}, where i = 1, 2,..., MN. The sequence X is divided into groups of 8 elements each, and a total of MN / 8 groups are obtained, denoted as {x 8j-7 , x 8j-6 , …, x 8j}, where j = 1, 2,..., MN / 8.

[0177] Step 2: Butterfly coding is performed on the first group of the sequence X. Combining Figure 5 , the 8 input terminals INi are successively input with x i , where i = 1, 2,..., 8. Among them, successively takes u j , where j = 1, 2, 3, 4; successively takes v j , where j = 1, 2, 3, 4. With the aid of the Figure 5 algorithm, the input is converted into the output. The outputs of the output terminals OUT i , where i = 1, 2,..., 8, are denoted as z i , where i = 1, 2,..., 8.

[0178] Step 3: Let k = 2.

[0179] Step 4: Perform butterfly encoding on the k-th group {x 8k-7 , x 8k-6 , …, x 8k} of sequence X. At this time, first add the corresponding elements of the k-th group of sequence X and the encoded output {z 8k-8 , z 8k-9 , …, z 8k-15} of its (k - 1)-th group modulo 256. The resulting {(x 8k-7 + z 8k-8 ) mod 256, (x 8k-6 + z 8k-9 ) mod 256,.., (x 8k + z 8k-15 ) mod 256} is used as the input signal at the input end. At this time, the elements of the connection matrix are taken as u4(k - 1) + j in sequence, where j = 1, 2, 3, 4; are taken as v4(k - 1) + j in sequence, where j = 1, 2, 3, 4.

[0180] Step 5: Let k = k + 1. Loop and execute Step 4 until k > MN / 8.

[0181] Step 6: Merge the output {z 8j-7 , z 8j-6 , …, z 8j}, where j = 1, 2, …, MN / 8 into a sequence. Reverse this sequence, and the resulting sequence is still denoted as X.

[0182] Step 7: Execute Steps 2 - 5 to obtain a new {z 8j-7 , z 8j-6 , …, z 8j}, where j = 1, 2, …, MN / 8. During this process, when performing butterfly encoding on the k-th group {x 8k-7 , x 8k-6 , …, x 8k} (k ≥ 2) of sequence X, add the corresponding elements of the k-th group of sequence X and the encoded output {z 8k-15 , z 8k-14 , …, z 8k-8} of its (k - 1)-th group modulo 256. The resulting {(x 8k-7 + z 8k-15 ) mod 256, (x 8k-6 + z 8k-14 ) mod 256,.., (x 8k + z 8k-8) The input signal at the input end is {mod 256}. During the execution process, the weights of the connection matrix in the k-th step successively take v4(k - 1)+j, where j = 1, 2, 3, 4; successively take u4(k - 1)+j, where j = 1, 2, 3, 4.

[0183] Step 8: Combine {z 8j-7 , z 8j-6 , …, z 8j}, where j = 1, 2, …, MN / 8 into a sequence, denoted as Y = {y i}, where i = 1, 2, …, MN. Then, convert Y into an M×N matrix C, and C is the ciphertext image.

[0184] The encryption effect of the encryption method in this embodiment is further described in combination with simulation experiments as follows:

[0185] The computer software and hardware configuration used in the simulation experiment is: AMD Ryzen 9 3950X 16-Core CPU, DDR4 3200MHz 32GB Memory, Windows 11 Pro 64-bit. All experiments are completed with the help of the mathematical software Mathematica 13.3. The images used in the experiment come from the online test image instance database ExampleData of Mathematica. Without loss of generality, the test results of Mandrill, Elaine, and Peppers images are listed here. First, read these images from ExampleData, and then convert them into grayscale images with a size of 256×256, as shown in Figure 8 (a)-(c). At the same time, the encryption situations of all-black and all-white images with a size of 256×256 (as shown in 8(d)-(e) of the figure) are also listed. The external key used is 0C66B376EDE0ADA29FF0C5234F0E14E0D87C6DE8B72B02291541B10ACFA1C0A4 (in hexadecimal form). Figure 8 The encryption results of the plaintext images shown in (a)-(e) of Figure 8 are respectively shown in (f)-(j) of Figure 8 ; the results after decrypting these ciphertext images with the legal key are shown in (k)-(o) of

[0186] Figure 8 . The encryption and decryption results of the example images shown indicate that the ciphertext images have good invisibility, and the decrypted images are exactly the same as the original plaintext images.

[0187] Device Embodiment

[0188] This embodiment provides an image encryption device, including:

[0189] A key conversion module, configured to convert an external key into a first equivalent key and a second equivalent key by using a chaotic pseudo-random number generator.

[0190] A first scrambling module, configured to convert a plaintext image into a one-dimensional vector, divide the one-dimensional vector into multiple groups of sequences, input each group of sequences as an input sequence into a two-stage butterfly module, and obtain multiple groups of first output sequences after scrambling processing.

[0191] A second scrambling module, configured to merge all the first output sequences into one sequence and then perform a flipping process to obtain a second output sequence.

[0192] A third scrambling module, configured to divide the second output sequence into multiple groups of subsequences, input each group of subsequences as an input sequence into a two-stage butterfly module, and obtain multiple groups of third output sequences after scrambling processing.

[0193] An encryption module, configured to merge all the third output sequences into a final sequence, and then convert the final sequence into a matrix with the same dimension as the plaintext image, and this matrix is the encrypted ciphertext image.

[0194] The two-stage butterfly module includes:

[0195] A first-stage butterfly module, configured to perform scrambling processing based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences.

[0196] A second-stage butterfly module, configured to add the corresponding elements of the first intermediate sequence of each group and the first intermediate sequence of the previous group modulo according to the grouping order, and then perform scrambling processing based on the first equivalent key and the second equivalent key as the output.

[0197] Device embodiment

[0198] The present invention provides a computer device, including a memory and a processor. The memory stores computer execution instructions, and the processor executes the computer execution instructions stored in the memory to implement an image encryption method as described above. The method has been described in detail in the method embodiment and will not be elaborated here.

[0199] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0200] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combinations of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices produce a means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.

[0201] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.

[0202] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.

[0203] It should be noted that the specific embodiments described above can enable those skilled in the art to understand the present invention more comprehensively, but do not limit the present invention in any way. Therefore, although this specification and the embodiments have described the present invention in detail, those skilled in the art should understand that the present invention can still be modified or equivalently replaced; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered by the protection scope of the patent of the present invention. Any reference signs in the claims should not be construed as limiting the claimed invention.

Claims

1. An image encryption method, characterized in that, It includes the following steps: Use a chaotic pseudo-random number generator to convert an external key into a first equivalent key and a second equivalent key; Convert the plaintext image into a one-dimensional vector, divide the one-dimensional vector into multiple groups of sequences, input each group of sequences as an input sequence into a two-stage butterfly module, and obtain multiple groups of first output sequences after scrambling; Merge all the first output sequences into one sequence and then perform a flipping process to obtain a second output sequence; Divide the second output sequence into multiple groups of subsequences, input each group of subsequences as an input sequence into a two-stage butterfly module, and obtain multiple groups of third output sequences after scrambling; After merging all the third output sequences into a final sequence, convert the final sequence into a matrix with the same dimension as the plaintext image, and the matrix is the encrypted ciphertext image; The scrambling process of the two-stage butterfly module includes: Perform scrambling based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences; In the order of grouping, add the corresponding elements of the first intermediate sequence of each group to the first intermediate sequence of the previous group and take the modulus, and then perform scrambling based on the first equivalent key and the second equivalent key as the output.

2. The image encryption method according to claim 1, wherein The specific steps of performing scrambling based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences include: Divide two adjacent elements in each group of sequences into a group, and after each group of elements undergoes a connection matrix transformation, two first scrambling values are obtained. The connection matrix is composed of elements in the first equivalent key and the second equivalent key after being scrambled by a scrambling box; Randomly group two of all the first scrambling values into a group; after each group of first scrambling values undergoes a connection matrix transformation, two second scrambling values are obtained; After each second scrambling value undergoes a cyclic shift and a scrambling box scrambling process respectively, corresponding third scrambling values are obtained; Randomly group two of all the third scrambling values into a group, and after each group of third scrambling values undergoes a connection matrix transformation, two fourth scrambling values are obtained; Randomly group two of all the fourth scrambling values into a group, and after each group of fourth scrambling values undergoes a connection matrix transformation respectively, the first output sequence is obtained.

3. The image encryption method according to claim 2, characterized in that, The connection matrix is: Among them, is the connection matrix of the k-th group, is the value within the first equivalent key, is the value within the second equivalent key, and respectively represent the values obtained by querying MSbox1 and querying MSbox2. MSbox1, MSbox2, MSbox3, and MSbox4 are scrambling boxes, and their values are in the integer interval [1, 255].

4. The image encryption method according to claim 2, wherein The relational formula of the cyclic shift and the scrambling box scrambling process is: Among them, "<<<" represents a cyclic left shift, Sbox1, Sbox2, Sbox3, and Sbox4 are scrambling boxes, out2 is the second scrambling value, and in4 is the third scrambling value.

5. The image encryption method according to claim 1, wherein The steps of generating the first equivalent key and the second equivalent key by using a chaotic pseudo-random number generator for the external key include: Divide the external key into multiple groups of first sub-keys according to a set length; After scrambling all the first sub-keys, multiple groups of second sub-keys are obtained; After multiple cyclic iteration processes of all the second sub-keys through a chaotic pseudo-random number generator composed of a piecewise linear chaotic map and a cat map, two third sub-keys are obtained; After respectively processing the two third sub-keys through a pseudo-random function, the first equivalent key and the second equivalent key are obtained.

6. The image encryption method according to claim 5, wherein The formula of the pseudo-random function is: u n = floor(x n × 10 10 ) mod 255 + 1 v n = floor(y n × 10 10 ) mod 255 + 1 where x n and y n are the third sub-keys, floor represents the floor function, mod represents the modulo operation, and n is a natural number.

7. The image encryption method according to claim 1, characterized in that The relevant formula of the chaotic pseudo-random number generator is: Among them, w9, w 10 , w 11 and w 12 are the second sub-keys, p is the control parameter of the mapping, mod represents the modulo operation, max represents the maximum value operation, x n and y n are the state sequences, and n is a natural number.

8. The image encryption method according to any one of claims 2-4, characterized in that, The scrambling box is recreated based on the method of generating the S-box in the AES algorithm.

9. An image encryption device, characterized in that, It includes: A secret key conversion module, configured to convert an external key into a first equivalent key and a second equivalent key by using a chaotic pseudo-random number generator; A first scrambling module, configured to convert a plaintext image into a one-dimensional vector, divide the one-dimensional vector into multiple groups of sequences, use each group of sequences as an input sequence to input into a two-stage butterfly module, and obtain multiple groups of first output sequences after scrambling processing; A second scrambling module, configured to merge all the first output sequences into one sequence and then perform a flipping process to obtain a second output sequence; A third scrambling module, configured to divide the second output sequence into multiple groups of subsequences, use each group of subsequences as an input sequence to input into a two-stage butterfly module, and obtain multiple groups of third output sequences after scrambling processing; An encryption module, configured to merge all the third output sequences into a final sequence, and then convert the final sequence into a matrix with the same dimension as the plaintext image, and the matrix is the encrypted ciphertext image; The two-stage butterfly module includes: A first-stage butterfly module, configured to perform scrambling processing based on the first equivalent key and the second equivalent key on each group of input sequences to convert them into first intermediate sequences; A second-stage butterfly module, configured to, according to the grouping order, add and take the modulus of the corresponding elements of the first intermediate sequence of each group and the first intermediate sequence of the previous group, and then perform scrambling processing based on the first equivalent key and the second equivalent key as the output.

10. A computer device, comprising a memory and a processor, characterized in that, The memory stores computer execution instructions, and the processor executes the computer execution instructions stored in the memory to implement an image encryption method according to any one of claims 1-8.