A method and apparatus for image encryption

By using a periodic conversion rule and a random binary sequence for image encryption, the problem of low security in traditional image encryption algorithms is solved, achieving higher security and resistance to attacks.

CN115526759BActive Publication Date: 2026-07-31AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AGRICULTURAL BANK OF CHINA
Filing Date
2022-10-20
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing image encryption algorithms such as AES, RSA, and IDEA offer low security for image encryption, have small key spaces, and are weak against attacks.

Method used

The image is encrypted using a periodic transformation rule, with a randomly generated binary sequence as the key. By encrypting and updating the key multiple times, the number of evolutions of the image sequence to be encrypted under different transformation rules is determined, thus expanding the key space.

Benefits of technology

It improves the security of image encryption, reduces predictability, increases the cost of cracking, and enhances the ability to resist brute-force attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115526759B_ABST
    Figure CN115526759B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for image encryption, comprising: generating an image sequence to be encrypted based on a plaintext image; selecting N transformation rules with a period of T as a set of transformation rules, where N≥2; determining a key k based on a randomly generated binary sequence; selecting M transformation rules from the set of transformation rules to perform M rounds of encryption on the image sequence to be encrypted, wherein the transformation rules used in each round of encryption are different, and the round key used in each round of encryption is different, and the round key is determined based on the key k; wherein, in the i-th round of encryption, the i-th round image sequence to be encrypted is evolved j times using the i-th transformation rule, and the i-th round image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption, and the number of evolutions j is determined by the binary sequence in the i-th round key; through the M rounds of encryption, an image ciphertext sequence corresponding to the plaintext image is obtained. This application improves the security of image encryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and specifically to a method and apparatus for image encryption. Background Technology

[0002] With images being widely used in all aspects of daily life, especially in fields such as finance, healthcare, and the military, image protection strategies have become particularly important. To ensure data security, image data needs to be protected before transmission or publication, and the most commonly used method is encryption technology. Encryption technology refers to using technical means to transmit important data in an encrypted manner, and then decrypting it at the destination using the same or different methods.

[0003] In traditional encryption algorithms, such as AES, RSA, and IDEA, encryption algorithms are often used to encrypt text data or binary data. However, as a special data format, images are less secure when encrypted using traditional encryption algorithms such as AES, due to the small key space and weak resistance to attacks. Summary of the Invention

[0004] To improve the security of image encryption, this application provides a method for image encryption, the method comprising:

[0005] Generate an image sequence to be encrypted from a plaintext image;

[0006] Select N transformation rules with a period of T as the transformation rule set, where N≥2;

[0007] The key k is determined based on a randomly generated binary sequence;

[0008] M transformation rules are selected from the set of transformation rules to perform M rounds of encryption on the image sequence to be encrypted. The transformation rules used in each round of encryption are different, and the round key used in each round of encryption is different. The round key is determined based on the key k.

[0009] In the i-th round of encryption, the i-th transformation rule is used to evolve the i-th image sequence to be encrypted j times. The i-th image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption. The number of evolutions j is determined by the binary sequence in the i-th round key.

[0010] Through the M rounds of encryption, the image ciphertext sequence corresponding to the plaintext image is obtained.

[0011] Optionally, determining the key k based on the randomly generated binary sequence includes:

[0012] Randomly generate an m-bit binary sequence;

[0013] The image sequence to be encrypted is grouped into m-bit groups to obtain L image group sequences;

[0014] The m-bit binary sequence is XORed with the numbers of the L image group sequences to obtain L subkeys that correspond one-to-one with the L image group sequences, and the L subkeys are used as the key k.

[0015] Optionally, the step of selecting M transformation rules from the set of transformation rules to perform M rounds of encryption on the image sequence to be encrypted includes:

[0016] For the q-th image block sequence in L image block sequences, in the i-th round of encryption, the number of evolutions of the i-th round image block sequence to be encrypted is determined according to the i-th round key in the subkey corresponding to the q-th image block sequence.

[0017] Optionally, before performing the first round of encryption, the method further includes:

[0018] The key k is XORed with the image group sequence, and the XOR result is used as the input for the first round of encryption.

[0019] Optionally, the method further includes:

[0020] Based on the key k, the image ciphertext sequence is decrypted in M ​​rounds using the M transformation rules; wherein, in the i-th round of decryption, the i-th transformation rule is used to evolve the i-th round image ciphertext sequence Tj times.

[0021] The plaintext image is obtained through the M rounds of decryption.

[0022] Optionally, generating the image sequence to be encrypted based on the plaintext image includes:

[0023] By arranging the pixels in different color channels of the plaintext image, the pixels of different color channels of the plaintext image are mixed to obtain the sequence of images to be encrypted.

[0024] A second aspect of this application provides an image encryption device, the device comprising:

[0025] An image sequence generation unit is used to: generate an image sequence to be encrypted based on a plaintext image;

[0026] The conversion rule selection unit is used to: select N conversion rules with a period of T as a conversion rule set, where N≥2;

[0027] A key generation unit is used to: determine a key k based on a randomly generated binary sequence;

[0028] An encryption unit is configured to: select M conversion rules from the set of conversion rules to perform M rounds of encryption on the image sequence to be encrypted, wherein the conversion rules used in each round of encryption are different, and the round key used in each round of encryption is different, wherein the round key is determined based on the key k;

[0029] In the i-th round of encryption, the i-th transformation rule is used to evolve the i-th image sequence to be encrypted j times. The i-th image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption. The number of evolutions j is determined by the binary sequence in the i-th round key.

[0030] The image sequence generation unit is further configured to: obtain the image ciphertext sequence corresponding to the plaintext image through the M rounds of encryption.

[0031] Optionally, the key generation unit is further configured to:

[0032] Randomly generate an m-bit binary sequence;

[0033] The image sequence to be encrypted is grouped into m-bit groups to obtain L image group sequences;

[0034] The m-bit binary sequence is XORed with the numbers of the L image group sequences to obtain L subkeys that correspond one-to-one with the L image group sequences, and the L subkeys are used as the key k.

[0035] Optionally, the device further includes:

[0036] The decryption unit is configured to: perform M rounds of decryption on the image ciphertext sequence using the M transformation rules according to the key k; wherein, in the i-th round of decryption, the i-th round image ciphertext sequence is transformed Tj times using the i-th transformation rule;

[0037] The decryption unit is also used to: obtain the plaintext image through the M rounds of decryption.

[0038] Optionally, the image sequence generation unit is further configured to:

[0039] By arranging the pixels in different color channels of the plaintext image, the pixels of different color channels of the plaintext image are mixed to obtain the sequence of images to be encrypted.

[0040] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: using periodic conversion rules to encrypt images and using randomly generated binary sequences as keys reduces predictability, increases cracking costs, and thus reduces security risks; encrypting the image sequence to be encrypted multiple times using different conversion rules and by updating the key, determining the number of evolutions of the image sequence to be encrypted under different conversion rules based on the binary sequence in the key, expands the key space, enhances the encryption algorithm's ability to resist brute-force attacks, and thus improves the security of image encryption. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 Flowcharts provided for embodiments of this application;

[0043] Figure 2 A flowchart illustrating the selection of a transformation rule with a period of T from the linear Moore nearest neighbor rule, provided for embodiments of this application;

[0044] Figure 3 A flowchart for encrypting an image sequence to be encrypted, provided in an embodiment of this application;

[0045] Figure 4 A flowchart for decrypting an image ciphertext sequence provided in this application embodiment;

[0046] Figure 5 A flowchart provided for an embodiment of the scenario in this application;

[0047] Figure 6 This is a flowchart illustrating the encryption of the q-th image group sequence in the scenario embodiment of this application;

[0048] Figure 7 Experimental images used in the simulation process of image encryption and decryption;

[0049] Figure 8 A comparison chart of the color channel histograms of the plaintext and ciphertext image sequences in a Baboon image.

[0050] Figure 9 This is a schematic diagram of an apparatus according to an embodiment of this application. Detailed Implementation

[0051] This application uses a periodic conversion rule to encrypt images, using a randomly generated binary sequence as the key. The image sequence to be encrypted is encrypted multiple times using different conversion rules. By updating the key, the number of times the image sequence to be encrypted is evolved under different conversion rules is determined based on the binary sequence in the key. This expands the key space and improves the security of image encryption.

[0052] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.

[0053] See Figure 1 As shown, the embodiments of this application include the following steps:

[0054] Step 101: Generate the image encryption sequence based on the plaintext image;

[0055] When generating the image sequence to be encrypted, the plaintext image pixels can be mixed and scrambled to obfuscate the original image pixels, which helps to improve the obfuscation of the encrypted image ciphertext sequence.

[0056] When the plaintext image is an RGB image, since an RGB image consists of three different color channels, each pixel in each color channel can be represented by one byte. The pixels in the three color channels are repeatedly processed according to the following arrangement mechanism: the first byte is the byte of the red channel, the second byte is the byte of the green channel, and the third byte is the byte of the blue channel, until a byte sequence containing all the pixels in the plaintext image is obtained. This achieves the mixing of pixels in different color channels, increases the obfuscation degree of the image ciphertext sequence, and reduces the recognizability of the image ciphertext sequence.

[0057] Of course, plaintext images can also be arranged in other ways or generated by other methods to form an image sequence to be encrypted, which will not affect the implementation of the embodiments of this application.

[0058] Step 102: Select N transformation rules with a period of T as the transformation rule set, where N≥2;

[0059] Among these, transformation rules with the same period can be selected from the linear Moore nearest neighbor rules as the transformation rule set, see [link to relevant documentation]. Figure 2 As shown, it includes the following steps:

[0060] Step 1021: Generate rule set S;

[0061] The first generated rule set S consists of 512 linear Moore nearest neighbor rules.

[0062] Step 1022: Randomly initialize a 16×16 binary matrix C as the initialization structure for the two-dimensional cellular automaton C(1);

[0063] For ease of calculation, matrix C is a binary matrix consisting only of 0 and 1. Of course, the values ​​in matrix C and the size of matrix C can also be set to other values, which will not affect the implementation of the embodiments of this application.

[0064] Step 1023: Use each rule R(i) in S to evolve the above matrix C(1) T times in sequence to obtain the result matrix C(T);

[0065] Using period T as a preset condition for selection rules aims to filter out rules with period T from the rule set S.

[0066] Step 1024: If C(T)≠C(1), delete R(i) from the rule set S;

[0067] Since the transformation rules used in the encryption process are periodic, after the matrix C is transformed T times using the transformation rule with a period of T, the matrix C will be restored to its original value before the transformation. This is to verify whether the currently used rule R(i) meets the preset conditions of the transformation rule.

[0068] Step 1025: After verifying all rules in set S, we obtain a rule set S' with period T. When S and S' are different, we assign S' to S and return to step 1021.

[0069] Step 1026: When S remains stable, obtain the set S of all rules that satisfy the preset conditions;

[0070] Step 1027: Randomly select N rules from S to form a transformation rule set.

[0071] Because the conversion rule is periodic, symmetric encryption of the image sequence to be encrypted can be achieved. Of course, other periodic conversion rules can also be selected as encryption rules, without affecting the implementation of the embodiments of this application.

[0072] Step 103: Determine the key k based on the randomly generated binary sequence;

[0073] Generating keys randomly reduces the predictability of encryption, increases the cost of cracking, thereby reducing security risks and improving encryption security.

[0074] Step 104: Select M conversion rules from the set of conversion rules to perform M rounds of encryption on the image sequence to be encrypted. The conversion rules used in each round of encryption are different, and the round key used in each round of encryption is different. The round key is determined based on the key k.

[0075] In the i-th round of encryption, the i-th transformation rule is used to evolve the i-th image sequence to be encrypted j times. The i-th image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption. The number of evolutions j is determined by the binary sequence in the i-th round key.

[0076] See Figure 3 As shown, step 104 includes the following steps:

[0077] Step 1041: Using the image encryption sequence obtained in step 101 as the first round image encryption sequence, and using the key k determined in step 103 as the first round key, assign the value 1 to i;

[0078] Step 1042: In the i-th round of encryption, the i-th transformation rule is used to evolve the image sequence to be encrypted in the i-th round j times. The number of evolutions j is determined by the binary sequence in the i-th round key.

[0079] Step 1043: Determine if i is less than M. If yes, proceed to step 1044; otherwise, proceed to step 1045.

[0080] Step 1044: Update the key for the i-th round to obtain the key for the (i+1)-th round; increment the value of i by one, and return to step 1042;

[0081] The round key can be obtained by updating the key k after each round of encryption. For example, after the first round of encryption, the key k is rotated two positions to the left to obtain the second round key, which is used for the second round of encryption.

[0082] Of course, the i+1th round key can also be generated by shifting the i-th round key two bits to the right or by other methods, which will not affect the implementation of the embodiments of this application.

[0083] Step 1045: End encryption.

[0084] Step 105: Obtain the image ciphertext sequence corresponding to the plaintext image through the M rounds of encryption.

[0085] This application embodiment uses a periodic transformation rule to evolve the image sequence to be encrypted, transforming the plaintext sequence into a ciphertext sequence, thereby achieving encryption of the image sequence to be encrypted.

[0086] This application embodiment encrypts images by using periodic conversion rules and a randomly generated binary sequence as the key, reducing predictability. The image sequence to be encrypted is encrypted multiple times using different conversion rules, and the number of evolutions of the image sequence to be encrypted under different conversion rules is determined by updating the key and the binary sequence in the key. This expands the key space, improves the encryption algorithm's ability to resist brute-force attacks, and thus enhances the security of image encryption.

[0087] Furthermore, to improve encryption speed and efficiency, the image sequence to be encrypted can be grouped for encryption. Step 103 can be achieved through the following steps:

[0088] Step 1031: Randomly generate an m-bit binary sequence;

[0089] Step 1032: Divide the image sequence to be encrypted into m-bit groups to obtain L image group sequences;

[0090] Wherein, if the image sequence to be encrypted is less than m bits after being grouped, the group of less than m bits is padded.

[0091] Step 1033: XOR the m-bit binary sequence with the numbers of the L image grouping sequences to obtain L subkeys that correspond one-to-one with the L image grouping sequences, and use the L subkeys as the key k;

[0092] The numbering of the image group sequence is also a binary sequence of length m.

[0093] When encrypting the qth image group sequence in L image group sequences, the qth subkey is used as the key k when encrypting the qth image group sequence.

[0094] When encrypting image sequences in groups, parallel encryption of each image group sequence can be achieved by calculating M transformation rules corresponding to each group in the transformation rule set, thereby improving encryption efficiency.

[0095] When encrypting blocks, each block uses a different key; when encrypting each block in multiple rounds, the key for each round of encryption is also different, which expands the key space, enhances the ability to resist brute-force attacks, and thus improves the security of the encryption algorithm in key space analysis.

[0096] Furthermore, the following steps may be included before performing the first round of encryption on each image group sequence:

[0097] The key k is XORed with the image group sequence, and the XOR result is used as the input for the first round of encryption.

[0098] An XOR operation is performed on the image block sequence to further increase the obfuscation level of the encrypted image ciphertext sequence and improve encryption security.

[0099] Further, see Figure 4 As shown, this application also includes a step of decrypting the image ciphertext sequence:

[0100] Step 401: Based on the key k, perform M rounds of decryption on the image ciphertext sequence using the M transformation rules;

[0101] In the i-th round of decryption, the i-th transformation rule is used to evolve the i-th round image ciphertext sequence Tj times;

[0102] Step 402: Obtain the plaintext image through the M rounds of decryption.

[0103] Because the transformation rules are periodic, symmetric encryption can be achieved. When decrypting the image ciphertext sequence, the same key k and M transformation rules as during encryption are used. The round key for each round of encryption is obtained by updating key k, and the number of evolutions of the i-th transformation rule used during encryption is determined based on the binary sequence in the round key.

[0104] When the image sequence to be encrypted is evolved j times using the i-th transformation rule to obtain the ciphertext sequence of the i-th round, during decryption, the image ciphertext sequence is evolved Tj times using the i-th transformation rule to restore the image ciphertext sequence to its state before encryption, thus obtaining the plaintext image.

[0105] By leveraging the periodicity of the conversion rules, encryption and decryption can be achieved using an initial key, reducing the computational load during encryption and decryption, saving computing and storage resources, and improving the efficiency of encryption and decryption.

[0106] See Figure 5 As shown, the scenario embodiment provided in this application includes the following steps:

[0107] Step 501: Mix the three color channels of the RGB image with a width of w pixels and a height of h pixels in the order of red, green and blue to obtain a pixel mixing sequence H1 with a length of 3×w×h pixels;

[0108] Step 502: Divide the pixel mixing sequence H1 into 256-bit groups, i.e., 256-bit binary sequences, to obtain the image grouping sequences PB1~PBn;

[0109] In computer data storage, the smallest unit of data storage is the bit. One pixel is represented by 8 bits. The size of an RGB image is (24 × w × h) bits. After grouping data into 256-bit blocks, the number of blocks can be calculated as follows:

[0110]

[0111] Step 503: Generate a transformation rule set Trans={R1,R2,…R32} containing 32 linear Moore nearest neighbor rules with a period of 16;

[0112] Step 504: Perform encryption using the encryption strategy for the image block sequence to obtain the block encryption sequence CB1~CBn;

[0113] Parallel encryption of each image block sequence can be achieved through a block encryption strategy, such as... Figure 6 As shown, encrypting each image group sequence includes the following steps:

[0114] Step 601: Randomly generate a 256-bit binary sequence as the key k;

[0115] Step 602: Generate a group number Ni with a length of 32 bits. Repeat the group number Ni corresponding to the q-th image group sequence PBq 8 times to obtain a group number sequence with a length of 256 bits corresponding to PBq.

[0116] Step 603: XOR the key k with the block number sequence of the qth block to obtain the subkey skq for encrypting PBq;

[0117] Step 604: XOR the subkey skq with the q-th block sequence PBq, and use the XOR result as the input for the first round of encryption;

[0118] The image block sequence is further scrambled by XORing the subkey with the image block sequence, which increases the obfuscation level of the encrypted image ciphertext sequence.

[0119] Step 605: According to the transformation rule selection mechanism, select 5 transformation rules from the transformation rule set Trans to encrypt the q-th block sequence;

[0120] In the first round of encryption, the XOR result of PBq and skq is used as the input sequence, and the subkey skq is used as the round key for the first round of encryption.

[0121] When i≥2, during the i-th round of encryption, the result of the (i-1)-th round of encryption is used as the input sequence. The input sequence is evolved j times using the transformation rule. The number of evolutions j is determined by the number represented by the lower four binary bits of the i-th round key in the subkey sk. However, when the number represented by the four binary bits is 0, the number of evolutions is 1. Since the period of the transformation rule is 16, the number that can be represented by the four binary bits is 0~15. Therefore, the number of evolutions in the i-th round is determined by the lower four binary bits in the round key.

[0122] When i < 5, after the i-th round of encryption, the subkey sk is shifted two positions to the left in a circular motion to obtain the key for the (i+1)-th round.

[0123] After the fifth round of encryption, the block encryption sequence CBq of the image block sequence PBq is obtained.

[0124] Step 505: Combine the grouped encryption sequences in their original order to obtain the encrypted pixel mixture sequence H2;

[0125] Step 506: Arrange the encrypted pixel mixing sequence H2 in the order of red, green, and blue, and then separate them to obtain the encrypted color channel ciphertext sequences of the red channel, green channel, and blue channel respectively;

[0126] Step 507: Combine the three color channel ciphertext sequences to form the image ciphertext sequence.

[0127] For the steps to decrypt the image ciphertext sequence, please refer to steps 401 and 402.

[0128] like Figure 7 As shown, Figure 7 (a) is a plaintext image of size 512×512, baboon. Figure 7 (b) is a plaintext image of plane with a size of 256×256, and the image ciphertext sequences of baboon and plane are respectively.

[0129] After the experimental images are encrypted using the encryption method described in the embodiments of this application, the encryption effect of the three ciphertext images is shown in the following figures. Figure 7 (d) Figure 7 As shown in (e), it can be seen from the encrypted image that, visually, the encryption method described in the embodiments of this application effectively hides the original image data information. (The remaining text appears to be incomplete and requires further context.) Figure 7 (d) Figure 7 (e) After decryption using the decryption algorithm, the resulting plaintext image is as follows: Figure 7 (g) Figure 7 As shown in (h), reversible encryption is achieved.

[0130] For example, the histograms of the RGB color channels in the plaintext image baboon and the corresponding color channels in the ciphertext image sequence are compared. Figure 8 As shown, where, Figure 8 (a) Figure 8 (b) Histograms of the red, green, and blue channels in the Baboon plaintext image, respectively. Figure 8 (d) Figure 8 (e) are histograms of the red, green, and blue channels in the baboon ciphertext image sequence, respectively. The x-axis of the histogram represents the obtainable pixel values, and the y-axis represents the number of corresponding pixel values. Figure 8 As can be seen, the pixel distribution in the encrypted ciphertext image sequence is more uniform than that in the plaintext image, indicating that the encryption result has good obfuscation. Therefore, the encryption algorithm has a good resistance to statistical analysis.

[0131] Since the image is encrypted by dividing it into 256-bit blocks, and 32 rules with a period of 16 are selected from the linear Moore nearest neighbor rules for block encryption, and there are 224 linear Moore nearest neighbor rules with a period of 16, the possible arrangements of the selected rules are: For each group, a subkey for encryption is determined by a 32-bit group number and a 256-bit key. The subkey is used to determine the number of times each rule is evolved (i ≤ i ≤ 15). Each group is evolved i times using five rules. Therefore, for an RGB image of size w × h in this embodiment, its key space can be calculated as follows:

[0132]

[0133] in, To select the order of 32 rules from 224 eligible transformation rules, The number of possible values ​​for key k. The number of possible group ID values ​​is given. In this embodiment, the key space size is large enough to resist brute-force attacks, so the encryption algorithm is secure enough in key space analysis.

[0134] According to Shannon's theory, for a 24-bit color image (each color frequency is identified by 8 bits), the optimal entropy value for each color frequency is 8. For an ideal random image, its entropy value is very close to this upper bound.

[0135] As shown in Table 1, the entropy values ​​corresponding to each color channel of the plaintext and ciphertext image sequences are compared with those of ECA-based image encryption algorithms and chaotic system-based algorithms. It can be seen that the entropy values ​​of the three ciphertext image sequences are all close to 8, which is close to the optimal entropy value. The encrypted ciphertext image sequences have a high degree of randomness. Therefore, the encryption method described in this application can prevent attackers from obtaining useful information from images through statistical attack methods.

[0136] Table 1

[0137]

[0138] Since images generally have high redundancy and strong correlation between adjacent pixels, an effective encryption strategy can make adjacent pixels in a ciphertext image sequence have low correlation, with the correlation close to 0, which helps reduce the possibility of statistical attacks.

[0139] As shown in Table 2, the correlation between adjacent pixels in the horizontal, vertical, and diagonal directions of the image is analyzed. Taking a 512×512 RGB image (baboon) as an example, 30,000 pairs of adjacent pixels were randomly selected in each of the horizontal, vertical, and diagonal directions of both the plaintext and ciphertext image sequences for experiments. Table 2 shows the calculated pixel correlation coefficients for each direction of the image (baboon). It can be seen that in the encrypted ciphertext image sequence, the pixel correlation coefficient between adjacent pixels is close to 0. Therefore, the encryption method described in this application can effectively reduce the correlation between adjacent pixels in the image.

[0140] Table 2

[0141]

[0142] Table 3 uses "baboon" and "airplane" as examples to show the average values ​​of the number of pixels (NPCR) and normalized average intensity of change (UACI) in the ciphertext sequences obtained by encrypting the same plaintext image using keys differing by only one bit. The results in the table show that the NPCR and UACI values ​​obtained using the encryption method described in this application are very close to the ideal values ​​of 99.6094% and 33.4635%, respectively. Based on these experimental data, it can be concluded that the encryption method described in this application is sufficiently secure for differential analysis.

[0143] Table 3

[0144]

[0145] After encrypting the original plaintext image using key key, the original key is bit-flipped to obtain key key'. If decryption of the ciphertext sequence of the image encrypted by key key using key' fails, it indicates that the encryption method has high key sensitivity.

[0146] As shown in Table 4, taking Baboon as an example, column 4(a) represents the plaintext image, column 4(b) represents the ciphertext image sequence obtained after encryption using key key, and columns 4(c) and 4(d) represent the plaintext images obtained after decrypting the ciphertext images using key and key', respectively. It can be seen that even if the two keys differ by only one bit, it is impossible to decrypt the image encrypted with the original key key using key'. Therefore, the encryption method described in this application embodiment has high key sensitivity.

[0147] Table 4

[0148]

[0149] In addition, the image sequence to be encrypted is divided into groups, each group is encrypted in parallel, and then the encrypted group sequences are combined to form the final image ciphertext sequence, which improves the encryption efficiency.

[0150] See Figure 9 As shown, the apparatus used in this application includes an image sequence generation unit 901, a conversion rule selection unit 902, a key generation unit 903, and an encryption unit 904.

[0151] Image sequence generation unit 901 is used to generate an image sequence to be encrypted based on a plaintext image;

[0152] The conversion rule selection unit 902 is used to select N conversion rules with a period of T as a conversion rule set, where N≥2;

[0153] The key generation unit 903 is used to determine the key k based on a randomly generated binary sequence;

[0154] The encryption unit 904 is used to select M conversion rules from the conversion rule set to perform M rounds of encryption on the image sequence to be encrypted. The conversion rules used in each round of encryption are different, and the round key used in each round of encryption is different. The round key is determined according to the key k.

[0155] In the i-th round of encryption, the i-th transformation rule is used to evolve the i-th image sequence to be encrypted j times. The i-th image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption. The number of evolutions j is determined by the binary sequence in the i-th round key.

[0156] The image sequence generation unit 901 is further configured to: obtain the image ciphertext sequence corresponding to the plaintext image through the M rounds of encryption.

[0157] Furthermore, the key generation unit 903 is also used for:

[0158] Randomly generate an m-bit binary sequence;

[0159] The image sequence to be encrypted is grouped into m-bit groups to obtain L image group sequences;

[0160] The m-bit binary sequence is XORed with the numbers of the L image group sequences to obtain L subkeys that correspond one-to-one with the L image group sequences, and the L subkeys are used as the key k.

[0161] Furthermore, the encryption unit 904 is also used to: for the q-th image group sequence in the L image group sequences, in the i-th round of encryption, the number of evolutions of the i-th round image sequence to be encrypted is determined according to the i-th round key in the subkey corresponding to the q-th image group sequence.

[0162] Furthermore, Figure 9 The device shown may further include an XOR calculation unit for performing an XOR operation on the key k and the image group sequence, and using the XOR result as the input for the first round of encryption.

[0163] Furthermore, Figure 9 The device shown may further include a decryption unit, used to perform M rounds of decryption on the image ciphertext sequence according to the key k and the M transformation rules; wherein, in the i-th round of decryption, the i-th round image ciphertext sequence is evolved Tj times using the i-th transformation rule;

[0164] The decryption unit is also used to: obtain the plaintext image through the M rounds of decryption.

[0165] Furthermore, the image sequence generation unit 901 is also used to achieve pixel mixing between different color channels of the plaintext image by arranging pixels in different color channels of the plaintext image to obtain the image sequence to be encrypted.

[0166] Although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.

[0167] It should be understood that the steps described in the method embodiments of this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.

[0168] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server.

[0169] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0170] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0171] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method of image encryption, characterized by, The method includes: Generate an image sequence to be encrypted from a plaintext image; Select N transformation rules with a period of T as the transformation rule set, where N≥2; Randomly generate an m-bit binary sequence; The image sequence to be encrypted is grouped into m-bit groups to obtain L image group sequences; The m-bit binary sequence is XORed with the numbers of the L image group sequences to obtain L subkeys that correspond one-to-one with the L image group sequences, and the L subkeys are used as the key k. M transformation rules are selected from the set of transformation rules to perform M rounds of encryption on the image sequence to be encrypted, where M≤N. Each round of encryption uses a different transformation rule and a different round key, which is determined based on the key k. For the q-th image group sequence in the L image group sequences, in the i-th round of encryption, the number of evolutions of the image sequence to be encrypted in the i-th round is determined based on the i-th round key in the subkey corresponding to the q-th image group sequence. In the i-th round of encryption, the i-th transformation rule is used to evolve the i-th image sequence to be encrypted j times. The i-th image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption. The number of evolutions j is determined by the binary sequence in the i-th round key. Through the M rounds of encryption, the image ciphertext sequence corresponding to the plaintext image is obtained.

2. The method according to claim 1, characterized in that, Before performing the first round of encryption, the method further includes: The key k is XORed with the image group sequence, and the XOR result is used as the input for the first round of encryption.

3. The method according to claim 1, characterized in that, The method further includes: Based on the key k, the image ciphertext sequence is decrypted in M ​​rounds using the M transformation rules; wherein, in the i-th round of decryption, the i-th transformation rule is used to evolve the i-th round image ciphertext sequence Tj times. The plaintext image is obtained through the M rounds of decryption.

4. The method according to claim 1, characterized in that, The step of generating the image to be encrypted sequence based on the plaintext image includes: By arranging the pixels in different color channels of the plaintext image, the pixels of different color channels of the plaintext image are mixed to obtain the sequence of images to be encrypted.

5. An image encryption device, characterized in that, The device includes: An image sequence generation unit is used to: generate an image sequence to be encrypted based on a plaintext image; The conversion rule selection unit is used to: select N conversion rules with a period of T as a conversion rule set, where N≥2; A key generation unit is configured to: randomly generate an m-bit binary sequence; group the image sequence to be encrypted into L image group sequences by m bits; XOR the m-bit binary sequence with the numbers of the L image group sequences to obtain L subkeys corresponding one-to-one with the L image group sequences, and use the L subkeys as the key k. An encryption unit is configured to: select M conversion rules from the set of conversion rules to perform M rounds of encryption on the image sequence to be encrypted, where M≤N, each round of encryption uses a different conversion rule, and each round of encryption uses a different round key, the round key being determined based on the key k; for the q-th image group sequence among the L image group sequences, in the i-th round of encryption, the number of evolutions of the i-th round image sequence to be encrypted is determined based on the i-th round key among the subkeys corresponding to the q-th image group sequence; In the i-th round of encryption, the i-th transformation rule is used to evolve the i-th image sequence to be encrypted j times. The i-th image sequence to be encrypted is the encryption result of the (i-1)-th round of encryption. The number of evolutions j is determined by the binary sequence in the i-th round key. The image sequence generation unit is further configured to: obtain the image ciphertext sequence corresponding to the plaintext image through the M rounds of encryption.

6. The apparatus according to claim 5, characterized in that, The device further includes: The decryption unit is configured to: perform M rounds of decryption on the image ciphertext sequence using the M transformation rules according to the key k; wherein, in the i-th round of decryption, the i-th round image ciphertext sequence is transformed Tj times using the i-th transformation rule; The decryption unit is also used to: obtain the plaintext image through the M rounds of decryption.

7. The apparatus according to claim 5, characterized in that, The image sequence generation unit is also used for: By arranging the pixels in different color channels of the plaintext image, the pixels of different color channels of the plaintext image are mixed to obtain the sequence of images to be encrypted.