Multi-image batch processing encryption method based on counter mode

Through the combination of multi-threading technology and counter mode, a method of efficiently encrypting four images in a massive image encryption scenario is realized, solving the problem of balancing encryption efficiency and strength, ensuring a balance between encryption strength and efficiency, and reducing the cost of key management. complexity.

CN118612356AActive Publication Date: 2024-09-06NANTONG VOCATIONAL COLLEGE
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410992167.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-09-06
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

In massive image encryption scenarios, it is difficult for existing technologies to balance encryption efficiency and encryption strength, and the reuse of key streams in parallel mode increases the risk of being cracked, making it difficult to ensure the security of transmitting a large number of session keys.

Method used

Multi-threading technology is used to design a multi-image batch encryption method based on counter mode. Multi-threading technology is used to encrypt four images at the same time, and the round key is updated through the counter mode to ensure that the round key is updated after each batch of four images is processed. Increase encryption strength.

Benefits of technology

It effectively improves encryption efficiency, takes into account encryption efficiency and encryption strength in massive image encryption scenarios, and does not increase the burden of key transmission, making it highly practical.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612356A
    Figure CN118612356A
Patent Text Reader

Abstract

The invention provides a multi-image batch processing encryption method based on a counter mode, which comprises the following steps of: respectively extracting initial states of a chaotic system by using a session key and a round key of a multi-plaintext image; four plaintext images in the multiple plaintext images are read and calculated, and the maximum rank value is obtained; generating a diffusion key matrix of Hmax * Wmax by using the initial state of the diffusion chaotic system; obtaining an initial vector key with the length of Wmax by using the initial state of the initial vector chaotic system; using the initial state of the scrambling chaotic system to obtain key streams used for row and column scrambling, wherein the lengths of the key streams are Wmax and Hmax respectively; four threads are started, encryption of four images is completed synchronously, and a ciphertext image is obtained; and updating the round key, and repeating the steps until the encryption of the multi-plaintext image to be encrypted is completed. According to the method, the encryption efficiency and strength in a massive image encryption scene are considered, the burden of key transmission is not increased, and the practicability is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image encryption, and in particular relates to a multi-image batch encryption method based on a counter mode. Background Art

[0002] Digital images play an important role in information interaction, so the protection of image information has received increasing attention. Digital images are different from text information. There is a high correlation between adjacent pixels, so the traditional data encryption algorithm used to encrypt text is not suitable for encrypted images. Chaotic systems have the characteristics of being highly sensitive to the initial key, ergodic, and unpredictable, and have been widely used in the field of image encryption. At present, in addition to optimizing and improving the chaotic system itself in order to produce a chaotic system with better randomness and stronger anti-degradation ability, using chaotic sequences to build more robust and reliable encryption methods has also become a focus of researchers.

[0003] Scrambling and diffusion are commonly used structures in image encryption algorithms based on chaotic systems. They have been proven to be able to effectively solve the problem of high intrinsic correlation of images. A series of improved optimization schemes can well achieve high-intensity encryption of images. In the scrambling stage, the positions of pixels are randomly scrambled by the pseudo-random sequence generated by the chaotic system, thereby effectively destroying and reducing the strong correlation between adjacent pixels of the original plaintext image. From the perspective of the scrambling object, it can be divided into pixel-level scrambling and bit-level scrambling. From the perspective of the scrambling method, it can be divided into magic square transformation, random rearrangement, Zigzag scanning, etc. In the diffusion stage, the pseudo-random sequence generated by the chaotic system is further used to operate on the pixel values, so as to fully hide the original statistical characteristics of the plaintext image and complicate the association between the plaintext image and the ciphertext image as much as possible. From the perspective of the diffusion steps, it usually takes more than two to three rounds of encryption based on the ciphertext group linking mode to achieve a good diffusion effect. From the perspective of the diffusion method, combining compressed sensing, time-frequency conversion, genetic coding and other technologies can also achieve better encryption effects.

[0004] The application potential of chaotic systems in the field of image encryption, especially in the field of single-image encryption, has been widely reported. However, in practice, especially in the scenario of massive image encryption, the problems are often more complicated. Simply reusing a single-image encryption algorithm will face some problems in encryption efficiency and even encryption strength. On the one hand, if the serial mode is used to encrypt images one by one, the encryption strength can be guaranteed, but the time used for image encryption will be significantly increased, thus affecting the efficiency of communication. On the other hand, if the parallel mode is used to encrypt multiple images synchronously, the encryption efficiency can be guaranteed, but the same key stream will be used to encrypt each image, which will undoubtedly significantly increase the risk of the image being cracked. To ensure the security of the parallel mode, a common practice is to use "oneFigure 1 The method of "encryption" is to use a "secret" method, that is, each plaintext image has its own unique session key, so that the key stream generated by the chaotic system is not repeated, which increases the difficulty of decryption for the decoder. However, this will bring an obvious problem, how to establish a secure transmission channel to efficiently transmit a large number of session keys. At present, there is no such technology to meet such a demand. Another common practice is to splice multiple images into a large image, and then use a single-image encryption algorithm to encrypt it. The idea is to cleverly transform the multi-image encryption task into a single-image encryption task. This is practical for multi-image encryption scenarios where the number of images to be encrypted is not large, but it is obvious that in multi-image encryption scenarios where the number of images to be encrypted is extremely large, there will still be the problem of not being able to balance encryption efficiency and encryption strength. At the same time, completing image splicing and segmentation will also increase the extra time cost to a certain extent. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a multi-image batch encryption method based on a counter mode, aiming to design a practical multi-image encryption method by using multi-threading technology and counter mode. One of its main purposes is to introduce multi-threading technology to design a new batch encryption framework, which can simultaneously apply a single image encryption method to the encryption of four images without the need for additional operations such as splicing the images, thereby effectively improving the encryption efficiency; secondly, the counter mode is introduced to achieve round key updates after each batch of four images are encrypted, based on the acquisition of session keys related to all plaintext images, thereby effectively ensuring the encryption strength. Therefore, the scheme can well balance the encryption efficiency and encryption strength in the scenario of mass image encryption, and will not increase the burden of key transmission, thus having high practicality.

[0006] To solve the above technical problems, an embodiment of the present invention provides a multi-image batch encryption method based on a counter mode, comprising the following steps: S1. Session keys using multiple plaintext images SK and round key R , respectively extract the initial state of the diffusion chaotic system x 1(1), y 1(1), Initial state of diffusive chaotic system 2 x 2(1), y 2(1) Initial state of the initial vector chaotic system x 3(1), the initial state of the chaotic system x 4(1); S2. Read four plaintext images from multiple plaintext images P 1. P 2. P 3. P 4. CalculateP 1. P 2. P 3. P Maximum width of 4 W max and maximum height H max ; S3. Using the initial state of the diffusion chaos system x 1(1), y 1(1), Initial state of diffusion chaotic system 2 x 2(1), y 2(1) After pre-iteration, the diffusion sequence is obtained S 1. S 2. S 3. S 4. After filling, converting and transposing, the corresponding diffusion key matrix is ​​generated DK 1, DK 2, DK 3. DK 4; S4. Using the initial state of the chaotic system using the initial vector x 3(1) After pre-iteration, the initial vector chaotic sequence is obtained S 5. Fill the four empty sequences to get the initial vector key IV 1 , IV 2 , IV 3 , IV 4; S5. Using the initial state of the chaotic system x 4(1) After pre-iteration, the scrambled chaotic sequence is obtained S 6, and fill the four empty sequences to obtain the key stream for column scrambling CSK 1, CSK 2, CSK 3. CSK 4; S6. Using the chaotic system W max Status x 4( W max ) After pre-iteration, the scrambled chaotic sequence is obtained S 7, and fill the four empty sequences to obtain the key stream for row scrambling RSK 1, RSK 2, RSK 3. RSK 4; S7, open four threads, P 1, DK 1, IV 1, CSK 1, RSK1Input thread one, P 2, DK 2, IV 2, CSK 2, RSK 2Input thread 2, P 3. DK 3. IV 3. CSK 3. RSK 1Input thread three, P 4. DK 4. IV 4. CSK 4. RSK 4Input thread 4, where thread 1, thread 2, thread 3 and thread 4 are respectively P 1. P 2. P 3. P 4 Run a single image encryption algorithm, the diffusion key matrix, initial vector key and key stream for scrambling on four threads, and adaptively crop according to the size of the image on the thread to obtain the ciphertext image C 1, C 2, C 3. C 4; S8. Order R = R +1, updated round key R , repeat step S2 to step S7 until the encryption of the multiple plaintext images to be encrypted is completed.

[0007] In step S1, the diffusion chaos system 1 and the diffusion chaos system 2 use two two-dimensional hyperchaotic systems to generate a pseudo-random sequence for the diffusion process, and the formula is as follows: , , The initial vector chaos system and the scrambling chaos system use two one-dimensional chaotic systems to generate a pseudo-random sequence for the scrambling process and an initialization vector for starting encryption, respectively, and the formula is as follows: , .

[0008] Wherein, step S1 comprises the following steps: S1.1, call the secure hash function SHA-256, the number of N The calculation is performed on multiple plaintext images. A 256-bit true random number is introduced during the calculation process to obtain the session key for this encryption. SK ; S1.2. Order SK= SK +1, continue to call SHA-256 for calculation to obtain the 256-bit round key R ; S1.3, using the following formula from the round key R The initial state of the diffusion chaotic system is extracted from x 1(1), y 1(1), Initial state of diffusive chaotic system 2 x 2(1), y 2(1) Initial state of the initial vector chaotic system x 3(1), the initial state of the chaotic system x 4(1); , Among them, ⊕ is a bit-level XOR operation.

[0009] Wherein, step S3 comprises the following steps: S3.1. Initialize four empty sequences S 1. S 2. S 3. S 4. The initial state x 1(1), y 1(1) and x 2(1), y 2(1) After inputting diffuse chaotic system 1 and diffuse chaotic system 2 respectively, they were pre-iterated 100 times and continued to run according to the following formula: W max * H max For four empty sequences S 1. S 2. S 3. S 4 is filled to obtain a diffusion chaotic sequence S 1. S 2. S 3. S 4: ; S3.2. S 1. S 2. S 3. S All elements in 4 are converted to integers between 0 and 255. The formula is as follows: ; S3.3, initialize four empty sequences and use the diffusion chaotic sequence S 1. S 2. S 3. S4 Fill the four empty sequences according to the following formula to obtain the diffusion key matrix DK 1, DK 2, DK 3. DK 4: ; S3.4. Diffusion key matrix DK 1, DK 2, DK 3. DK 4 for cutting, the formula is as follows: ; S3.5, the pruned diffusion key matrix DK 1, DK 2, DK 3. DK 4 Transpose to size W 1* H 1, W 2* H 2, W 3* H 3. W 4* H 4 four diffusion key matrices.

[0010] Wherein, step S4 comprises the following steps: S4.1. Initialize an empty sequence. x 3(1) After the initial vector chaos system is pre-iterated 100 times, it continues to run according to the following formula: W max Fill it up again to get the initial vector sequence S 5: S 5={ S 5. x 3( i )}, in, i =1, 2, …, W max-1 , W max ; S4.2. Initial vector sequence S All elements of 5 are converted to integers between 0 and 255. The formula is as follows: ; S4.3. Initialize four empty sequences and use the initial vector sequence S 5 Fill the empty sequence to get the initial vector key IV 1 , IV 2 , IV 3 , IV4. The formula is as follows: .

[0011] Wherein, step S5 comprises the following steps: S5.1. Initialize an empty sequence. x 4(1) After 100 pre-iterations of the chaotic system with input scrambling, it continues to run according to the following formula: W max times, we get the scrambled chaotic sequence S 6: S 6={ S 6. x 4( i )}, in, i =1, 2, …, W max-1 , W max ; S5.2, initialize four empty sequences, use scrambled chaotic sequences S 6Fill the empty sequence to get the scrambling key CSK 1, CSK 2, CSK 3. CSK 4. The formula is as follows: ; S5.3, scramble the key CSK 1, CSK 2, CSK 3. CSK The elements in 4 are converted to integers to obtain the key stream for column scrambling CSK 1, CSK 2, CSK 3. CSK 4. The formula is as follows: .

[0012] Wherein, step S6 comprises the following steps: S6.1. Initialize an empty sequence. x 4( W max ) After 100 pre-iterations of the chaotic system, the system continues to run according to the following formula: H max times, we get the scrambled chaotic sequence S 7: S 7={ S 7, x 4( i )}, in,i =1, 2, …, H max-1 , H max ; S6.2, initialize four empty sequences, and use scrambled chaotic sequences S 7 Fill the empty sequence to get the scrambling key RSK 1, RSK 2, RSK 3. RSK 4. The formula is as follows: ; S6.3, scramble the key RSK 1, RSK 2, RSK 3. RSK The elements in 4 are converted to integers to obtain the key stream for row scrambling RSK 1, RSK 2, RSK 3. RSK 4.

[0013] Among them, in step S7, thread 1, thread 2, thread 3 and thread 4 all use the single image encryption algorithm to respectively P 1. P 2. P 3. P 4. Encryption. The specific steps of encrypting a plaintext image include: S7.1, initialization width is W 1, height is H Empty matrix of 1 TC 1. Order TC 1(0, :)= IV 1 to start encryption at this stage, according to the following formula P 1. Scramble the image horizontally and diffuse it vertically to generate an intermediate ciphertext image. TC 1: ; S7.2. Order TC 1(:,0)= TC 1(:, W 1) To start encryption at this stage, perform vertical scrambling of the image according to the following formula, and simultaneously complete horizontal diffusion of the image to update the intermediate ciphertext image TC 1: ; S7.3, Order TC 1(0,:)= TC 1( H1,:) to start encryption at this stage, scramble the image horizontally again according to the following formula, and simultaneously complete the diffusion of the image vertically to update the intermediate ciphertext image TC 1: ; S7.4. Order TC 1(:,0)= TC 1(:, W 1) To start encryption at this stage, scramble the image vertically again according to the following formula, and simultaneously complete the diffusion of the image horizontally to update the intermediate ciphertext image TC 1: ; S7.5. Output the updated intermediate ciphertext image in step 7.4 TC 1. Get the final ciphertext image C 1; At the same time, P 2. P 3. P 4. Steps S7.1 to S7.4 are synchronously executed in thread 2, thread 3 and thread 4 to perform encryption. The encryption process is executed in parallel under multiple threads, and the final ciphertext image is output. C 2, C 3. C 4.

[0014] The beneficial effects of the above technical solution of the present invention are as follows: In order to obtain fast encryption speed, the present invention utilizes multi-threading technology and a safe and fast single-image encryption algorithm to encrypt four images at the same time, and there is no need to perform additional operations such as splicing the images, thereby effectively improving the encryption efficiency; secondly, in order to expand to large-scale images without increasing the difficulty of key management, a counter mode is introduced, and on the basis of obtaining session keys related to all plaintext images, round key updates are implemented after each batch processing of four images are encrypted, thereby effectively ensuring the encryption strength. Therefore, the scheme can well balance the encryption efficiency and encryption strength in the massive image encryption scenario, and will not increase the burden of key transmission, and has high practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 Schematic diagram of the process of the multi-image batch encryption method based on the counter mode provided by the embodiment of the present invention Figure 1 ; Figure 2 Schematic diagram of the process of the multi-image batch encryption method based on the counter mode provided by the embodiment of the present invention Figure 2 ; Figure 3A schematic diagram of a process of multi-threaded synchronous encryption in a multi-image batch encryption method based on a counter mode provided by an embodiment of the present invention; Figure 4 A plaintext image provided by an embodiment of the present invention, a ciphertext image obtained by using images of different sizes under a multi-image batch encryption method based on a counter mode, and a decrypted image; Figure 5 A plaintext image provided by an embodiment of the present invention, a ciphertext image obtained by using images of different sizes under a multi-image batch encryption method based on a counter mode, and a decrypted image 2; Figure 6 The histogram of the plaintext image and the ciphertext image obtained by the multi-image batch encryption method based on the counter mode provided by the embodiment of the present invention Figure 1 ; Figure 7 The histogram of the plaintext image provided by the embodiment of the present invention and the ciphertext image obtained by the multi-image batch encryption method based on the counter mode Figure 2 ; Figure 8 A comparison diagram of the correlation of adjacent pixels in the horizontal, vertical and diagonal directions of a plaintext image and a ciphertext image obtained by a multi-image batch encryption method based on a counter mode provided in an embodiment of the present invention (based on a Peppers image). DETAILED DESCRIPTION

[0016] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0017] like Figure 1-3 As shown, an embodiment of the present invention provides a multi-image batch encryption method based on a counter mode, comprising the following steps: S1. Session keys using multiple plaintext images SK and round key R , respectively extract the initial state of the diffusion chaotic system x 1(1), y 1(1), Initial state of diffusive chaotic system 2 x 2(1), y 2(1) Initial state of the initial vector chaotic system x 3(1), the initial state of the chaotic system x 4(1), including the following sub-steps: S1.1, the diffusion chaos system 1 and the diffusion chaos system 2 use two two-dimensional hyperchaotic systems to generate a pseudo-random sequence for the diffusion process, and the formula is as follows: , , The initial vector chaos system and the scrambling chaos system use two one-dimensional chaotic systems to generate a pseudo-random sequence for the scrambling process and an initialization vector for starting encryption, respectively, and the formula is as follows: , ; S1.2, call the secure hash function SHA-256, the number of N The calculation is performed on multiple plaintext images. A 256-bit true random number is introduced during the calculation process to obtain the session key for this encryption. SK ; S1.3. Order SK = SK +1, continue to call SHA-256 for calculation to obtain the 256-bit round key R ; S1.4, use the following formula to obtain the round key R The initial state of the diffusion chaotic system is extracted from x 1(1), y 1(1), Initial state of diffusive chaotic system 2 x 2(1), y 2(1) Initial state of the initial vector chaotic system x 3(1), the initial state of the chaotic system x 4(1); , Among them, ⊕ is a bit-level XOR operation.

[0018] S2. Read four plaintext images from multiple plaintext images P 1. P 2. P 3. P 4, and get their widths respectively W 1, W 2, W 3. W 4 and height H 1, H 2, H 3. H 4. Calculate P 1. P 2. P 3. P Maximum width of 4 W max and maximum height H max , that is, W max =max{ W 1, W 2,W 3. W 4}, H max =max{ H 1, H 2, H 3. H 4}; S3. Using the initial state of the diffusion chaos system x 1(1), y 1(1), Initial state of diffusion chaotic system 2 x 2(1), y 2(1) After pre-iteration, the diffusion sequence is obtained S 1. S 2. S 3. S 4, and the corresponding size after padding, conversion and transposition is H max × W max The diffusion key matrix DK 1, DK 2, DK 3. DK 4, including the following sub-steps: S3.1. Initialize four empty sequences S 1. S 2. S 3. S 4. The initial state x 1(1), y 1(1) and x 2(1), y 2(1) After inputting diffuse chaotic system 1 and diffuse chaotic system 2 respectively, they were pre-iterated 100 times and continued to run according to the following formula: W max * H max For four empty sequences S 1. S 2. S 3. S 4 is filled to obtain a diffusion chaotic sequence S 1. S 2. S 3. S 4: ; S3.2. S 1. S 2. S 3. S All elements in 4 are converted to integers between 0 and 255. The formula is as follows: ; S3.3, initialize four empty sequences and use the diffusion chaotic sequence S 1. S 2. S 3. S 4 Fill the four empty sequences according to the following formula to obtain the diffusion key matrix DK 1, DK 2, DK 3. DK 4: ; S3.4. Diffusion key matrix DK 1, DK 2, DK 3. DK 4 for cutting, the formula is as follows: ; S3.5, the pruned diffusion key matrix DK 1, DK 2, DK 3. DK 4 Transpose to size W 1* H 1, W 2* H 2, W 3* H 3. W 4* H 4 four diffusion key matrices.

[0019] S4. Using the initial state of the chaotic system using the initial vector x 3(1) After pre-iteration, the initial vector chaotic sequence is obtained S 5, and fill the four empty sequences to obtain a length of W max Initialization Vector Key IV 1 , IV 2 , IV 3 , IV 4, including the following sub-steps: S4.1. Initialize an empty sequence. x 3(1) After the initial vector chaos system is pre-iterated 100 times, it continues to run according to the following formula: W max Fill it up again to get the initial vector sequence S 5: S 5={ S 5. x 3( i )}, in, i =1, 2, …,W max-1 , W max ; S4.2. Initial vector sequence S All elements of 5 are converted to integers between 0 and 255. The formula is as follows: ; S4.3. Initialize four empty sequences and use the initial vector sequence S 5 Fill the empty sequence to get the initial vector key IV 1 , IV 2 , IV 3 , IV 4. The formula is as follows: .

[0020] S5. Using the initial state of the chaotic system x 4(1) After pre-iteration, the scrambled chaotic sequence is obtained S 6, and fill the four empty sequences to obtain a length of W max The key stream used to scramble the columns CSK 1, CSK 2, CSK 3. CSK 4, including the following sub-steps: S5.1. Initialize an empty sequence. x 4(1) After 100 pre-iterations of the chaotic system with input scrambling, it continues to run according to the following formula: W max times, we get the scrambled chaotic sequence S 6: S 6={ S 6. x 4( i )}, in, i =1, 2, …, W max-1 , W max ; S5.2, initialize four empty sequences, use scrambled chaotic sequences S 6Fill the empty sequence to get the scrambling key CSK 1, CSK 2, CSK 3. CSK 4. The formula is as follows: ; S5.3, scramble the key CSK 1, CSK2, CSK 3. CSK The elements in 4 are converted to integers to obtain the key stream for column scrambling CSK 1, CSK 2, CSK 3. CSK 4. The formula is as follows: .

[0021] S6. Using the chaotic system W max Status x 4( W max ) After pre-iteration, the scrambled chaotic sequence is obtained S 7, and fill the four empty sequences to get a length of H max The key stream for row scrambling RSK 1, RSK 2, RSK 3. RSK 4, including the following sub-steps: S6.1. Initialize an empty sequence. x 4( W max ) After 100 pre-iterations of the chaotic system, the system continues to run according to the following formula: H max times, we get the scrambled chaotic sequence S 7: S 7={ S 7, x 4( i )}, in, i =1, 2, …, H max-1 , H max ; S6.2, initialize four empty sequences, and use scrambled chaotic sequences S 7 Fill the empty sequence to get the scrambling key RSK 1, RSK 2, RSK 3. RSK 4. The formula is as follows: ; S6.3, scramble the key RSK 1, RSK 2, RSK 3. RSK The elements in 4 are converted to integers to obtain the key stream for row scrambling RSK 1, RSK 2, RSK 3. RSK 4.

[0022] S7, open four threads, P 1, DK 1, IV 1, CSK 1, RSK 1Input thread one, P 2, DK 2, IV 2, CSK 2, RSK 2Input thread 2, P 3. DK 3. IV 3. CSK 3. RSK 1Input thread three, P 4. DK 4. IV 4. CSK 4. RSK 4 Input thread 4 (such as Figure 3 As shown), thread one, thread two, thread three and thread four are respectively P 1. P 2. P 3. P 4 Run a single image encryption algorithm to get the ciphertext image C 1, C 2, C 3. C 4. In addition, the diffusion key matrix, initial vector key and key stream for scrambling on the four threads are adaptively cropped according to the size of the image on the thread. P Taking 1 as an example, the specific steps are as follows: S7.1, initialization width is W 1, height is H Empty matrix of 1 TC 1. Order TC 1(0, :)= IV 1 to start encryption at this stage, according to the following formula P 1. Scramble the image horizontally and diffuse it vertically to generate an intermediate ciphertext image. TC 1: ; S7.2. Order TC 1(:,0)= TC 1(:, W1) To start encryption at this stage, perform vertical scrambling of the image according to the following formula, and simultaneously complete horizontal diffusion of the image to update the intermediate ciphertext image TC 1: ; S7.3, Order TC 1(0,:)= TC 1( H 1,:) to start encryption at this stage, scramble the image horizontally again according to the following formula, and simultaneously complete the diffusion of the image vertically to update the intermediate ciphertext image TC 1: ; S7.4. Order TC 1(:,0)= TC 1(:, W 1) To start encryption at this stage, scramble the image vertically again according to the following formula, and simultaneously complete the diffusion of the image horizontally to update the intermediate ciphertext image TC 1: ; S7.5. Output the updated intermediate ciphertext image in step 7.4 TC 1. Get the final ciphertext image C 1. At the same time, P 2. P 3. P 4. Steps S7.1 to S7.4 are synchronously executed in thread 2, thread 3 and thread 4 to perform encryption. The encryption process is executed in parallel under multiple threads, and the final ciphertext image is output. C 2, C 3. C 4. So far, multi-threaded synchronous encryption of four plaintext images has been achieved.

[0023] S8. Order R = R +1, and then continue to call SHA-256 for calculation to update the 256-bit round key R , repeat step S2 to step S7 until the encryption of the multiple plaintext images to be encrypted is completed.

[0024] In order to verify the security and efficiency of the multi-image batch encryption method based on the counter mode provided by the present invention, simulation experiments and performance analysis are carried out below to further illustrate the beneficial effects of the present invention.

[0025] (1) Simulation experiment Experimental simulation platform: CPU:Intel(R)Core(TM)i5-4590H,3.30GHZ; Memory: 4096MB; Operating system: Windows10; Coding tool: Matlab2018a.

[0026] In this experiment, we selected 256×256 Cameraman image, 321×481 Boatman image, 481×321 Train image, 500×362 Flowers image, 512×768 Kodim04 image, 512×512 Peppers image, 768×512 Kodim01 image and 1024×1024 Airplane image as plaintext images. The encryption and decryption effects are shown in the figure below. Figure 4 , Figure 5 As shown in the figure, it can be seen that the plaintext image and the ciphertext image are very different, and the ciphertext image can no longer be seen as the original image.

[0027] (2) Histogram analysis Figure 6 , Figure 7 Given the histograms of the plaintext image and the corresponding ciphertext image, it can be clearly seen that the histogram of the ciphertext image is very uniform and significantly different from the histogram of the plaintext image. Compared with the plaintext image, there is no direct correlation at all, which makes it very difficult for attackers to analyze the ciphertext image through statistical attacks, and can completely prevent various effective statistical algorithm attacks.

[0028] (3) Correlation between adjacent pixels Correlation of adjacent pixels Peppers image is selected as the plaintext image, and the test results of correlation of adjacent pixels are as follows Figure 8 shown. Figure 8 In the figure: (a), (b), (c) are the horizontal, vertical, and diagonal adjacent pixel correlation diagrams of the plaintext image Peppers, and (d), (e), (f) are the horizontal, vertical, and diagonal adjacent pixel correlation diagrams of the ciphertext image. Figure 8 It can be seen that the adjacent pixels of the plaintext image in the horizontal, vertical and diagonal directions are mostly concentrated, while the pixels of the ciphertext image are evenly distributed. The correlation of the plaintext image is much greater than that of the ciphertext, and the correlation of the ciphertext is close to 0, which also shows that the encryption algorithm can destroy the strong correlation between adjacent pixels of the plaintext image.

[0029] (4) Encryption time test The encryption time test results are shown in Table 1 below.

[0030] Table 1. Encryption time test results. Image size (number) Encryption time (seconds) 256×256 (4 pictures) 0.0533 512×512 (4 pictures) 0.1495 321×481 (25 images) + 500×362 (25 images) 768×512 (25 images) 1024×1024 (25 images) 2.1046 Time complexity (2+2) As can be seen from the table above, due to the use of a new parallel solution with a linear time complexity of O(2W+2H) to perform secure single-image encryption and decryption operations, it only takes 2.1 seconds to complete the encryption even when processing hundreds of images of different sizes, meeting the efficiency requirements of large-scale image encryption.

[0031] The present invention proposes a multi-image batch encryption method based on counter mode. In order to obtain fast encryption speed, a novel scheme is adopted, which is constructed by using multi-threading technology and a secure and fast single-image encryption algorithm, so that four plaintext images can be encrypted simultaneously. In addition, in order to expand this scheme to large-scale images without increasing the difficulty of key management, a counter mode is introduced, so that the round key for encrypting every four images can be obtained from the plaintext-related and unpredictable session key. The present invention also proposes a secure and fast adaptive multi-channel pseudo-random number generator based on a 2D hyperchaotic system, which reduces the time consumption of generating key streams when meeting the requirements of parallel encryption of pictures of different sizes.

[0032] The above security tests show that the proposed algorithm has excellent performance in terms of security, and its password image correlation coefficient is close to 0 and the entropy is greater than 7.99. The NPCR and UACI test results show that the algorithm produces a password image similar to the ideal password and effectively resists attacks such as statistical, differential, exhaustive and even selective plaintext attacks. Since a new parallel scheme with a linear time complexity of O(2W+2H) is used to perform secure single-image encryption and decryption operations, it only takes 2.1 seconds to complete encryption even when processing hundreds of images of different sizes. Therefore, the present invention successfully meets the efficiency and security needs of large-scale image encryption.

[0033] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A multi-image batch encryption method based on counter mode, It is characterized in that The following steps are involved: S1. Session keys using multiple plaintext images SK and round key R , respectively extract the initial state of the diffusion chaotic system x 1 (1) y 1 (1) The initial state of the diffusion chaos system 2 x 2 (1) y 2 (1) Initial state of the initial vector chaotic system x 3 (1) The initial state of the chaotic system x 4 (1); S2. Read four plaintext images from multiple plaintext images P 1 , P 2 , P 3 , P 4 , calculated P 1 , P 2 , P 3 , P 4 Maximum width W max and maximum height H max ; S3. Using the initial state of the diffusion chaos system x 1 (1) y 1 (1) Initial state of diffusion chaotic system 2 x 2 (1) y 2 (1) After pre-iteration, the diffusion sequence is obtained S 1 , S 2 , S 3 , S 4 , and fill, transform and transpose to generate the corresponding diffusion key matrix DK 1 , DK 2 , DK 3 , DK 4 ; S4. Using the initial state of the chaotic system using the initial vector x 3 (1) After pre-iteration, the initial vector chaotic sequence is obtained S 5 , and fill the four empty sequences to get the initial vector key IV 1 , IV 2 , IV 3 , IV 4 ; S5. Using the initial state of the chaotic system x 4 (1) After pre-iteration, the scrambled chaotic sequence is obtained S 6 , and fill the four empty sequences to obtain the key stream for column scrambling CSK 1 , CSK 2 , CSK 3 , CSK 4 ; S6. Using the chaotic system W max In state x 4 ( W max ) After pre-iteration, the scrambled chaotic sequence is obtained S 7 , and fill the four empty sequences to obtain the key stream for row scrambling RSK 1 , RSK 2 , RSK 3 , RSK 4 ; S7, open four threads, P 1 , DK 1 , IV 1 , CSK 1 , RSK 1 In the input thread one, P 2 , DK 2 , IV 2 , CSK 2 , RSK 2 Enter thread 2, P 3 , DK 3 , IV 3 , CSK 3 , RSK 1 Enter thread three, P 4 , DK 4 , IV 4 , CSK 4 , RSK 4 Input thread 4, where thread 1, thread 2, thread 3 and thread 4 are respectively P 1 , P 2 , P 3 , P 4 Run a single image encryption algorithm, the diffusion key matrix, initial vector key and key stream for scrambling on four threads, and adaptively crop according to the size of the image on the thread to obtain the ciphertext image C 1 , C 2 , C 3 , C 4 ; S8. Order R = R +1, updated round key R , repeat step S2 to step S7 until the encryption of the multiple plaintext images to be encrypted is completed.

2. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that The diffusion chaos system 1 and the diffusion chaos system 2 in step S1 use two two-dimensional hyperchaotic systems to generate a pseudo-random sequence for the diffusion process, and the formula is as follows: , , The initial vector chaos system and the scrambling chaos system use two one-dimensional chaotic systems to generate a pseudo-random sequence for the scrambling process and an initialization vector for starting encryption, respectively, and the formula is as follows: , 。 3. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that Step S1 includes the following steps: S1.1, call the secure hash function SHA-256, the number of N The calculation is performed on multiple plaintext images. A 256-bit true random number is introduced during the calculation process to obtain the session key for this encryption. SK ; S1.

2. Order SK = SK +1, continue to call SHA-256 for calculation to obtain the 256-bit round key R ; S1.3, using the following formula from the round key R The initial state of the diffusion chaotic system is extracted from x 1 (1) y 1 (1) The initial state of the diffusion chaos system 2 x 2 (1) y 2 (1) Initial state of the initial vector chaotic system x 3 (1) The initial state of the chaotic system x 4 (1); , Among them, ⊕ is a bit-level XOR operation.

4. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that Step S3 includes the following steps: S3.

1. Initialize four empty sequences S 1 , S 2 , S 3 , S 4 , the initial state x 1 (1) y 1 (1) and x 2 (1) y 2 (1) After inputting diffuse chaotic system 1 and diffuse chaotic system 2 respectively, they were pre-iterated 100 times and continued to run according to the following formula W max * H max For four empty sequences S 1 , S 2 , S 3 , S 4 Fill it up and get the diffuse chaotic sequence S 1 , S 2 , S 3 , S 4 : ; S3.

2. S 1 , S 2 , S 3 , S 4 All elements in are converted to integers between 0 and 255. The formula is as follows: ; S3.3, initialize four empty sequences and use the diffusion chaotic sequence S 1 , S 2 , S 3 , S 4 Fill the four empty sequences according to the following formula to obtain the diffusion key matrix DK 1 , DK 2 , DK 3 , DK 4 : ; S3.

4. Diffusion key matrix DK 1 , DK 2 , DK 3 , DK 4 For cutting, the formula is as follows: ; S3.5, the pruned diffusion key matrix DK 1 , DK 2 , DK 3 , DK 4 Transpose to size W 1 * H 1 , W 2 * H 2 , W 3 * H 3 , W 4 * H 4 Four diffusion key matrices of .

5. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that Step S4 includes the following steps: S4.

1. Initialize an empty sequence. x 3 (1) After the initial vector chaos system is pre-iterated 100 times, it continues to run according to the following formula W max Fill it up again to get the initial vector sequence S 5 : S 5 ={ S 5 , x 3 ( i )}, in, i =1, 2, …, W max-1 , W max ; S4.

2. Initial vector sequence S 5 All elements of are converted to integers between 0 and 255. The formula is as follows: ; S4.

3. Initialize four empty sequences and use the initial vector sequence S 5 Fill the empty sequence to get the initial vector key IV 1 , IV 2 , IV 3 , IV 4 , the formula is as follows: 。 6. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that Step S5 includes the following steps: S5.

1. Initialize an empty sequence. x 4 (1) After 100 pre-iterations of the chaotic system, the system continues to run according to the following formula: W max times, we get the scrambled chaotic sequence S 6 : S 6 ={ S 6 , x 4 ( i )}, in, i =1, 2, …, W max-1 , W max ; S5.2, initialize four empty sequences, use scrambled chaotic sequences S 6 Fill the empty sequence to get the scrambling key CSK 1 , CSK 2 , CSK 3 , CSK 4 , the formula is as follows: ; S5.3, scramble the key CSK 1 , CSK 2 , CSK 3 , CSK 4 Convert the elements in to integers to get the key stream for column scrambling CSK 1 , CSK 2 , CSK 3 , CSK 4 , the formula is as follows: 。 7. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that Step S6 includes the following steps: S6.

1. Initialize an empty sequence. x 4 ( W max ) After 100 pre-iterations of the chaotic system, the system continues to run according to the following formula: H max times, we get the scrambled chaotic sequence S 7 : S 7 ={ S 7 , x 4 ( i )}, in, i =1, 2, …, H max-1 , H max ; S6.2, initialize four empty sequences, and use scrambled chaotic sequences S 7 Fill the empty sequence to get the scrambling key RSK 1 , RSK 2 , RSK 3 , RSK 4 , the formula is as follows: ; S6.3, scramble the key RSK 1 , RSK 2 , RSK 3 , RSK 4 Convert the elements in to integers to get the key stream for row scrambling RSK 1 , RSK 2 , RSK 3 , RSK 4 .

8. The multi-image batch encryption method based on counter mode according to claim 1, It is characterized in that In step S7, thread 1, thread 2, thread 3 and thread 4 all use a single image encryption algorithm to encrypt P 1 , P 2 , P 3 , P 4 The specific steps of encrypting a plaintext image include: S7.1, initialization width is W 1 , the height is H 1 The empty matrix TC 1 ,make TC 1 (0, :)= IV 1 To start encryption at this stage, use the following formula to P 1 Perform horizontal scrambling of the image and simultaneously complete vertical diffusion of the image to generate an intermediate ciphertext image TC 1 : ; S7.

2. Order TC 1 (:,0)= TC 1 (:, W 1 ) to start encryption at this stage, scramble the image vertically according to the following formula, and simultaneously complete the diffusion of the image horizontally to update the intermediate ciphertext image TC 1 : ; S7.3, Order TC 1 (0,:)= TC 1 ( H 1 ,:) to start encryption at this stage, scramble the image horizontally again according to the following formula, and simultaneously complete the diffusion of the image vertically to update the intermediate ciphertext image TC 1 : ; S7.

4. Order TC 1 (:,0)= TC 1 (:, W 1 ) to start encryption at this stage, scramble the image vertically again according to the following formula, and simultaneously complete the diffusion of the image horizontally to update the intermediate ciphertext image TC 1 : ; S7.

5. Output the updated intermediate ciphertext image in step 7.4 TC 1 , and get the final ciphertext image C 1 ;at the same time, P 2 , P 3 , P 4 Steps S7.1 to S7.4 are synchronously executed in thread 2, thread 3, and thread 4 to perform encryption. The encryption process is executed in parallel under multiple threads, and the final ciphertext image is output. C 2 , C 3 , C 4 .

Citation Information

Patent Citations

  • Novel image scrambling method based on chaotic technology

    CN105931175A

  • Color image encryption method based on Latin square scrambling

    CN108696666A

  • Parallel image encryption system and method based on spatial diffusion structure

    CN111597574A

  • Color image parallel encryption method based on vectorization technology

    CN116389652A

  • Chaos cryptographic communication method and chaos cryptographic communication system

    US20020009200A1