Image encryption method and device and electronic equipment

By separating color channels, scrambling and diffusion of color images, encrypted images are generated, which solves the problems of redundancy and insufficient security caused by channel independent encryption in the prior art, and significantly improves the complexity and security of encryption.

CN119728873APending Publication Date: 2025-03-28CHINA FIRST HIGHWAY ENGINEERING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411920059.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing color image encryption methods ignore the strong correlation between multiple channels, resulting in increased encryption complexity and computing overhead, which in turn affects the efficiency and security of color image encryption.

Method used

By obtaining the image to be encrypted, after preprocessing, it is separated into multiple color component images according to the color channel, the color component image is chaotic and diffusion using the fusion index chaotic rule and diffusion algorithm to generate a chaotic matrix, and divide it into multiple color component images for fusion conversion to obtain an encrypted image.

Benefits of technology

It significantly improves the complexity and security of image encryption, avoids the information leakage problems caused by channel independent encryption, and enhances the ability to resist differential attacks and statistical attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728873A_ABST
    Figure CN119728873A_ABST
Patent Text Reader

Abstract

The invention provides an image encryption method and device and electronic equipment, and relates to the technical field of image processing, the image encryption method and device and the electronic equipment provided by the invention can pre-process a to-be-encrypted image to obtain a target image; separating the target image into a first color component image according to a color channel; performing row-column fusion index scrambling processing on the first color component image to obtain a second color component image, and performing diffusion operation on the second color component image to obtain a first scrambling matrix; dividing the first scrambling matrix into a preset number of third color component images; according to the image encryption method, the first color component image is subjected to fusion conversion, the third color component image is subjected to fusion conversion, an encrypted image is obtained, in the scrambling process, fusion scrambling can be performed on the first color component image, the convention of independent processing of each channel is broken through, and the complexity and safety of image encryption are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image encryption method, device and electronic equipment. Background Art

[0002] Digital images have penetrated into people's daily lives and become an important communication medium due to their intuitiveness, easy interpretation and the large amount of information they carry. From social entertainment to medical diagnosis and military decision-making, the application areas of images are constantly expanding.

[0003] However, as the network environment becomes increasingly complex, there may be malicious individuals or groups that illegally steal and disseminate image content through the network, posing a serious threat to personal privacy, commercial secrets and even national security.

[0004] Existing image protection technologies include image watermarking, data hiding and image encryption, etc. Among them, image encryption technology is the most direct and effective means, which can encrypt a meaningful image into an unrecognizable garbled image. Only legitimate users holding specific keys can decrypt and restore the content of the original image.

[0005] Therefore, the security of color image encryption in modern information transmission has received increasing attention. Existing color image encryption methods ignore the strong correlation between multiple channels. Color images are usually composed of three channels: red, green, and blue, and each channel contains part of the image information. However, existing encryption methods do not regard the three color planes as a whole, but instead regard the three channels as independent planes for encryption processing separately, ignoring the correlation and mutual influence between them, increasing the complexity and computational overhead of encryption, and thus affecting the efficiency and security of color image encryption. Summary of the invention

[0006] In view of this, an object of the present invention is to provide an image encryption method, device and electronic device to alleviate the above technical problems.

[0007] In a first aspect, an embodiment of the present invention provides an image encryption method, the method comprising: obtaining an image to be encrypted, preprocessing the image to be encrypted to obtain a target image; separating the target image into a preset number of first color component images according to color channels; performing row and column fusion index scrambling processing on the first color component image according to a preconfigured fusion index scrambling rule to obtain a second color component image; performing a diffusion operation on the second color component image according to a preconfigured diffusion algorithm to obtain a first scrambled matrix; dividing the first scrambled matrix into a preset number of third color component images according to the size of the target image; and fusion transforming the preset number of third color component images according to color channels to obtain an encrypted image.

[0008] In combination with the first aspect, an embodiment of the present invention provides a first possible implementation method of the first aspect, wherein the above-mentioned fusion index scrambling rule randomly determines random columns and random rows according to a pre-constructed chaotic sequence to perform scrambling on the first color component image; the chaotic sequence is stored in a pre-constructed chaotic sequence library; the method also includes: inputting the target image into a pre-configured secure hash algorithm to calculate an initial key; determining the initial value and control parameters of a pre-established mapping model based on the initial key; wherein the mapping model is constructed based on a modular logic chaos model MLBCM, and the mapping model includes an LLB mapping model, an SLB mapping model, and a CLB mapping model; the initial value and the control parameter are respectively input into the corresponding mapping models to obtain multiple chaotic sequences; and the chaotic sequence library is constructed based on multiple chaotic sequences.

[0009] In combination with the first possible implementation of the first aspect, an embodiment of the present invention provides a second possible implementation of the first aspect, wherein the above-mentioned secure hash algorithm is a SHA-512 algorithm; the step of inputting the target image into a preconfigured secure hash algorithm and calculating an initial key includes: inputting the pixel matrix of the target image into the SHA-512 algorithm, intercepting the output result of the SHA-512 algorithm according to preset interception parameters, and obtaining the initial key.

[0010] In combination with the first aspect, an embodiment of the present invention provides a third possible implementation of the first aspect, wherein the above-mentioned step of preprocessing the image to be encrypted to obtain the target image includes: if the image to be encrypted includes multiple images, the multiple images are spliced ​​in sequence according to a preset method, and the spliced ​​images are filled to obtain the target image of a preset size; if the image to be encrypted includes one image, the image is determined as the target image.

[0011] In combination with the first possible implementation of the first aspect, an embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the step of performing row-column fusion index scrambling processing on a preset number of the first color component images according to a pre-configured fusion index scrambling rule to obtain a second color component image includes: first performing column index scrambling processing on a preset number of the first color component images according to the pre-configured fusion index scrambling rule, and performing row index scrambling processing on the result of completing the column index scrambling processing to obtain the second color component image.

[0012] In combination with the fourth possible implementation of the first aspect, an embodiment of the present invention provides a fifth possible implementation of the first aspect, wherein the step of performing row-column fusion index scrambling processing on the first color component image according to a preconfigured fusion index scrambling rule to obtain a color component image includes: horizontally arranging and combining a preset number of the first color component images to obtain a first matrix; the first matrix is ​​used for column index scrambling; traversing each column of the first matrix, and swapping each column with other random columns in turn until all columns of the first matrix are traversed to complete the column index scrambling; wherein the random column is randomly determined based on a first chaotic sequence; the first chaotic sequence is a chaotic sequence in the chaotic sequence library, and the first chaotic sequence is based on the S The method is as follows: the method comprises the following steps: obtaining the first matrix after the column index scrambling is completed; dividing the first matrix after the column index scrambling is completed into a plurality of first sub-matrices according to the preset number, and arranging the first sub-matrices vertically to obtain a second matrix; the second matrix is ​​used for row index scrambling; traversing each row of the second matrix, and swapping each row with other random rows in turn until all rows of the second matrix are traversed to complete the row index scrambling; wherein the random behavior is randomly determined based on the second chaotic sequence; the second chaotic sequence is a chaotic sequence in the chaotic sequence library, and the second chaotic sequence is obtained based on the LLB mapping model; dividing the second matrix after the row index scrambling is completed into a plurality of second sub-matrices according to the preset number, and determining the second sub-matrix as a second color component image.

[0013] In combination with the first possible implementation of the first aspect, an embodiment of the present invention provides a sixth possible implementation of the first aspect, wherein the above-mentioned diffusion operation is a diffusion operation based on DNA encoding and decoding; the step of performing a diffusion operation on the second color component image according to a pre-configured diffusion algorithm to obtain a first scrambled matrix includes: selecting a matching chaotic sequence from the chaotic sequence library to generate a diffusion sequence, a dynamic encoding rule, a dynamic decoding rule and a diffusion operation rule; the dynamic encoding rule includes a first encoding sub-rule and a second encoding sub-rule; converting the diffusion sequence into a diffusion sequence matrix having a size consistent with the second color component image; encoding the second color component image using the first encoding sub-rule to obtain a first encoding matrix, and encoding the converted diffusion sequence matrix using the second encoding sub-rule to obtain a second encoding matrix; constructing a DNA ciphertext matrix based on the first encoding matrix, the second encoding matrix, and a preset diffusion direction; performing a decoding operation on the DNA ciphertext matrix according to the dynamic decoding rule, and performing a size conversion on the decoded DNA ciphertext matrix to obtain the first scrambled matrix; wherein the first scrambled matrix obtained after the size conversion is consistent with the size of the second color component image.

[0014] In a second aspect, an embodiment of the present invention further provides an image encryption device, which includes: a preprocessing module, used to obtain an image to be encrypted, preprocess the image to be encrypted, and obtain a target image; a separation module, used to separate the target image into a preset number of first color component images according to color channels; a first scrambling module, used to perform row-column fusion index scrambling processing on the first color component image according to a preconfigured fusion index scrambling rule, and obtain a second color component image; a diffusion module, used to perform a diffusion operation on the second color component image according to a preconfigured diffusion algorithm, and obtain a first scrambled matrix; a division module, used to divide the first scrambled matrix into a preset number of third color component images according to the size of the target image; and a fusion module, used to fuse and transform the preset number of third color component images according to color channels to obtain an encrypted image.

[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method described in the first aspect.

[0016] In a fourth aspect, an embodiment of the present invention further provides a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method described in the first aspect.

[0017] The embodiments of the present invention bring the following beneficial effects:

[0018] An image encryption method, device and electronic device provided by an embodiment of the present invention can pre-process the image to be encrypted after obtaining it to obtain a target image; then separate the target image into a preset number of first color component images according to color channels; perform row and column fusion index scrambling processing on the first color component image according to a pre-configured fusion index scrambling rule to obtain a second color component image; perform a diffusion operation on the second color component image according to a pre-configured diffusion algorithm to obtain a first scrambled matrix; and divide the first scrambled matrix into a preset number of third color component images according to the size of the target image; then fuse and transform the preset number of third color component images according to color channels to obtain an encrypted image, and in the above scrambling process, a preset number of first color component images can be fused and scrambled, breaking the convention of independently processing each channel in the prior art, and significantly improving the complexity and security of image encryption.

[0019] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0020] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 A flowchart of an image encryption method provided by an embodiment of the present invention;

[0023] Figure 2 A general flow chart of an image encryption process provided by an embodiment of the present invention;

[0024] Figure 3 A schematic diagram of the structure of an image encryption device provided by an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0027] At present, chaotic encryption technology has become a research hotspot in the field of image encryption due to its good key sensitivity and complexity. However, in related technologies, images are mostly scrambled and diffused based on a single chaotic map. In addition, existing algorithms face problems such as poor real-time performance, small key space, and insufficient attack resistance when processing large-scale color images. Especially in scenarios with high security requirements, traditional encryption methods have limited performance in resisting differential attacks, noise attacks, and cropping attacks.

[0028] Specifically, the chaotic encryption technology in related technologies has the following main defects in image encryption:

[0029] (1) Channel-independent encryption ignores channel association:

[0030] At present, many color image encryption algorithms tend to process the red, green, and blue color channels separately. This independent encryption method ignores the correlation between color channels, resulting in high information redundancy and low encryption efficiency during the encryption process. In addition, independent encryption of each channel is also prone to potential security risks. For example, the decryption result of a certain channel can be used to infer part of the information of other channels.

[0031] (2) The key space is limited and vulnerable to exhaustive attacks:

[0032] The chaotic mapping used in many existing technologies has a relatively small key space and cannot effectively resist brute force attacks. The small key space allows attackers to find the correct key to decrypt the image by brute force searching all possible keys.

[0033] (3) Low efficiency of color image processing:

[0034] In the existing color image encryption technology, the amount of data processed for each channel is huge and the operation is independent, resulting in a large amount of overall encryption calculation and a long processing time, which is particularly evident in the encryption of high-resolution images.

[0035] In summary, the shortcomings of the existing technology are the redundancy and lack of security caused by independent channel processing, the small key space that is easy to be attacked by exhaustive attacks, and the low encryption efficiency.

[0036] Based on this, an image encryption method, device and electronic device provided by the embodiments of the present invention can effectively alleviate the above problems.

[0037] To facilitate understanding of this embodiment, an image encryption method disclosed in an embodiment of the present invention is first introduced in detail.

[0038] In a possible implementation, the present invention provides an image encryption method, such as Figure 1 The flowchart of an image encryption method shown in FIG. 1 comprises the following steps:

[0039] Step S102, obtaining an image to be encrypted, and preprocessing the image to be encrypted to obtain a target image;

[0040] In actual use, the image to be encrypted in the embodiment of the present invention usually refers to a color image to be encrypted, and the number of images to be encrypted can be one or more. Therefore, the image to be encrypted needs to be preprocessed. For example, when there are multiple images to be encrypted, the images to be encrypted need to be spliced. At the same time, the size of the target image meets the preset size to facilitate subsequent encryption processing.

[0041] Step S104, separating the target image into a preset number of first color component images according to color channels;

[0042] Among them, in the embodiment of the present invention, the correlation between color channels is taken into consideration. Therefore, in step S104, the target image is first separated into a preset number of first color component images according to the color channels, such as first color component images corresponding to the three color channels of R, G, and B. Then, in subsequent steps, the R, G, and B channels are reorganized to perform the scrambling process.

[0043] Step S106, performing row and column fusion index scrambling processing on a preset number of first color component images according to a pre-configured fusion index scrambling rule to obtain a second color component image;

[0044] Step S108, performing a diffusion operation on the second color component image according to a pre-configured diffusion algorithm to obtain a first scrambled matrix;

[0045] Among them, the above step S106 is a process of fusing and scrambling multiple first color component images, that is, first fusing each color channel, and then scrambling the rows and columns to achieve the scrambling process after the RGB channels of the original image to be encrypted are reorganized.

[0046] Furthermore, the diffusion operation process of step S108 is used to improve the security of the entire image encryption method, and then generate an encrypted image integrating color ciphertext in subsequent steps.

[0047] Step S110, dividing the first scrambled matrix into a preset number of third color component images according to the size of the target image;

[0048] Step S112, fusing and converting a preset number of third color component images according to color channels to obtain an encrypted image.

[0049] The image encryption method provided by the embodiment of the present invention can effectively improve the defect that color images are encrypted in a single plane in sequence, and the image encryption method provided by the embodiment of the present invention does not limit the number and size of images to be encrypted, and can safely encrypt multiple color images.

[0050] In actual use, in the above step S102, the process of preprocessing the image to be encrypted can be divided into a process of preprocessing multiple images to be encrypted and a process of preprocessing one image to be encrypted. Specifically, if the image to be encrypted includes multiple images, the multiple images are spliced ​​in sequence according to a preset method, and the spliced ​​images are filled to obtain a target image of a preset size; if the image to be encrypted includes one image, the image is directly determined as the target image.

[0051] Specifically, take n images to be encrypted as an example, represented as (P1, P2, P3, ... Pn), the size of each image to be encrypted is M i ×N i If the sizes of n images to be encrypted are the same, the n images to be encrypted can be arranged horizontally or vertically in sequence. If the sizes of the n images to be encrypted are different, a suitable arrangement method can be adopted to arrange the images to be encrypted. At the same time, the size of the part that is less than the preset size can be padded. In addition, multiple images to be encrypted can be arranged first and then padded, or padded first and then arranged. The specific arrangement or size filling method of the multiple images to be encrypted can be set according to actual usage, and the embodiment of the present invention does not limit this.

[0052] Furthermore, the preset number of first color component images in the above step S104 actually refers to color component images of three channels of R, G, and B. For example, P represents the target image, and the size of the target image is M×N. At this time, there are three first color component images, corresponding to the three channels of R, G, and B respectively, and the matrix corresponding to each first color component image is represented as PR, PG, and PB.

[0053] For the color component images of the three channels of R, G, and B obtained above, RGB channels need to be reorganized first in the subsequent steps. The process of RGB channel reorganization is the row-column fusion index scrambling processing process performed in the above step S106.

[0054] Furthermore, the fused index scrambling rule used in the embodiment of the present invention can randomly determine random columns and random rows according to a pre-constructed chaotic sequence, and then perform scrambling on the first color component image; and the chaotic sequence is stored in a pre-constructed chaotic sequence library, therefore, the embodiment of the present invention also includes a chaotic sequence construction process.

[0055] Specifically, in the embodiment of the present invention, when constructing the chaotic sequence, it is also constructed based on the target image, that is, in the above step S102, after obtaining the target image, key processing can be performed first to construct a chaotic sequence library containing multiple chaotic sequences, and then the subsequent image encryption processing process is performed. Specifically, the key processing includes the following process:

[0056] (1) Input the target image into a pre-configured secure hash algorithm to calculate the initial key;

[0057] (2) determining an initial value and a control parameter of a pre-established mapping model based on an initial key; wherein the mapping model is constructed based on a modular logic chaos model MLBCM, and the mapping model includes an LLB mapping model, an SLB mapping model, and a CLB mapping model;

[0058] (3) Inputting the initial values ​​and control parameters into the corresponding mapping models respectively to obtain multiple chaotic sequences;

[0059] (4) Construct a chaotic sequence library based on multiple chaotic sequences.

[0060] Specifically, in the embodiment of the present invention, the secure hash algorithm used in (1) above is the SHA-512 algorithm; when calculating the initial key, the pixel matrix of the target image P can be input into the SHA-512 algorithm to generate a 512-bit binary initial key key0, which is expressed as:

[0061] Key0=SHA-512(P)

[0062] Then, the output result of the SHA-512 algorithm is intercepted according to the preset interception parameters to obtain the initial key.

[0063] For example, the first 480 bits of key0 are intercepted, and each 10 bits is a group of data. The intercepted first 480 bits are divided into 48 groups in sequence, recorded as key = {key1, key2, key3, ..., key 48}, as the initial key in the embodiment of the present invention.

[0064] Furthermore, the initial key in the embodiment of the present invention is also used to calculate the initial value and control parameters of the subsequent fusion index scrambling. Specifically, the initial value includes x1, x2, x3 and control parameters α, β and γ, which are expressed as:

[0065]

[0066] The symbol bi2de means converting the input binary parameter into a decimal parameter. The XOR operator key1 to key48 represent the values ​​of the above initial keys.

[0067] In specific implementation, in the embodiment of the present invention, the initial values ​​and control parameters used include the initial values ​​and control parameters of the LLB mapping model, the SLB mapping model, and the CLB mapping model, respectively.

[0068] Specifically, the LLB mapping model, SLB mapping model, and CLB mapping model corresponding to the initial values ​​and control parameters are constructed based on the Modular-Logistic-Based Chaotic Model MLBCM, where the Modular-Logistic-Based Chaotic Model MLBCM is expressed as:

[0069] x n+1 =4kx n (1-F(k,x n )+μ)mod 1

[0070] Where, k and μ are control parameters, k∈(0,+∞), μ∈(0,+∞). F(k,x n ) is a one-dimensional seed chaotic map; mod is the remainder function; x n and x n+1 are the input and output of the model respectively, and n represents the dimension of the model.

[0071] In the embodiment of the present invention, the modular logic chaos model MLBCM uses Logistic, Chebyshev and Sine mapping as seed mappings, and is cascaded with the improved Logistic mapping to obtain the above mapping model.

[0072] Specifically, the Logistic seed mapping is input into the modular logic chaos model MLBCM to obtain a Logistic-Logistic (Logistic-Logistic-Based, LLB) mapping, that is, the LLB mapping model, whose mathematical expression is expressed as:

[0073] x n+1 =4αx n (1-αx n (1-x n )+μ)mod 1,x n ∈[0,1]

[0074] Among them, α and μ in this formula are adjustment parameters, and their value ranges are both (0, +∞).

[0075] Applying the Sine seed mapping to the modular logic chaos model MLBCM, we can obtain the Sine-Logistic (Sine-Logistic-Based, SLB) mapping, that is, the SLB mapping model, whose mathematical expression is expressed as:

[0076] x n+1 =4βx n (1-βsin(πx n )+μ)mod 1,x n ∈[0,1]

[0077] Among them, β and μ are control parameters, and their value ranges are both (0, +∞).

[0078] Using Chebyshev mapping as a seed and applying it to the modular logic chaos model MLBCM, we can get a Chebyshev-Logistic (Chebyshev-Logistic-Based, CLB) mapping, that is, the CLB mapping model, whose mathematical expression is expressed as:

[0079] x n+1 =4γx n (1-|cos(4γarcos(x n ))|+μ)mod 1,x n ∈[0,1]

[0080] Among them, γ and μ are control parameters, and their value ranges are both (0, +∞).

[0081] Further in (3) above, when calculating the chaotic sequence, the control parameter μ value can be set, for example, μ=30, and then x1 and β are substituted into the mathematical expression of the above SLB mapping model respectively to obtain the chaotic sequence A1, x2 and α are substituted into the mathematical expression of the above LLB mapping model respectively to obtain the chaotic sequence A2, and x3 and γ are substituted into the mathematical expression of the above CLB mapping model respectively to obtain the chaotic sequence A3.

[0082] Furthermore, the chaotic sequence library constructed in (4) above includes three chaotic sequences A1, A2, and A3.

[0083] Furthermore, based on the three chaotic sequences included in the chaotic sequence library, the scrambling and diffusion processes of step S106 and step S108 may be further performed.

[0084] The following is a detailed description of the scrambling and diffusion processes.

[0085] Specifically, the fusion index scrambling process in the embodiment of the present invention is actually to first perform column index scrambling processing on a preset number of first color component images according to a pre-configured fusion index scrambling rule, and to perform row index scrambling processing on the result of the column index scrambling processing to obtain a second color component image, which specifically includes the following process:

[0086] (1) horizontally arranging and combining a preset number of first color component images to obtain a first matrix; the first matrix is ​​used for column index scrambling;

[0087] Taking the aforementioned target image represented as P as an example, at this time, the preset number of first color component images include color component images corresponding to the R channel component, the G channel component and the B channel component respectively, and the matrices are represented as PR, PG, and PB.

[0088] In this process, the matrix representations PR, PG, and PB of the first color component image can be horizontally arranged and combined to obtain a first matrix. At this time, the first matrix is ​​a matrix of size M×3N, that is, 3N columns, which can be recorded as P1.

[0089] (2) traversing each column of the first matrix, and swapping each column with other random columns in turn, until all columns of the first matrix are traversed to complete the column index scrambling;

[0090] The random sequence is randomly determined based on the first chaotic sequence; the first chaotic sequence is a chaotic sequence in a chaotic sequence library, and the first chaotic sequence is obtained based on the SLB mapping model; for example, the aforementioned chaotic sequence A1 can be used as the first chaotic sequence.

[0091] In actual use, scanning can be performed from left to right to traverse each column of the first matrix, and the random column is determined by the first chaotic sequence A1, which can be expressed as A1 (1:3N), which means that 3N numbers are selected from the random numbers of the first chaotic sequence A1, and an array is randomly selected to represent any one of the 3N columns to replace it with the currently traversed column.

[0092] (3) dividing the first matrix after the column index scrambling into a plurality of first sub-matrices according to a preset number, and arranging the first sub-matrices vertically to obtain a second matrix; the second matrix is ​​used for row index scrambling;

[0093] In specific implementation, since the first matrix P1 is an M×3N matrix, after the column index scrambling is completed, when the row index scrambling is performed below, P1 needs to be re-divided into three uniformly sized M×N first sub-matrices, which can be expressed as PR1, PG1, and PB1, and then arranged vertically to obtain the second matrix. For example, from top to bottom, PR1, PG1, and PB1 are connected in sequence to form a single image of size 3M×N as the second matrix.

[0094] (4) traverse each row of the second matrix, and swap each row with other random rows in turn, until all rows of the second matrix are traversed to complete the row index scrambling;

[0095] The random behavior is randomly determined based on a second chaotic sequence; the second chaotic sequence is a chaotic sequence in a chaotic sequence library, and usually the second chaotic sequence is obtained based on the above-mentioned LLB mapping model, such as the above-mentioned chaotic sequence A2.

[0096] In this process, a top-down scanning method can be used for traversal. For example, the 3M×N second matrix can be scanned from top to bottom, and each row is exchanged with other random rows. At this time, the index sequence of the random rows is determined by the second chaotic sequence, for example, A2(3N+1:3N+3M).

[0097] (5) Determine the second matrix after completing the row index scrambling as the second color component image.

[0098] After the row index scrambling is completed, the second matrix at this time is the second color component image, and the size of the second color component image at this time is 3M×N.

[0099] At this point, the fusion index scrambling is completed.

[0100] After the above fusion index scrambling is completed, a diffusion operation is further performed.

[0101] Specifically, the diffusion operation in the embodiment of the present invention is a diffusion operation based on DNA encoding and decoding, including the following process:

[0102] (1) Selecting a matching chaotic sequence from a chaotic sequence library to generate a diffusion sequence, a dynamic encoding rule, a dynamic decoding rule, and a diffusion operation rule; the dynamic encoding rule includes a first encoding sub-rule and a second encoding sub-rule;

[0103] In specific implementation, the chaotic sequence selected in (1) is selected from the above chaotic sequence library. For example, the above A1, A2, and A3 are selected for calculation. E represents the diffusion sequence, R1 represents the first encoding sub-rule, R2 represents the second encoding sub-rule, R3 represents the dynamic decoding rule, and T represents the diffusion operation rule. The process of (1) here can be expressed as the following formula:

[0104]

[0105] Among them, end represents the last element of the chaotic sequence.

[0106] (2) converting the diffusion sequence into a diffusion sequence matrix with a size consistent with the second color component image;

[0107] (3) encoding the second color component image using the first encoding sub-rule to obtain a first encoding matrix, and encoding the transformed diffusion sequence matrix using the second encoding sub-rule to obtain a second encoding matrix;

[0108] For example, in (2) here, the diffusion sequence E can be converted into a 3M×N diffusion sequence matrix E1, and then the second color component image and the diffusion sequence matrix E1 are encoded respectively according to the dynamic encoding rules R1 and R2 to obtain a first encoding matrix U and a second encoding matrix D of size M1×N1 (M1=3M, N1=4N).

[0109] In actual use, the above encoding process may refer to AGCT base pairing encoding, and the specific encoding operation shall be subject to actual use, which is not limited in the embodiment of the present invention.

[0110] (4) constructing a DNA ciphertext matrix based on the first coding matrix, the second coding matrix, and a preset diffusion direction;

[0111] In this process, the value of the diffusion operation rule T is needed to determine the DNA operation mode, and then calculate the DNA ciphertext matrix. Specifically, assuming that the preset diffusion direction is four-directional diffusion: left → right → up → down, and C represents the DNA ciphertext matrix, the DNA ciphertext matrix C can be expressed as:

[0112]

[0113] Among them, cen is the last diffused pixel value, M1=3M, N1=4N.

[0114] (5) performing a decoding operation on the DNA ciphertext matrix according to the dynamic decoding rule, and performing a size conversion on the decoded DNA ciphertext matrix to obtain a first scrambled matrix;

[0115] The first scrambling matrix obtained after the size conversion is consistent with the size of the second color component image.

[0116] Here, in (5), the above-mentioned DNA ciphertext matrix is ​​decoded. The above-mentioned dynamic decoding rule R3 is used here. R3 usually represents an integer sequence. Usually, each integer in the integer sequence corresponds to a DNA dynamic decoding method. An integer in the integer sequence can be arbitrarily selected, and the DNA ciphertext matrix C is decoded using the corresponding DNA dynamic decoding method, and the size is converted. For example, in an embodiment of the present invention, the DNA ciphertext matrix C can be decoded and converted into a matrix of size 3M×N, which is the first scrambled matrix.

[0117] Furthermore, in order to obtain an encrypted image of the same size as the target image, it is necessary to divide the first scrambled matrix into a preset number of third color component images. For example, the 3M×N first scrambled matrix is ​​divided from top to bottom into three third color component images of equal size, which are used as color component images of the R channel component, the G channel component, and the B channel component, respectively, and RGB fusion conversion is performed to obtain the final ciphertext image, that is, the encrypted image in the embodiment of the present invention.

[0118] Further, for ease of understanding, Figure 2 A general flow chart of an image encryption process is also shown, specifically, as Figure 2 As shown, it includes an image to be encrypted, wherein the downward image preprocessing branch represents the process of constructing a chaotic sequence, and the constructed chaotic sequence is stored in a chaotic sequence library, which is used to scramble the column index and the row index of the target image. After the scrambling stage is completed, a diffusion operation is further performed, that is, the diffusion operation of the DNA codec, including Figure 2 The encrypted image is finally obtained through DNA dynamic encoding, multi-directional diffusion and DNA dynamic decoding.

[0119] Right now, Figure 2 The overview process of image encryption in the embodiment of the present invention is shown. The specific process represented by each block diagram can refer to the aforementioned method steps and will not be repeated again.

[0120] In summary, the image encryption method provided by the embodiment of the present invention can process the three color channels as a whole, thereby enhancing the integrity and security of image encryption, avoiding the information leakage problem caused by independent channel encryption, and effectively improving the ability to resist differential attacks and statistical attacks.

[0121] Furthermore, in the embodiment of the present invention, a modular logic chaos model is adopted to generate a more complex chaotic sequence, expand the key space, significantly improve the ability to resist brute force cracking, and enhance the randomness and security after encryption.

[0122] Moreover, in the embodiment of the present invention, through the combination of multidirectional diffusion and DNA coding, the randomness of the encrypted information is increased, and the image's resistance to attacks such as noise and cropping is effectively improved, which significantly improves the information entropy and enhances security.

[0123] Therefore, the image encryption method provided by the embodiment of the present invention effectively improves the security and efficiency of color image encryption, solves the problems of the prior art in terms of information redundancy, limited key space, insufficient anti-attack capability, and provides a more efficient and secure image encryption solution.

[0124] Further, based on the above embodiment, the embodiment of the present invention also provides an image encryption device, such as Figure 3A schematic diagram of the structure of an image encryption device is shown, the device comprising:

[0125] The preprocessing module 30 is used to obtain the image to be encrypted, and preprocess the image to be encrypted to obtain a target image;

[0126] A separation module 31, used for separating the target image into a preset number of first color component images according to color channels;

[0127] A first scrambling module 32, configured to perform row-column fusion index scrambling processing on the first color component image according to a pre-configured fusion index scrambling rule to obtain a second color component image;

[0128] A diffusion module 33, configured to perform a diffusion operation on the second color component image according to a preconfigured diffusion algorithm to obtain a first scrambled matrix;

[0129] A division module 34, configured to divide the first scrambled matrix into a preset number of third color component images according to the size of the target image;

[0130] The fusion module 35 is used to fuse and transform a preset number of third color component images according to color channels to obtain an encrypted image.

[0131] The image encryption device provided in the embodiment of the present invention has the same technical features as the image encryption method provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0132] Furthermore, an embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0133] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are executed.

[0134] Furthermore, an embodiment of the present invention also provides a structural diagram of an electronic device, such as Figure 4 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 41 and a memory 40, the memory 40 stores computer executable instructions that can be executed by the processor 41, and the processor 41 executes the computer executable instructions to implement the above method.

[0135] exist Figure 4In the illustrated embodiment, the electronic device further includes a bus 42 and a communication interface 43 , wherein the processor 41 , the communication interface 43 and the memory 40 are connected via the bus 42 .

[0136] Among them, the memory 40 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 43 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 42 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 42 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0137] The processor 41 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 41 or the instruction in the form of software. The above processor 41 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 41 reads the information in the memory and completes the above method in combination with its hardware.

[0138] The computer program product of the image encryption method, device and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.

[0139] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0140] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0141] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0142] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0143] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. An image encryption method, characterized in that: The method comprises: Acquire an image to be encrypted, and preprocess the image to be encrypted to obtain a target image; Separating the target image into a preset number of first color component images according to color channels; Performing row-column fusion index scrambling processing on a preset number of the first color component images according to a pre-configured fusion index scrambling rule to obtain a second color component image; Performing a diffusion operation on the second color component image according to a preconfigured diffusion algorithm to obtain a first scrambled matrix; Dividing the first scrambled matrix into a preset number of third color component images according to the size of the target image; A preset number of third color component images are fused and converted according to color channels to obtain an encrypted image.

2. The method according to claim 1, characterized in that in, The fusion index scrambling rule randomly determines random columns and random rows according to a pre-constructed chaotic sequence to perform scrambling on the first color component image; The chaotic sequence is stored in a pre-built chaotic sequence library; The method further comprises: Input the target image into a pre-configured secure hash algorithm to calculate an initial key; Determine the initial value and control parameter of the pre-established mapping model based on the initial key; wherein the mapping model is constructed based on the modular logic chaos model MLBCM, and the mapping model includes an LLB mapping model, an SLB mapping model, and a CLB mapping model; Inputting the initial value and the control parameter into corresponding mapping models respectively to obtain a plurality of chaotic sequences; The chaotic sequence library is constructed based on a plurality of the chaotic sequences.

3. The method according to claim 2, characterized in that The secure hash algorithm is the SHA-512 algorithm; The step of inputting the target image into a pre-configured secure hash algorithm to calculate an initial key comprises: The pixel matrix of the target image is input into the SHA-512 algorithm, and the output result of the SHA-512 algorithm is intercepted according to the preset interception parameters to obtain the initial key.

4. The method according to claim 1, characterized in that: The step of preprocessing the image to be encrypted to obtain a target image includes: If the image to be encrypted includes multiple images, the multiple images are sequentially spliced ​​together in a preset manner, and the spliced ​​images are filled to obtain the target image of a preset size; If the image to be encrypted includes one image, the image is determined as the target image.

5. The method according to claim 2, characterized in that: The step of performing row and column fusion index scrambling processing on a preset number of the first color component images according to a pre-configured fusion index scrambling rule to obtain a second color component image includes: According to the pre-configured fusion index scrambling rule, column index scrambling processing is first performed on a preset number of the first color component images, and row index scrambling processing is performed on the results of the column index scrambling processing to obtain the second color component images.

6. The method according to claim 5, characterized in that The steps of first performing column index scrambling processing on a preset number of the first color component images according to a pre-configured fusion index scrambling rule, and performing row index scrambling processing on the results of the column index scrambling processing include: Arrange and combine a preset number of the first color component images horizontally to obtain a first matrix; the first matrix is ​​used for column index scrambling; Traversing each column of the first matrix, and sequentially exchanging each column with other random columns until all columns of the first matrix are traversed to complete the column index scrambling; wherein the random column is randomly determined based on a first chaotic sequence; the first chaotic sequence is a chaotic sequence in the chaotic sequence library, and the first chaotic sequence is obtained based on the SLB mapping model; Dividing the first matrix after the column index scrambling into a plurality of first sub-matrices according to the preset number, and arranging the first sub-matrices vertically to obtain a second matrix; the second matrix is ​​used for row index scrambling; Traversing each row of the second matrix, and sequentially exchanging each row with other random rows until all rows of the second matrix are traversed to complete the row index scrambling; wherein the random row is randomly determined based on a second chaotic sequence; the second chaotic sequence is a chaotic sequence in the chaotic sequence library, and the second chaotic sequence is obtained based on the LLB mapping model; The second matrix with row index scrambling completed is determined as a second color component image.

7. The method according to claim 2, characterized in that The diffusion operation is a diffusion operation based on DNA encoding and decoding; The step of performing a diffusion operation on the second color component image according to a preconfigured diffusion algorithm to obtain a first scrambled matrix includes: Selecting a matching chaotic sequence from the chaotic sequence library to generate a diffusion sequence, a dynamic encoding rule, a dynamic decoding rule and a diffusion operation rule; the dynamic encoding rule includes a first encoding sub-rule and a second encoding sub-rule; Converting the diffusion sequence into a diffusion sequence matrix having a size consistent with the second color component image; Using the first encoding sub-rule to encode the second color component image to obtain a first encoding matrix, and using the second encoding sub-rule to encode the transformed diffusion sequence matrix to obtain a second encoding matrix; Constructing a DNA ciphertext matrix based on the first coding matrix, the second coding matrix, and the preset diffusion direction; Performing a decoding operation on the DNA ciphertext matrix according to the dynamic decoding rule, and performing a size conversion on the decoded DNA ciphertext matrix to obtain the first scrambled matrix; After the size conversion, the first scrambling matrix is ​​consistent with the size of the second color component image.

8. An image encryption device, characterized in that: The device comprises: A preprocessing module is used to obtain an image to be encrypted, and preprocess the image to be encrypted to obtain a target image; A separation module, used for separating the target image into a preset number of first color component images according to color channels; A first scrambling module, configured to perform row-column fusion index scrambling processing on the first color component image according to a preconfigured fusion index scrambling rule to obtain a second color component image; A diffusion module, configured to perform a diffusion operation on the second color component image according to a preconfigured diffusion algorithm to obtain a first scrambled matrix; A division module, used for dividing the first scrambling matrix into a preset number of third color component images according to the size of the target image; The fusion module is used to fuse and transform a preset number of third color component images according to color channels to obtain an encrypted image.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method according to any one of claims 1 to 7.

10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method according to any one of claims 1 to 7.