Image fast encryption method, device, equipment and storage medium

By combining two-dimensional chaotic mapping and gene encoding methods, the images are chaotic and encoded, encoding lookup tables are generated and XOR operations are performed, which solves the problem of insufficient security in image encryption by traditional encryption algorithms and achieves higher security and diffusion.

CN120111151BActive Publication Date: 2025-08-12HUNAN INSTITUTE OF ENGINEERING
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510204680.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-24
Publication Date
2025-08-12
Estimated Expiration
2045-02-24

AI Technical Summary

Technical Problem

Traditional encryption algorithms cannot effectively meet the needs of image encryption, especially when considering the redundancy of images and insufficient security in two-dimensional structure.

Method used

The combination of two-dimensional chaotic mapping and gene encoding is used to scramble and encode plain text images, and encrypt them by generating coding lookup tables and XOR operations to increase data complexity and randomness.

Benefits of technology

Improves the security and diffusion of image encryption and enhances the ability to fight attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120111151B_ABST
    Figure CN120111151B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, device and storage medium for fast image encryption, which relates to the field of image encryption technology. The method comprises: performing a two-dimensional chaotic mapping on a plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and generating a coding lookup table based on a preset second key; genetically encoding the scrambled image through dynamic coding to obtain a preliminary coded image; searching and replacing each code in the preliminary coded image in the coding lookup table to obtain a replaced preliminary obfuscated image; traversing each target element in the preliminary obfuscated image starting from the second bit in the preliminary obfuscated image, performing an XOR operation on the target element and the element preceding the target element to obtain a ciphertext matrix after encrypting the plaintext image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image encryption technology, and in particular to a method, apparatus, device and storage medium for fast image encryption. Background Art

[0002] With the popularization of the Internet and smartphones, information security issues have become increasingly prominent. This is especially true during image transmission. As digital images are an important carrier of information exchange, ensuring their transmission security is crucial. Therefore, image encryption technology has become the key to protecting image security.

[0003] Traditional encryption algorithms include DES (Data Encryption Standard), RSA (an encryption algorithm) and AES (Advanced Encryption Standard). Traditional encryption algorithms cannot meet the needs of image encryption because they do not consider the redundancy of images, large data volume and two-dimensional structure.

[0004] Therefore, how to improve the security of image encryption is a technical problem that needs to be solved urgently.

[0005] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art. Summary of the Invention

[0006] The main purpose of this application is to provide a method, device, equipment and storage medium for fast image encryption, aiming to solve the technical problem of how to improve the security of image encryption.

[0007] To achieve the above objectives, the present application proposes a method for fast image encryption, which includes:

[0008] Performing a two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and generating a coding lookup table based on a preset second key;

[0009] Genetically encoding the scrambled image through dynamic encoding to obtain a preliminary encoded image;

[0010] Searching and replacing each code in the preliminary coded image in the code lookup table to obtain a preliminary obfuscated image after replacement;

[0011] Starting from the second bit in the preliminary obfuscated image, each target element in the preliminary obfuscated image is traversed, and an XOR operation is performed on the target element and the element before the target element to obtain a ciphertext matrix after encrypting the plaintext image.

[0012] In one embodiment, the step of performing two-dimensional chaotic mapping on the plaintext image to be encrypted based on the preset first key to obtain a scrambled image includes:

[0013] Obtaining a current number of split rounds, and determining a target value for a target number of bits in the first key, wherein the target number of bits corresponds to the current number of split rounds;

[0014] Splitting the plaintext image into two sub-images along a diagonal direction based on the number of segmentation rounds;

[0015] For each of the sub-images, dividing the sub-image into at least one pixel set, wherein the pixel set includes two columns of adjacent sub-pixel sets;

[0016] For each group of the pixel sets, determining each short pixel in the shorter sub-pixel set among the adjacent sub-pixel sets and each long pixel in the longer sub-pixel set among the adjacent sub-pixel sets, and sequentially inserting each of the short pixels between each of the long pixels to obtain an intermediate image;

[0017] Connecting pixels in the intermediate image according to a preset connection rule to obtain an intermediate image;

[0018] Using the intermediate image as a new plaintext image, returning to the step of dividing the plaintext image into two sub-images along a diagonal direction based on the target value until the number of divisions equals the target value, and updating the number of division rounds;

[0019] Return to the step of obtaining the current number of segmentation rounds until the number of segmentation rounds is equal to the length of the first key, and use the current intermediate image as the scrambled image.

[0020] In one embodiment, the step of dividing the plaintext image into two sub-images along a diagonal direction based on the number of division rounds includes:

[0021] If the number of segmentation rounds is an odd number, the plaintext image is segmented into two sub-images diagonally from the upper left to the lower right;

[0022] If the number of segmentation rounds is an even number, the plaintext image is segmented into two sub-images along a diagonal direction from the upper right to the lower left.

[0023] In one embodiment, the step of generating a coding lookup table based on a preset second key includes:

[0024] generating an initial array of a preset size, and performing a two-dimensional chaotic mapping on the initial array based on the last four bits of the second key to obtain a scrambled array;

[0025] Genetically encoding the scrambled array according to a preset encoding rule to obtain an encoding matrix;

[0026] The encoding lookup table is obtained by defining the row and column indexes of the encoding matrix according to a preset index rule.

[0027] In one embodiment, the step of genetically encoding the scrambled image by dynamic encoding to obtain a preliminary encoded image includes:

[0028] Starting from the second bit in the scrambled image, each target pixel value in the scrambled image is traversed, and based on the pixel value of the previous bit of the target pixel value, the target pixel value is updated until the last pixel value in the scrambled image is traversed to obtain the preliminary encoded image.

[0029] In one embodiment, after the step of obtaining the ciphertext matrix after encrypting the plaintext image, the method further includes:

[0030] Decoding the first bit in the ciphertext matrix based on the second key to obtain a decoded pixel value of the first bit;

[0031] Starting from the second bit of the ciphertext matrix, each target ciphertext in the ciphertext matrix is traversed, and the pixel value of the target ciphertext is calculated based on the pixel value of the ciphertext before the target ciphertext is decoded to obtain the plaintext image after the ciphertext matrix is decoded.

[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a fast image encryption device, which includes:

[0033] An initialization module is used to perform a two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and to generate a coding lookup table based on a preset second key;

[0034] A preliminary encoding module, configured to perform genetic encoding on the scrambled image through dynamic encoding to obtain a preliminary encoded image;

[0035] A preliminary obfuscation module, configured to search and replace each code in the preliminary coded image in the code lookup table to obtain a replaced preliminary obfuscated image;

[0036] The encryption module is configured to traverse each target element in the preliminary obfuscated image starting from the second bit in the preliminary obfuscated image, perform an XOR operation on the target element and the element preceding the target element, and obtain a ciphertext matrix after encrypting the plaintext image.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored on the memory and runnable on the processor, wherein the computer program is configured to implement the steps of the image fast encryption method as described above.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium, and when the computer program is executed by the processor, the steps of the image fast encryption method described above are implemented.

[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the image fast encryption method as described above.

[0040] The present application provides a method for fast image encryption. The present application first performs a two-dimensional chaotic mapping on a plaintext image using a first key to obtain a scrambled image, and generates a coding lookup table based on a second key. The scrambled image is then genetically encoded to obtain a preliminary coded image. The new codes corresponding to the codes in the preliminary coded image are then sequentially searched in the coding lookup table and replaced to obtain a replaced preliminary obfuscated image. Finally, each target element is traversed starting from the second position in the obfuscated image, the target element is XORed with the element before the target element, and the target element is replaced with the budget result. After the traversal is completed, the ciphertext matrix after the plaintext image is encrypted can be obtained.

[0041] In summary, this application integrates the two-dimensional chaotic mapping algorithm with the genetic coding algorithm. Compared with traditional encryption algorithms, this application increases the complexity and randomness of the data by permuting and genetically encoding the plaintext image, and based on the XOR operation with adjacent elements, improves the diffusibility of the encryption, thereby improving the security of image encryption. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0044] Figure 1 A flowchart of the first embodiment of the image fast encryption method of the present application is provided;

[0045] Figure 2 A schematic diagram of the mapping process provided in an embodiment of the image fast encryption method of the present application;

[0046] Figure 3 A schematic diagram of the encryption and decryption effects provided by an embodiment of the image fast encryption method of this application;

[0047] Figure 4 The histogram of the plaintext image and the ciphertext image provided in the embodiment of the fast image encryption method of this application;

[0048] Figure 5 This is a schematic diagram of the module structure of the image fast encryption device according to an embodiment of the present application;

[0049] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the image fast encryption method in the embodiment of the present application.

[0050] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0051] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.

[0052] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0053] The main solution of the embodiment of the present application is: based on a preset first key, a two-dimensional chaotic mapping is performed on the plaintext image to be encrypted to obtain a scrambled image, and a coding lookup table is generated based on a preset second key; the scrambled image is genetically encoded through dynamic coding to obtain a preliminary coded image; each code in the preliminary coded image is searched and replaced in the coding lookup table to obtain a replaced preliminary obfuscated image; starting from the second bit in the preliminary obfuscated image, each target element in the preliminary obfuscated image is traversed, and the target element is XORed with the element before the target element to obtain a ciphertext matrix after encrypting the plaintext image.

[0054] In this embodiment, for ease of description, the electronic device is used as the execution subject for explanation.

[0055] With the popularization of the Internet and smartphones, information security issues have become increasingly prominent. This is especially true during image transmission. As digital images are an important carrier of information exchange, ensuring their transmission security is crucial. Therefore, image encryption technology has become the key to protecting image security.

[0056] Traditional encryption algorithms include DES (Data Encryption Standard), RSA (an encryption algorithm) and AES (Advanced Encryption Standard). Traditional encryption algorithms cannot meet the needs of image encryption because they do not consider the redundancy of images, large data volume and two-dimensional structure.

[0057] Therefore, how to improve the security of image encryption is a technical problem that needs to be solved urgently.

[0058] In response to the above problems, the present application provides a method for fast image encryption. The present application first performs a two-dimensional chaotic mapping on the plaintext image using a first key to obtain a scrambled image, and generates a coding lookup table based on a second key. The scrambled image is then genetically encoded to obtain a preliminary coded image. The new codes corresponding to each code in the preliminary coded image are then searched in the coding lookup table in turn, and replaced to obtain a replaced preliminary obfuscated image. Finally, each target element is traversed starting from the second bit in the obfuscated image, and the target element is XORed with the previous element of the target element. The target element is replaced with the budget result. After the traversal is completed, the ciphertext matrix after the plaintext image encryption can be obtained.

[0059] In summary, this application integrates two-dimensional chaotic mapping with genetic coding algorithm. Compared with traditional encryption algorithms, this application increases the complexity and randomness of data by permuting and genetic coding the plaintext image, and based on the XOR operation with adjacent elements, improves the diffusibility of encryption, thereby improving the security of image encryption.

[0060] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, mobile phone, etc., or an electronic device capable of performing the above functions. The following uses electronic devices as an example to illustrate this embodiment and the following embodiments.

[0061] Based on this, the embodiment of the present application provides a method for fast image encryption, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the image fast encryption method of the present application.

[0062] In this embodiment, the image fast encryption method includes steps S10 to S50:

[0063] Step S10, performing two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and generating a coding lookup table based on a preset second key;

[0064] It should be noted that, in this embodiment, both the first key and the second key can be set according to actual conditions and are not further limited in this embodiment.

[0065] In this embodiment, a two-dimensional chaotic mapping is first performed on the plaintext image to be encrypted using a preset first key. This mapping produces complex, pseudo-random positional transformations, ensuring a more random distribution of image pixel positions, significantly improving image security. The resulting scrambled image has pixel positions significantly different from those of the original plaintext image. Simultaneously, a code lookup table is generated based on a preset second key. This lookup table is used for code replacement in subsequent steps, ensuring both the complexity and security of the encryption process.

[0066] Furthermore, in a feasible implementation manner, the step of performing two-dimensional chaotic mapping on the plaintext image to be encrypted based on the preset first key in the above step S10 to obtain a scrambled image includes steps A10 to A70:

[0067] Step A10, obtaining the current number of split rounds, and determining a target value for a target number of bits in the first key, wherein the target number of bits corresponds to the current number of split rounds;

[0068] In this embodiment, when scrambling the plaintext image, the current number of segmentation rounds is first obtained, which is initially 1, and then the target value on the target bit number corresponding to the number of segmentation rounds is determined in the first key. For example, in the first round of segmentation, the target value is the value of the highest bit in the first key.

[0069] It should be noted that, in this embodiment, the most significant bit in the first key is used as the first bit, and the bits in the first key are arranged in order from high to low.

[0070] Step A20: dividing the plaintext image into two sub-images along a diagonal direction based on the target value;

[0071] In this embodiment, after determining the target value from the first key, the plaintext image is then split diagonally into two sub-images based on the characteristics of the target value. This splitting ensures that different parts of the image are processed in a non-standard, nonlinear manner, thereby increasing encryption complexity and accelerating image scrambling.

[0072] Furthermore, in a feasible implementation manner, the above-mentioned step A20 may include steps A21 to A22:

[0073] Step A21: If the number of segmentation rounds is an odd number, the plaintext image is segmented into two sub-images along a diagonal direction from the upper left to the lower right;

[0074] In this embodiment, when scrambling an image, the image may be segmented multiple times in a loop. Therefore, when segmenting the image, it is necessary to first determine the current number of segmentation rounds, determine the parity of the current number of rounds, determine whether it is left-mapping or right-mapping, and then receive a preset first key. Next, the target value for the number of bits in the current number of segmentation rounds is determined from the first key. For example, if the current number of segmentation rounds is , then the value of the third bit from high to low is determined in the first key. The parity of this bit determines the direction of the current scrambled image segmentation, thereby introducing key-based randomness. If the number of segmentation rounds is odd, the plaintext image is segmented into two sub-images along a diagonal line from the upper left to the lower right. This segmentation method ensures that different parts of the image are processed in a non-standard manner, increasing the complexity of encryption.

[0075] Step A22: If the number of segmentation rounds is an even number, the plaintext image is segmented into two sub-images along a diagonal direction from the upper right to the lower left.

[0076] In this embodiment, if the number of segmentation rounds is an even number, the device adopts a segmentation method opposite to step A21, that is, the plaintext image is segmented into two sub-images along the diagonal direction from the upper right to the lower left.

[0077] Step A30: for each sub-image, divide the sub-image into at least one pixel set, wherein the pixel set includes two adjacent columns of sub-pixel sets;

[0078] In this embodiment, each sub-image is further subdivided into at least one group of pixel sets, each group of pixel sets contains two adjacent columns of sub-pixel sets, and the two columns of sub-pixel sets may be different in length. Since each sub-image is a group of isosceles right triangles, there is a difference between two adjacent columns of pixels in the sub-image. Based on this difference, the pixels can be interspersed.

[0079] Step A40: for each group of the pixel sets, determining each short pixel in the shorter sub-pixel set of the adjacent sub-pixel sets and each long pixel in the longer sub-pixel set of the adjacent sub-pixel sets, and sequentially inserting each of the short pixels between each of the long pixels to obtain an intermediate image;

[0080] In this embodiment, for each group of pixel sets, the short pixels in the shorter sub-pixel set and the long pixels in the longer sub-pixel set of adjacent sub-pixel sets are determined. Then, the short pixels are inserted in sequence between the long pixels to form a new pixel arrangement. This step further increases the complexity of the image by changing the original order and adjacent relationship of the pixels.

[0081] Step A50, connecting the pixels in the intermediate image according to a preset connection rule to obtain an intermediate image;

[0082] Step A60: Use the intermediate image as a new plaintext image and return to the step of dividing the plaintext image into two sub-images in the diagonal direction based on the number of division rounds until the number of divisions is equal to the target value, and then update the number of division rounds.

[0083] In this embodiment, after completing the insertion operation of all pixel sets, an intermediate matrix is obtained. Then, the pixels in the intermediate matrix are connected according to a preset connection rule (the connection rule can be a predefined algorithm) to obtain a scrambled intermediate image. Then, using the intermediate image as a new plaintext image, the process returns to execute steps A20-A50 and re-segmentation is performed until the number of segmentations is equal to the target value of the number of bits corresponding to the current round number in the first key, completing a round of segmentation. When a round of segmentation is completed, the number of segmentation rounds is increased by one.

[0084] Step A70: Return to the step of obtaining the current number of segmentation rounds until the number of segmentation rounds is equal to the length of the first key, and use the current intermediate image as the scrambled image.

[0085] In this embodiment, after the number of segmentation rounds is updated, the process returns to steps A10-A60 until the number of segmentation rounds is equal to the length of the first key. The current intermediate image is the final scrambled image.

[0086] As an example, use key key1 to perform a two-dimensional chaotic mapping on the image:

[0087] key_str = str(key1);

[0088] Starting from the highest digit of the key key1, odd digits correspond to left mapping, even digits correspond to right mapping, and each digit corresponds to the number of mapping iterations. The plaintext image P is iterated alternately through the left and right mapping formulas to obtain the scrambled image P1.

[0089] Specifically, assume a grayscale image of size N×N. Chaotic mapping is implemented using a stretching and folding operation. The image is divided into two isosceles right triangles along the diagonal direction. Using the length difference between each column of the isosceles right triangle and the adjacent column, the pixels of the shorter column are inserted between the two pixels of the adjacent longer column. This process is repeated, connecting them in a specific way, and the image can be stretched into a straight line. Finally, it is folded into a scrambled image.

[0090] For example, see Figure 2 , Figure 2 This is a schematic diagram of the mapping process involved in the embodiment of the present application. The left mapping of the image array of size 4×4 is as follows: Figure 2As shown, N = 4. First, the image is divided into two isosceles right triangles along the diagonal line from the upper left to the lower right. The pixels in the shorter columns of the two parts are inserted between the two pixels in the longer columns: pixel (0,0) is inserted between (0,1) and (1,1), pixel (0,2) is inserted between (0,3) and (1,3), pixel (1,2) is inserted between (1,3) and (2,3), and so on. Repeat the operation for each part. The image is then stretched to a straight line, and finally folded and projected into a new image.

[0091] The scrambled image obtained after mapping can be expressed by the formula. Specifically, let the grayscale image size be N×N, let C(i,j), i,j=0,1,…,N-1, be the pixel value of the i-th row and j-th column in the image array, let l(i), i=0,1,…,N 2 -1 is the stretched one-dimensional array. The mapping is divided into left mapping and right mapping, and the formula is as follows:

[0092] Left mapping algorithm:

[0093] When i>j and j is an even number, the formula is:

[0094]

[0095] When i>j and j is an odd number, the formula is:

[0096]

[0097] When j≥i and Nj is an odd number, the formula is:

[0098]

[0099] When j≥i and Nj is an even number, the formula is:

[0100]

[0101] Right mapping algorithm:

[0102] Mirror the original image and set A(i,j), i,j=0,1,…,N-1. The formula is:

[0103] A(i,j)=C(i,N-1-j);

[0104] The right mapping algorithm can be obtained through the left mapping.

[0105] Furthermore, in a feasible implementation manner, the step of generating a coding lookup table based on the preset second key in the above step S10 may include steps B10 to B30:

[0106] Step B10: generating an initial array of a preset size, and performing a two-dimensional chaotic mapping on the initial array based on the last four bits of the second key to obtain a scrambled array;

[0107] In this embodiment, an initial array of a preset size is first generated. The size of this array is usually determined based on encryption requirements and security requirements. Then, the device performs a two-dimensional chaotic mapping on the initial array using the last four bits of the second key.

[0108] Step B20, performing genetic encoding on the scrambled array according to a preset encoding rule to obtain an encoding matrix;

[0109] In this embodiment, after obtaining the scrambled array, the device performs genetic encoding on it according to a preset encoding rule.

[0110] Step B30: Define the row and column indexes of the encoding matrix according to a preset index rule to obtain an encoding lookup table.

[0111] In this embodiment, finally, the device defines the row and column indexes of the coding matrix according to a preset index rule, thereby generating a coding lookup table.

[0112] As an example, first generate the initial matrix array, generate the matrix array K:

[0113] K=np.arange(256).reshape(16,16);

[0114] Where: np.arrange() is a function that generates a one-dimensional array, and the value of each bit in the array is its index value; reshape() is a function that reshapes it into a two-dimensional array.

[0115] Use the last 4 bits of the key key2 to perform a two-dimensional chaotic mapping scrambling on the K array, obtaining the scrambled array K1. DNA encode the values in the K1 array according to the rule rule = mod (key2, 8) + 1 in Table 1 to obtain the encoding matrix K2. Customize the row and column indexes of the encoding matrix to obtain the encoding lookup table K3:

[0116] K3=pd.DataFrame(K2,index=indices,index=indices)

[0117] Where: mod() is the modulo function; pd.DataFrame() is the function that customizes the row and column indexes of the array, and indices is the row and column index values: which are the pairwise matching values of the four bases.

[0118] Specifically, DNA is composed of four deoxynucleotides: adenine (A), cytosine (C), guanine (G), and thymine (T). The chemical structure of the bases determines the principle of base complementary pairing. If the bases are represented by 2-bit binary numbers, the operation and arrangement of the bases can store binary information. A grayscale image pixel can be represented as an 8-bit binary value, which can be converted into four bases for calculation using the eight encoding rules in Table 1. Table 2 shows the rules for DNA XOR operations. However, traditional DNA encoding and calculation rules are fixed, which makes DNA encoding less resistant to exhaustive attacks and has certain security flaws.

[0119]

[0120] Table 1 DNA coding rules

[0121]

[0122] Table 2 DNA XOR rules

[0123] In this embodiment, an improved image encryption technique based on a DNA-encoded lookup table is proposed. A lookup table is generated using a Python system random number function and base substitution is performed, with the row and column indices of the lookup table being independent DNA codes. The image pixel value encoding is then decomposed into row and column coordinates, and base substitution is performed after the lookup. Although this technique enhances the randomness of the algorithm by randomly replacing the DNA code, the lookup table has a small range, making it difficult to resist exhaustive attacks. When the seed setting is not random enough, the generated lookup table may have poor quality and consistency across different platforms. To address these issues, this paper designs a method for generating a DNA-encoded lookup table of size [ ] using a new scrambling algorithm, effectively enhancing the algorithm's security. First, an initial array is generated, scrambled using a two-dimensional chaotic map, and DNA encoding is performed on the array. Pairwise combinations of DNA are defined as row and column indices to form a DNA lookup table. For example, using 1334 as the scrambling key for the two-dimensional chaotic map, the initial array is scrambled and converted into a matrix [ ] as shown in Table 3.

[0124] 52 123 ... 85 163 48 ... 84 ... ... ... ... 30 206 ... 49

[0125] Table 3 Random Permutation Matrix DNA encoding is performed on the matrix using Rule 5 in Table 1 to obtain the lookup table, as shown in Table 4.

[0126]

[0127] Table 4 Lookup table

[0128] For example, to encode pixel value 30, we first perform the original DNA encoding according to Rule 5, obtaining CATG. With CA as the row index and TG as the column index, we perform a lookup in the lookup table to obtain TCAT. Therefore, CATG is replaced with TCAT. Similarly, to encode pixel value 41, we obtain GTGC. A DNA XOR operation is performed on the two codes, TCAT and GTGC, resulting in CTGG. Decoding using Rule 2 yields 181, completing the pixel diffusion. The lookup table can flexibly adapt to different DNA encoding rules and computational requirements, enhancing the algorithm's versatility and security.

[0129] Step S20, performing genetic encoding on the scrambled image through dynamic encoding to obtain a preliminary encoded image;

[0130] In this embodiment, after the scrambled image is obtained, the scrambled image is genetically encoded using a dynamic encoding method. Dynamic encoding can ensure that each pixel value is associated with the previous pixel value during the conversion process, which further increases the diffusibility of encryption.

[0131] Furthermore, in a feasible implementation manner, the above step S20 may include step S21:

[0132] Step S21, starting from the second bit in the scrambled image, traverse each target pixel value in the scrambled image, and update the target pixel value based on the previous pixel value of the target pixel value until traversing to the last pixel value in the scrambled image to obtain the preliminary encoded image.

[0133] In this embodiment, the second pixel value in the scrambled image is first located. This is because in some encryption strategies, the first pixel value of the image may be retained or specially processed. Starting from the second pixel value ensures the continuity and consistency of the encryption process. Starting from the second pixel value, each target pixel value in the scrambled image is traversed in sequence. For each target pixel value, the target pixel value is updated based on its previous pixel value.

[0134] As an example, the scrambled image P1 is encoded using DNA. The encoding rule adopts a dynamic encoding method, which depends on the pixel value of the previous bit:

[0135] rule=mod(P1[prev_i,prev_j],8)+1,if i! =0and j! =0;

[0136] rule=mod(key2,8)+1,if i==0and j==0;

[0137] Where: P1[prev_i,prev_j] is the previous pixel value.

[0138] The preliminary coded image P2 is obtained.

[0139] Step S30, searching and replacing each code in the preliminary coded image in the code lookup table to obtain a preliminary obfuscated image after replacement;

[0140] In this embodiment, each code in the preliminary coded image is searched and replaced in the code lookup table, and the image information is further obfuscated by replacing the code, thereby increasing the complexity of encryption.

[0141] Specifically, as an example, the codes in the P2 array are searched and replaced in the code lookup table K3, with the row index being the first two digits and the column index being the last two digits, to obtain the replaced array P3.

[0142] Step S40 , traversing each target element in the preliminary obfuscated image starting from the second bit in the preliminary obfuscated image, performing an XOR operation on the target element and the element preceding the target element, to obtain a ciphertext matrix after encrypting the plaintext image.

[0143] It should be noted that, in this embodiment, the XOR operation is an effective encryption method, which can further obfuscate image information and improve the security of encryption.

[0144] In this embodiment, each target element in the image is traversed starting from the second bit of the preliminary obfuscated image. For each target element, an XOR operation is performed between it and the previous element, and the result of the XOR operation replaces the current target element. Then, the process traverses to the next element until all elements are traversed, thereby obtaining the final ciphertext matrix, i.e., the encrypted image.

[0145] Specifically, as an example, a DNA XOR operation is performed on each base pair of P3 and the previous base in its array position, and the first base is not processed, to obtain image P4:

[0146] P4[i,j]=P3[i,j]XOR P3[prev_i,prev_j],if i! =0andj! =0;

[0147] P4[i,j]=P3[i,j], if i==0and j==0;

[0148] This application integrates the quadratic obfuscation algorithm with the genetic coding algorithm. Compared with traditional encryption algorithms, this application increases the complexity and randomness of the data by permuting and genetically encoding the plaintext image, and improves the diffusibility of the encryption based on the XOR operation with adjacent elements, thereby improving the security of image encryption.

[0149] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be repeated hereafter. On this basis, after the above step S40, the method may further include steps S50 to S60:

[0150] Step S50, decoding the first bit in the ciphertext matrix based on the second key to obtain a decoded pixel value of the first bit;

[0151] In this embodiment, the encrypted ciphertext matrix and the second key are first received. Then, the first bit in the ciphertext matrix is decoded based on the second key. This decoding process involves a specific algorithm or function that utilizes certain characteristics of the second key or a result after specific processing to restore the original pixel value of the first bit in the ciphertext matrix. The function can be set according to actual needs.

[0152] Step S60 , starting from the second bit of the ciphertext matrix, traverse each target ciphertext in the ciphertext matrix, calculate the pixel value of the target ciphertext based on the pixel value of the decoded ciphertext of the previous bit of the target ciphertext, and obtain the plaintext image after decoding the ciphertext matrix.

[0153] In this embodiment, after obtaining the pixel value after decoding the first bit, each target ciphertext is traversed starting from the second bit of the ciphertext matrix. For each target ciphertext, the pixel value of the target ciphertext is calculated based on the pixel value after decoding the previous ciphertext.

[0154] Specifically, as an example, DNA decoding is performed on P4 to obtain the ciphertext image P5. The decoding rule for each bit is:

[0155] rule=mod(P5[prev_i,prev_j],8)+1,if i! =0andj! =0;

[0156] rule=mod(key2,8)+1,if i==0and j==0;

[0157] Where: P5[prev_i,prev_j] is the decoded pixel value of the previous bit.

[0158] Furthermore, in order to verify the performance of the above algorithm, the experiment uses four classic images: Lena, Baboon, Cameraman and Peppers for analysis. The experiment uses key1 = 1234567890123456 and key2 = 123456789 as the keys. The encryption and decryption effects are as follows: Figure 3As shown in the figure, the ciphertext image has no visual features and appears as a random noise distribution. No information about the plaintext image can be obtained, which shows that the encryption algorithm has an excellent encryption effect; the decrypted image is no different from the plaintext image, indicating that the algorithm has no loss in the encryption and decryption process.

[0159] In key space analysis and key sensitivity, the key space is the set of all possible keys that can be used in an image encryption algorithm. The security of the algorithm is closely related to the key space. The premise of an excellent encryption algorithm is to have a large key space. In the image encryption algorithm, when the key space is larger than 2 100 Only when the key length is longer can it resist brute force attacks. Experiments show that the longer the key length, the larger the key space. The key space of the encryption algorithm is far greater than 2 100 , indicating that the encryption algorithm has strong resistance to brute force attacks.

[0160] Key sensitivity is a key performance metric for encryption algorithms, used to assess the degree to which the key affects the encryption result. An encryption algorithm with strong key sensitivity should produce significant changes in the generated ciphertext when the key changes slightly. High key sensitivity effectively resists attacks and ensures data security.

[0161] For the Lena secret image encrypted with keys key1=1234567890123456 and key2=123456789, when decrypted with key1=1234567890123457 and key2=123456789 and with key1=123456789012345 and key2=123456788, even if the encryption key differs from the decryption key by only one key bit, the image cannot be decrypted correctly at all, indicating that the encryption algorithm is highly sensitive to the key.

[0162] A histogram graphically displays statistical data about image pixels, providing a visual representation of the distribution of grayscale values within an image. The histogram of an original image typically exhibits distinct statistical characteristics, as shown in the figure below. Statistical analysis allows attackers to compare the encrypted image with its statistical patterns and infer the transformation relationship between the original and encrypted images. To increase the difficulty of statistical attacks, the histogram of the encrypted image must maintain a relatively uniform distribution. Figure 4 The pixel histograms of the plaintext image and its ciphertext image are displayed. The experimental results show that the pixel value distribution of the plaintext image is not uniform and has certain distribution characteristics, while the pixel values of the ciphertext image are uniformly distributed and it is difficult to observe their patterns and characteristics. This shows that it is difficult for attackers to obtain effective information from the encrypted image, and it can effectively resist statistical attacks.

[0163] In image encryption, information entropy can represent the distribution of pixel values. The more uniform the grayscale distribution of an encrypted image, the higher the randomness and security of the image, and the closer the image's information entropy is to the maximum entropy value of 8.

[0164] The calculation formula of information entropy is as follows:

[0165]

[0166] Where: Y is the grayscale image, p(y i ) is the value y in image Y i The probability of n being the number of possible grayscale values.

[0167] The experiment calculated the information entropy of four images before and after encryption, and the results are shown in Table 5. The experimental results show that the information entropy of the ciphertext images is very close to the ideal value of 8. Therefore, the privacy of the ciphertext images is strong, the amount of information contained in the images is very small, and they can effectively resist statistical attacks.

[0168]

[0169] Table 5 Information entropy of plaintext image and ciphertext image

[0170] The correlation between adjacent pixels is one of the important criteria for evaluating the performance of image encryption algorithms. In the original image, the correlation between adjacent pixels is very high, which may cause the leakage of one pixel to lead to the inference of surrounding pixels. To resist attacks, an excellent encryption method should destroy the correlation of pixels in the original image. The correlation measurement usually includes the correlation coefficient in the horizontal, vertical and diagonal directions. Generally speaking, the correlation between adjacent pixels in the original image is close to 1, while the correlation between adjacent pixels in the encrypted image should be close to 0. The calculation formula is as follows:

[0171]

[0172] Where x and y are the grayscale values of two adjacent pixels; N is the number of adjacent pixels; R xy is the correlation coefficient; E(x) is the expected value; D(x) is the variance; cov(x,y) is the covariance.

[0173] Table 6 shows the horizontal, vertical, and diagonal correlation coefficients of the four images. The results show that the correlation coefficients of the plaintext images in the three directions are very high, while the correlation coefficients of the ciphertext images are very low, very close to 0. This indicates that the correlation between the plaintext images and the ciphertext images has been significantly reduced, which is conducive to resisting statistical attacks and greatly improves the security of the algorithm.

[0174]

[0175] Table 6 Correlation coefficients between plaintext images and ciphertext images

[0176] In addition, in the scrambling stage, this embodiment calls a two-dimensional chaotic map according to the key key1 for scrambling. Let L be the number of bits of key1, and the time complexity is θ(9L×N 2 The time complexity of DNA encoding operation is θ(3×N 2 ), the time complexity of DNA decoding is θ(N 2 ). The time complexity of the entire encryption algorithm is θ((9L+4)×N 2 Since DNA computing has high parallelism, the speed of encryption algorithms can be further improved.

[0177] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the image fast encryption method of the present application. More forms of simple transformations based on this technical concept are all within the scope of protection of the present application.

[0178] This application also provides a fast image encryption device, please refer to Figure 5 , the image fast encryption device includes:

[0179] Initialization module 10, used for performing two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and generating a coding lookup table based on a preset second key;

[0180] A preliminary encoding module 20 is used to perform genetic encoding on the scrambled image through dynamic encoding to obtain a preliminary encoded image;

[0181] A preliminary obfuscation module 30 is configured to search and replace each code in the preliminary coded image in the code lookup table to obtain a replaced preliminary obfuscated image;

[0182] The encryption module 40 is configured to traverse each target element in the preliminary obfuscated image starting from the second bit in the preliminary obfuscated image, perform an XOR operation on the target element and the element preceding the target element, and obtain a ciphertext matrix after encrypting the plaintext image.

[0183] Optionally, the initialization module 10 is further configured to:

[0184] Obtaining a current number of split rounds, and determining a target value for a target number of bits in the first key, wherein the target number of bits corresponds to the current number of split rounds;

[0185] Splitting the plaintext image into two sub-images along a diagonal direction based on the number of segmentation rounds;

[0186] For each of the sub-images, dividing the sub-image into at least one pixel set, wherein the pixel set includes two columns of adjacent sub-pixel sets;

[0187] For each group of the pixel sets, determining each short pixel in the shorter sub-pixel set among the adjacent sub-pixel sets and each long pixel in the longer sub-pixel set among the adjacent sub-pixel sets, and sequentially inserting each of the short pixels between each of the long pixels to obtain an intermediate image;

[0188] Connecting pixels in the intermediate image according to a preset connection rule to obtain an intermediate image;

[0189] Using the intermediate image as a new plaintext image, returning to the step of dividing the plaintext image into two sub-images along a diagonal direction based on the number of segmentation rounds until the number of segmentation rounds equals the target value, and then updating the number of segmentation rounds;

[0190] Return to the step of obtaining the current number of segmentation rounds until the number of segmentation rounds is equal to the length of the first key, and use the current intermediate image as the scrambled image.

[0191] Optionally, the initialization module 10 is further configured to:

[0192] If the number of segmentation rounds is an odd number, the plaintext image is segmented into two sub-images diagonally from the upper left to the lower right;

[0193] If the number of segmentation rounds is an even number, the plaintext image is segmented into two sub-images along a diagonal direction from the upper right to the lower left.

[0194] Optionally, the initialization module 10 is further configured to:

[0195] generating an initial array of a preset size, and performing a two-dimensional chaotic mapping on the initial array based on the last four bits of the second key to obtain a scrambled array;

[0196] Genetically encoding the scrambled array according to a preset encoding rule to obtain an encoding matrix;

[0197] The encoding lookup table is obtained by defining the row and column indexes of the encoding matrix according to a preset index rule.

[0198] Optionally, the preliminary encoding module 20 is further configured to:

[0199] Starting from the second bit in the scrambled image, each target pixel value in the scrambled image is traversed, and based on the pixel value of the previous bit of the target pixel value, the target pixel value is updated until the last pixel value in the scrambled image is traversed to obtain the preliminary encoded image.

[0200] Optionally, the image fast encryption device is further used for:

[0201] Decoding the first bit in the ciphertext matrix based on the second key to obtain a decoded pixel value of the first bit;

[0202] Starting from the second bit of the ciphertext matrix, each target ciphertext in the ciphertext matrix is traversed, and the pixel value of the target ciphertext is calculated based on the pixel value of the ciphertext before the target ciphertext is decoded to obtain the plaintext image after the ciphertext matrix is decoded.

[0203] The rapid image encryption device provided in this application utilizes the rapid image encryption method described in the aforementioned embodiments to address the technical problem of improving the security of image encryption. Compared to the prior art, the rapid image encryption device provided in this application achieves the same beneficial effects as the rapid image encryption method described in the aforementioned embodiments. Other technical features of the rapid image encryption device are the same as those disclosed in the aforementioned embodiments and are not further elaborated here.

[0204] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the image fast encryption method in the above-mentioned embodiment one.

[0205] like Figure 6 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 1002 or programs loaded from a storage device 1003 into a random access memory (RAM) 1004. RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.

[0206] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0207] The electronic device provided in this application utilizes the rapid image encryption method described in the aforementioned embodiment to address the technical problem of improving the security of image encryption. Compared to the prior art, the electronic device provided in this application achieves the same beneficial effects as the rapid image encryption method described in the aforementioned embodiment. Other technical features of this electronic device are the same as those disclosed in the aforementioned embodiment and are not further detailed here.

[0208] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0209] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

[0210] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer program) stored thereon, wherein the computer-readable program instructions are used to execute the image fast encryption method in the above embodiment.

[0211] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0212] The computer-readable storage medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0213] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the electronic device: performs a two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and generates a coding lookup table based on a preset second key; genetically encodes the scrambled image through dynamic coding to obtain a preliminary coded image; searches and replaces each code in the preliminary coded image in the coding lookup table to obtain a replaced preliminary obfuscated image; traverses each target element in the preliminary obfuscated image starting from the second bit in the preliminary obfuscated image, performs an XOR operation on the target element and the element before the target element, and obtains a ciphertext matrix after encrypting the plaintext image.

[0214] The computer program code for performing the operations of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0215] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0216] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.

[0217] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned rapid image encryption method, thereby solving the technical problem of improving the security of image encryption. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are similar to those of the rapid image encryption method provided in the aforementioned embodiments, and are not further elaborated here.

[0218] The present application also provides a computer program product, comprising a computer program, which implements the steps of the above-mentioned image fast encryption method when executed by a processor.

[0219] The computer program product provided in this application can solve the technical problem of how to improve the security of image encryption. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the image fast encryption method provided in the above embodiment, and will not be repeated here.

[0220] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for fast image encryption, characterized in that: The method comprises: Performing a two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and generating a coding lookup table based on a preset second key; Genetically encoding the scrambled image through dynamic encoding to obtain a preliminary encoded image; Searching and replacing each code in the preliminary coded image in the code lookup table to obtain a preliminary obfuscated image after replacement; Starting from the second bit in the preliminary obfuscated image, each target element in the preliminary obfuscated image is traversed, and an XOR operation is performed on the target element and the element before the target element to obtain a ciphertext matrix after encrypting the plaintext image.

2. The image fast encryption method according to claim 1, wherein: The step of performing two-dimensional chaotic mapping on the plaintext image to be encrypted based on the preset first key to obtain a scrambled image includes: Obtaining a current number of split rounds, and determining a target value for a target number of bits in the first key, wherein the target number of bits corresponds to the current number of split rounds; Splitting the plaintext image into two sub-images in a diagonal direction based on the number of segmentation rounds; For each of the sub-images, dividing the sub-image into at least one pixel set, wherein the pixel set includes two columns of adjacent sub-pixel sets; For each group of the pixel sets, determining each short pixel in the shorter sub-pixel set among the adjacent sub-pixel sets and each long pixel in the longer sub-pixel set among the adjacent sub-pixel sets, and sequentially inserting each of the short pixels between each of the long pixels to obtain an intermediate image; Connecting pixels in the intermediate image according to a preset connection rule to obtain an intermediate image; Using the intermediate image as a new plaintext image, returning to the step of dividing the plaintext image into two sub-images along a diagonal direction based on the number of segmentation rounds until the number of segmentation rounds equals the target value, and then updating the number of segmentation rounds; Return to the step of obtaining the current number of segmentation rounds until the number of segmentation rounds is equal to the length of the first key, and use the current intermediate image as the scrambled image.

3. The image fast encryption method according to claim 2, wherein: The step of dividing the plaintext image into two sub-images in a diagonal direction based on the number of division rounds includes: If the number of segmentation rounds is an odd number, the plaintext image is segmented into two sub-images diagonally from the upper left to the lower right; If the number of segmentation rounds is an even number, the plaintext image is segmented into two sub-images along a diagonal direction from the upper right to the lower left.

4. The image fast encryption method according to claim 1, wherein: The step of generating a coding lookup table based on a preset second key includes: generating an initial array of a preset size, and performing a two-dimensional chaotic mapping on the initial array based on the last four bits of the second key to obtain a scrambled array; Genetically encoding the scrambled array according to a preset encoding rule to obtain an encoding matrix; The encoding lookup table is obtained by defining the row and column indexes of the encoding matrix according to a preset index rule.

5. The image fast encryption method according to claim 1, wherein: The step of genetically encoding the scrambled image by dynamic encoding to obtain a preliminary encoded image comprises: Starting from the second bit in the scrambled image, each target pixel value in the scrambled image is traversed, and based on the pixel value of the previous bit of the target pixel value, the target pixel value is updated until the last pixel value in the scrambled image is traversed to obtain the preliminary encoded image.

6. The image fast encryption method according to claim 1, wherein: After the step of obtaining the ciphertext matrix after encrypting the plaintext image, the method further includes: Decoding the first bit in the ciphertext matrix based on the second key to obtain a decoded pixel value of the first bit; Starting from the second bit of the ciphertext matrix, each target ciphertext in the ciphertext matrix is traversed, and the pixel value of the target ciphertext is calculated based on the pixel value of the ciphertext before the target ciphertext is decoded to obtain the plaintext image after the ciphertext matrix is decoded.

7. A fast image encryption device, characterized in that: The device comprises: An initialization module is used to perform a two-dimensional chaotic mapping on the plaintext image to be encrypted based on a preset first key to obtain a scrambled image, and to generate a coding lookup table based on a preset second key; A preliminary encoding module, configured to perform genetic encoding on the scrambled image through dynamic encoding to obtain a preliminary encoded image; A preliminary obfuscation module, configured to search and replace each code in the preliminary coded image in the code lookup table to obtain a replaced preliminary obfuscated image; The encryption module is configured to traverse each target element in the preliminary obfuscated image starting from the second bit in the preliminary obfuscated image, perform an XOR operation on the target element and the element preceding the target element, and obtain a ciphertext matrix after encrypting the plaintext image.

8. An electronic device, characterized in that: The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the image fast encryption method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the image fast encryption method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the image fast encryption method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Logistic-based large key space bit scrambling chaotic image encryption method

    CN114418823A

  • Image encryption communication algorithm based on two-dimensional lag-complex logistic mapping, and image decryption communication algorithm based on two-dimensional lag-complex logistic mapping

    WO2022077793A1