An image encryption method, device, equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRICULTURAL BANK OF CHINA
- Filing Date
- 2022-10-28
- Publication Date
- 2026-08-07
AI Technical Summary
[0005]本发明提供了一种图像加密的方法、装置、设备及存储介质,以解决图像加密安全性不高的问题
[0019] The image encryption scheme provided in this invention utilizes a preset chaotic system to iteratively process the image to be sent, obtaining at least four chaotic sequences. The preset chaotic system is determined based on a four-dimensional chaotic system. The chaotic sequences undergo bidirectional diffusion processing to obtain an initial encryption sequence. A preset DNA encoding rule is then used to encode the initial encryption sequence to obtain a target encryption sequence, thereby encrypting the image to be sent. By employing this technical solution, the image to be sent is first iteratively processed using a preset chaotic system to obtain at least four chaotic sequences. Then, the chaotic sequences undergo bidirectional diffusion processing to obtain an initial encryption sequence. Finally, the initial encryption sequence undergoes DNA encoding processing to obtain the target encryption sequence, thus completing the encryption of the image to be sent. Through iterative processing, bidirectional diffusion processing, and DNA encoding, the confidentiality of the image to be sent is improved, and the encryption method is relatively simple and convenient. Compared with directly performing asymmetric encryption on the image to be sent, this method does not require a large amount of resources for asymmetric decryption and key management, and reduces the resource consumption on the server during the decryption process.
Smart Images

Figure CN115695672B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information encryption technology, and in particular to a method, apparatus, device, and storage medium for image encryption. Background Technology
[0002] With the continuous development of information technology, information transmission between different objects has become increasingly common, such as image transmission. Image data is a type of data with strong correlation between adjacent pixels, making it easy to be detected and stolen during transmission.
[0003] Currently, image encryption transmission typically employs asymmetric encryption, encrypting image data before transmission. Asymmetric encryption algorithms usually require two keys for encryption and decryption: a public key and a private key. If image data is encrypted using the public key, it can only be decrypted using the corresponding private key; conversely, if image data is encrypted using the private key, it can only be decrypted using the corresponding public key.
[0004] However, commonly used encryption keys are usually fixed keys, which are at risk of being leaked and have low security. At the same time, image data has a certain degree of redundancy. If a more complex algorithm is used for encryption, there will be high computational and time costs. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for image encryption to solve the problem of low security in image encryption.
[0006] In a first aspect, embodiments of the present invention provide a method for image encryption, comprising:
[0007] The image to be sent is iteratively processed using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system;
[0008] The chaotic sequence is subjected to bidirectional diffusion processing to obtain an initial encrypted sequence;
[0009] The initial encryption sequence is encoded using a preset DNA encoding rule to obtain the target encryption sequence, thereby encrypting the image to be sent.
[0010] Secondly, embodiments of the present invention provide an image encryption device, comprising:
[0011] A chaotic sequence determination module is used to iteratively process the image to be sent using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system.
[0012] The first encryption module is used to perform bidirectional diffusion processing on the chaotic sequence to obtain an initial encryption sequence.
[0013] The second encryption module is used to encode the initial encryption sequence using a preset DNA encoding rule to obtain the target encryption sequence, thereby encrypting the image to be sent.
[0014] Thirdly, embodiments of the present invention provide an electronic device, the electronic device comprising:
[0015] At least one processor;
[0016] and memory that is communicatively connected to at least one processor;
[0017] The memory stores a computer program that can be executed by at least one processor, which enables the at least one processor to perform the image encryption method described in the first aspect.
[0018] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing a processor to execute the image encryption method described in the first aspect.
[0019] The image encryption scheme provided in this invention utilizes a preset chaotic system to iteratively process the image to be sent, obtaining at least four chaotic sequences. The preset chaotic system is determined based on a four-dimensional chaotic system. The chaotic sequences undergo bidirectional diffusion processing to obtain an initial encryption sequence. A preset DNA encoding rule is then used to encode the initial encryption sequence to obtain a target encryption sequence, thereby encrypting the image to be sent. By employing this technical solution, the image to be sent is first iteratively processed using a preset chaotic system to obtain at least four chaotic sequences. Then, the chaotic sequences undergo bidirectional diffusion processing to obtain an initial encryption sequence. Finally, the initial encryption sequence undergoes DNA encoding processing to obtain the target encryption sequence, thus completing the encryption of the image to be sent. Through iterative processing, bidirectional diffusion processing, and DNA encoding, the confidentiality of the image to be sent is improved, and the encryption method is relatively simple and convenient. Compared with directly performing asymmetric encryption on the image to be sent, this method does not require a large amount of resources for asymmetric decryption and key management, and reduces the resource consumption on the server during the decryption process.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an image encryption method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart of an image encryption method provided according to Embodiment 2 of the present invention;
[0024] Figure 3 This is a schematic diagram of the structure of an image encryption device according to Embodiment 3 of the present invention;
[0025] Figure 4 This is a schematic diagram of the structure of an electronic device provided according to Embodiment 4 of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. In the description of this invention, unless otherwise stated, "a plurality of" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0028] Example 1
[0029] Figure 1 The flowchart below provides an image encryption method according to Embodiment 1 of the present invention. This embodiment is applicable to the situation of encrypting images to be sent. The method can be executed by an image encryption device, which can be implemented in hardware and / or software. The image encryption device can be configured in an electronic device, which can be composed of two or more physical entities or a single physical entity.
[0030] like Figure 1 As shown, the image encryption method provided in Embodiment 1 of the present invention specifically includes the following steps:
[0031] S101. The image to be sent is iteratively processed using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system.
[0032] In this embodiment, a preset chaotic system can be determined first, such as a four-dimensional chaotic system. Then, the image to be sent is converted into a set representation, such as a multi-dimensional vector. The image to be sent in this set representation and the initial value of the preset chaotic system, such as (1,-1,1,-1), are input into the preset chaotic system and iterated multiple times, such as 10,000 times, so that at least four chaotic sequences can be obtained. The number of chaotic sequences is greater than or equal to the dimension of the preset chaotic system. Compared with other chaotic systems, the four-dimensional chaotic system has the advantages of moderate computational resource consumption and large key space. The role of setting the initial value can be understood as scrambling the chaotic system.
[0033] S102. Perform bidirectional diffusion processing on the chaotic sequence to obtain the initial encrypted sequence.
[0034] In this embodiment, the chaotic sequence obtained in the above steps can be subjected to a first encryption process, namely bidirectional diffusion, to convert the chaotic sequence into ciphertext, thereby obtaining the initial encrypted sequence. Compared with the traditional unidirectional diffusion process, bidirectional diffusion can improve the efficiency of encryption and decryption. Bidirectional diffusion can be understood as hiding the information of plaintext pixels in as many ciphertext pixels as possible from both the beginning and end without changing the pixel positions.
[0035] S103. Encode the initial encryption sequence using a preset DNA encoding rule to obtain the target encryption sequence, thereby encrypting the image to be sent.
[0036] In this embodiment, the initial encrypted sequence obtained after bidirectional diffusion is subjected to a second encryption process, namely DNA encoding. Using DNA encoding technology, not only can the data information of the initial encrypted sequence be accurately stored with a small number of base sequences, namely adenine (A), thymine (T), cytosine (C), and guanine (G), but also the encoding method corresponding to each element in the initial encrypted sequence can be determined from the preset DNA encoding rules according to the order of the elements contained in the initial encrypted sequence. The initial encrypted sequence is then encrypted using this encoding method to obtain the target encrypted sequence, which is the encryption result of the image to be sent. The preset DNA encoding rules may include multiple encoding methods.
[0037] The image encryption method provided in this invention utilizes a preset chaotic system to iteratively process the image to be sent, obtaining at least four chaotic sequences. The preset chaotic system is determined based on a four-dimensional chaotic system. The chaotic sequences undergo bidirectional diffusion processing to obtain an initial encryption sequence. Finally, the initial encryption sequence is encoded using a preset DNA encoding rule to obtain a target encryption sequence, thereby encrypting the image to be sent. The technical solution of this invention first uses a preset chaotic system to iteratively process the image to be sent, obtaining at least four chaotic sequences. Then, the chaotic sequences undergo bidirectional diffusion processing to obtain an initial encryption sequence. Finally, the initial encryption sequence undergoes DNA encoding processing to obtain the target encryption sequence, thus completing the encryption of the image to be sent. Through iterative processing, bidirectional diffusion processing, and DNA encoding, the confidentiality of the image to be sent is improved, and the encryption method is relatively simple and convenient. Compared with directly performing asymmetric encryption on the image to be sent, this method does not require a large amount of resources for asymmetric decryption and key management, and reduces the resource consumption on the server during the decryption process.
[0038] Example 2
[0039] Figure 2 This is a flowchart of an image encryption method provided in Embodiment 2 of the present invention. The technical solution of the present invention is further optimized based on the above optional technical solutions, and a specific method for encrypting images is given.
[0040] Optionally, the iterative processing of the image to be sent using a preset chaotic system to obtain at least four chaotic sequences includes: determining the grayscale image corresponding to each color channel in the image to be sent, wherein the number of color channels is at least three; for each color channel, calculating the quotient of the sum of the brightness values of each pixel in the grayscale image corresponding to the current color channel and the number of pixels in the image to be sent, to obtain the average pixel value corresponding to the current color channel; and performing iterative calculations on the preset chaotic system based on a preset initial value and the average pixel value to determine four chaotic sequences corresponding to each color channel, wherein each of the four chaotic sequences corresponding to each color channel contains three monochrome chaotic sequences and one regular chaotic sequence. The advantage of this setup is that it uses four-dimensional space to encrypt the image, making the encrypted image difficult to crack.
[0041] Optionally, the chaotic sequence is subjected to bidirectional diffusion processing to obtain an initial encryption sequence, including: determining a monochrome image sequence corresponding to each color channel in the image to be sent; for each color channel, when the number of pixels in the image to be sent is even, performing a dilation operation on the monochrome image sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel to obtain a first sequence corresponding to the current color channel, wherein each of the three monochrome chaotic sequences corresponding to each color channel contains one red chaotic sequence and one green chaotic sequence; for each color channel, when the number of pixels in the image to be sent is even, performing a dilation operation on the first sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel to obtain a second sequence corresponding to the current color channel; for each color channel, concatenating the first sequence and the second sequence corresponding to the current color channel to obtain the initial encryption sequence corresponding to the current color channel. The advantage of this setup is that the confidentiality of the image to be sent is improved through bidirectional diffusion processing of the monochrome image sequence and the monochrome chaotic sequence of the image to be sent.
[0042] Optionally, the step of encoding the initial encrypted sequence using a preset DNA encoding rule to obtain the target encrypted sequence includes: converting the initial encrypted sequence into a binary bit sequence; determining the encoding method of the binary bit sequence in the encoding table corresponding to the preset DNA encoding rule based on the correspondence between the initial encrypted sequence and the rule-based chaotic sequence, and encoding the binary bit sequence according to the encoding method to obtain the target encrypted sequence. The advantage of this setup is that by using the preset DNA encoding rule to perform secondary encryption on the binary bit sequence of the image to be sent, the security of the image to be sent is further improved.
[0043] Optionally, before iteratively processing the image to be sent using a preset chaotic system to obtain at least four chaotic sequences, the method further includes: establishing a secure communication channel with the server based on a user identifier and a preset password, wherein the secure communication channel is established based on fifth-generation mobile communication technology. The advantage of this setup is that a secure information exchange channel can be established before image transmission using the user identifier and preset password.
[0044] like Figure 2 As shown in Embodiment 2 of the present invention, an image encryption method specifically includes the following steps:
[0045] S201. Establish a secure communication channel with the server based on the user identifier and preset password.
[0046] The secure communication channel is established based on fifth-generation mobile communication technology.
[0047] For example, users can register on the client, which generates a unique identifier, the user identifier. Users can also set a custom password, the preset password. Before encrypting images to be sent, the system checks if the user identifier entered during login matches the preset password to determine if a secure communication channel with the server can be established. If the user identifier and password match, the login process is complete, thus establishing a secure communication channel with the server. This secure communication channel, established using 5G mobile communication technology, ensures efficient information exchange.
[0048] S202. Determine the grayscale image corresponding to each color channel in the image to be sent.
[0049] The number of color channels is at least three.
[0050] Specifically, the image to be sent can be decomposed into red, green and blue channels, and a grayscale image corresponding to each channel can be generated.
[0051] S203. For each color channel, calculate the quotient of the sum of the brightness values of each pixel in the grayscale image corresponding to the current color channel and the number of pixels in the image to be sent, to obtain the average pixel value corresponding to the current color channel.
[0052] For example, the average pixel values of the red, green, and blue channels can be determined as follows: Among them, avg r avg represents the average pixel value of the red channel. g avg represents the average pixel value of the green channel. bR represents the average pixel value of the blue channel, G represents the red channel, B represents the blue channel, (i,j) represents the brightness value of the pixel in the i-th row and j-th column of the grayscale image of the corresponding color channel, XY represents the number of pixels in the image to be sent, N represents the total number of rows of pixels in the image to be sent, and M represents the total number of columns of pixels in the image to be sent.
[0053] S204. Based on the preset initial value and the average value of each pixel, perform iterative calculations on the preset chaotic system to determine the four chaotic sequences corresponding to each color channel.
[0054] Each of the four chaotic sequences corresponding to each color channel contains three monochrome chaotic sequences and one regular chaotic sequence.
[0055] For example, the mathematical representation of a predefined chaotic system can be...
[0056]
[0057] Among them, α=19, β=8, θ=10, When η = 2, the pre-defined chaotic system exhibits hyperchaos, possesses an attractor, and exhibits complex dynamic behavior with strong randomness. The Lyapunov exponent is approximately 3.2. The chaos value (x) of this pre-defined chaotic system... k y k , z k w k The update method can be
[0058]
[0059] The above method can be used to perform multiple iterative operations on a preset chaotic system. For example, if iterates 10,000 times, then k = 0, 1, ..., 10,000, and the preset initial value (x′, y′, z′, w′) = (1, -1, 1, -1). Given the average pixel value of each color channel, four chaotic values can be determined in each iteration, namely x... k y k z k and w k After multiple iterations, multiple chaotic values can be obtained. Using a predefined processing method, such as grouping after modulo calculation, the multiple chaotic values after modulo calculation can be divided into three groups, each corresponding to a color channel. Each group contains four chaotic sequences, thus obtaining four chaotic sequences corresponding to each color channel: three monochrome chaotic sequences and one regular chaotic sequence. Where x... k The corresponding chaotic sequence is a monochromatic chaotic sequence, i.e., a red chaotic sequence, y k The corresponding chaotic sequence is a monochromatic chaotic sequence, i.e., a green chaotic sequence, zk The corresponding chaotic sequence is a monochromatic chaotic sequence, i.e., a blue chaotic sequence, w k The corresponding chaotic sequence is a regular chaotic sequence.
[0060] Optionally, the step of iteratively calculating a preset chaotic system based on a preset initial value and the average value of each pixel to determine four chaotic sequences corresponding to each color channel includes: iteratively calculating the preset chaotic system using the preset initial value and the average value of each pixel to obtain four chaotic value sets; filtering out a preset number of elements from each chaotic value set, and performing a setting process on the chaotic value sets after element filtering to determine the four chaotic sequences corresponding to each color channel, wherein the chaotic value set consists of multiple elements, and the setting process includes rounding, taking the absolute value, and taking the remainder. The advantage of this setting is that by filtering out a preset number of elements, the problem of potential transition states in the chaotic system can be solved.
[0061] Specifically, as mentioned above, after iterating through the chaotic system multiple times, multiple chaotic values can be obtained, and multiple x values can be represented. k Integrate into the first chaotic value set, and combine multiple y values. k Integrate into a second chaotic value set, combining multiple z k Integrate into a third chaotic value set, combining multiple w k This is integrated into a fourth chaotic value set, resulting in four chaotic value sets. Then, for each chaotic value set, a preset number of elements can be removed, such as 500, meaning 500 x elements can be filtered out. k y k z k and w k Then, the four sets of chaotic values after filtering are further processed to obtain four chaotic sequences for each color channel, for a total of 12 chaotic sequences.
[0062] For example, the determination method corresponding to the setting process can be...
[0063]
[0064] Where, n represents the number of elements to be excluded from the preset quantity, the floor() function is used for rounding, the abs() function is used for taking the absolute value, the mod function is used for taking the remainder, L is the red chaotic sequence, M is the green chaotic sequence, N is the blue chaotic sequence, O is the regular chaotic sequence, m is used to determine the number of elements of the four chaotic sequences corresponding to each color channel. If iterating 2000 times and excluding 501 elements from each set of chaotic values, and there are still 1500 elements left, then m can be 0, 500, and 1000. Corresponding l = m,..., 500 + m. l is used to represent the l-th element in the chaotic sequence. That is, when m = 0, the four chaotic sequences corresponding to the red channel can be obtained. When m = 500, the four chaotic sequences corresponding to the green channel can be obtained. When m = 1000, the four chaotic sequences corresponding to the blue channel can be obtained. Thus, the number of elements in each chaotic sequence corresponding to each color channel can be 500. Among them, the number of elements in each chaotic sequence can be the same as the number of pixels of the image to be transmitted.
[0065] S205. Determine the monochromatic image sequence corresponding to each color channel in the image to be transmitted.
[0066] Specifically, the luminance values of the grayscale images corresponding to the red channel, the green channel, and the blue channel can be extracted respectively, and then integrated into the corresponding red image sequence, green image sequence, and blue image sequence.
[0067] S206. For each of the color channels, when the number of pixels of the image to be transmitted is an even number, perform a dilation operation on the monochromatic image sequence, red chaotic sequence, and green chaotic sequence corresponding to the current color channel to obtain the first sequence corresponding to the current color channel.
[0068] Among them, each of the three monochromatic chaotic sequences corresponding to each color channel contains one red chaotic sequence and one green chaotic sequence.
[0069] Exemplarily, when XY is an even number, the determination method of the first sequence SR1 corresponding to the red channel can be
[0070] When l = 1,
[0071]
[0072] When 2 ≤ l < XY / 2,
[0073]
[0074] Among them, SR1(l) represents the l-th element in the first sequence corresponding to the red channel, IR(l) represents the l-th element in the red image sequence, LR1(l) represents the l-th element in the red chaotic sequence corresponding to the red channel, MR1(XY) represents the XY-th element in the green chaotic sequence corresponding to the red channel, and ⊕ represents the dilation operation symbol. Each sequence consists of multiple monochromatic elements. Correspondingly, if we want to determine the first sequence SG1 corresponding to the green channel and the first sequence SB1 corresponding to the blue channel, we can perform dilation operations on the monochromatic image sequences, red chaotic sequences, and green chaotic sequences corresponding to the green channel and the blue channel respectively using the above calculation method.
[0075] Optionally, when XY is odd, the determination method of the first sequence SR1 corresponding to the red channel can be
[0076] When l = 1,
[0077]
[0078] When 2 ≤ l < XY / 2,
[0079]
[0080] Among them, NR1(l) represents the l-th element in the blue chaotic sequence corresponding to the red channel.
[0081] S207. For each of the color channels, when the number of pixels of the image to be transmitted is even, perform dilation operations on the first sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel to obtain the second sequence corresponding to the current color channel.
[0082] Exemplarily, when XY is even, the determination method of the second sequence SR2 corresponding to the red channel can be
[0083] When l = 1 + XY / 2,
[0084]
[0085] When 2 + XY / 2 ≤ l < XY,
[0086]
[0087] Among them, SR2(l) represents the l-th element in the second sequence corresponding to the red channel. Correspondingly, if we want to determine the second sequence SG2 corresponding to the green channel and the second sequence SB2 corresponding to the blue channel, we can perform dilation operations on the monochromatic image sequences, regular chaotic sequences, and blue chaotic sequences corresponding to the green channel and the blue channel respectively using the above calculation method.
[0088] Optionally, when XY is odd, the determination method of the second sequence SR2 corresponding to the red channel can be
[0089] When l = 1+(XY - 1) / 2,
[0090]
[0091] When 2+(XY - 1) / 2 ≤ l < XY,
[0092]
[0093] S208. For each of the color channels, splice the first sequence corresponding to the current color channel and the second sequence to obtain the initial encryption sequence corresponding to the current color channel.
[0094] Exemplarily, as described above, SR1 and SR2 can be spliced together to obtain the initial encryption sequence corresponding to the red channel. By analogy, SG1 and SG2 can be spliced together to obtain the initial encryption sequence corresponding to the green channel, and SB1 and SB2 can be spliced together to obtain the initial encryption sequence corresponding to the blue channel.
[0095] S209. Convert the initial encryption sequence into a binary bit sequence.
[0096] Exemplarily, if the first element value of the initial encryption sequence is 12, the corresponding 8-bit binary value is 00001100. Convert each element value in the three initial encryption sequences into binary values, and then three sequences represented by binary values, that is, binary bit sequences, can be correspondingly obtained.
[0097] S210. According to the corresponding relationship between the initial encryption sequence and the regular chaotic sequence, determine the encoding method of the binary bit sequence in the encoding table corresponding to the preset DNA encoding rule, and encode the binary bit sequence according to the encoding method to obtain the target encryption sequence, so as to encrypt the to-be-sent image.
[0098] Exemplarily, since each color channel corresponds to a regular chaotic sequence and each color channel also corresponds to an initial encryption sequence, there is also a corresponding relationship between the initial encryption sequence and the regular chaotic sequence. The encoding table corresponding to the preset DNA encoding rule is shown in the following Table 1 Base Encoding Table:
[0099] Table 1 Base Encoding Table
[0100] A 00 00 01 01 10 10 11 11 C 01 10 00 11 00 11 01 10 G 10 01 11 00 11 00 10 01 T 11 11 10 10 01 01 00 00
[0101] If the first 8-bit binary value in the binary bit sequence is 00001100, and the first element in the corresponding chaotic sequence is 2, then the encoding rules in the second column of the table are used to convert 00 to A, 10 to C, 01 to G, and 11 to T. Thus, 00001100 can be converted to AATA. Following the above method, the binary bit sequence corresponding to each color can be converted into the base representation, thereby obtaining the target encrypted sequence.
[0102] Optionally, after obtaining the target encrypted sequence, the method further includes: dynamically encrypting the encryption key value using a preset asymmetric encryption algorithm to obtain a decryption key value; and sending the target encrypted sequence and the decryption key value to the server via the secure communication channel to achieve encrypted transmission of the image to be sent. The encryption key value is determined based on a preset initial value from the iterative processing, and the target encrypted sequence and the decryption key value instruct the server to decrypt the target encrypted sequence using the decryption key value to obtain the decrypted image to be sent. The advantage of this approach is that, compared to traditional asymmetric encryption of the image to be sent, encrypting only the encryption key value achieves the same effect as encrypting the image to be sent while significantly reducing the computational load of encryption and decryption.
[0103] Specifically, an asymmetric encryption algorithm can be used to encrypt a preset initial value corresponding to a regular chaotic sequence, obtaining the encrypted preset initial value, i.e., the decryption key. The server possesses the private key for this encryption. Then, based on an established secure communication channel, the decryption key and the target encrypted sequence are sent to the server through this channel, thus achieving encrypted transmission of the image to be sent. Dynamic encryption can be understood as the private key changing dynamically after each asymmetric encryption, rather than being a fixed value. The specific implementation method is not limited here.
[0104] Optionally, after receiving the decryption key value and the target encrypted sequence, the server can first decrypt the decryption key value using its private key to obtain a preset initial value corresponding to the regular chaotic sequence. Using this preset initial value and a preset chaotic system, the server can calculate the regular chaotic sequence corresponding to each color channel. Then, using this regular chaotic sequence, the target encrypted sequence can be restored to three initial encrypted sequences. A bidirectional diffusion inverse operation is then performed on the initial encrypted sequences to determine the four chaotic sequences corresponding to each color channel. Finally, the preset chaotic system is used to perform an inverse operation on the chaotic sequences to obtain the image to be sent. In addition to the decryption key value and the target encrypted sequence, the information sent to the server can also include basic information about the image to be sent, such as the sum of the average pixel values for each color channel, so that the server can calculate the chaotic sequence corresponding to each color channel. The bidirectional diffusion inverse operation can be:
[0105] When XY is even, 1≤l<XY / 2-1
[0106]
[0107] When l = XY / 2 - 1
[0108]
[0109] When XY / 2≤l≤XY-1
[0110]
[0111] When l = XY
[0112]
[0113] When XY is odd and 1≤l<(XY-1) / 2,
[0114]
[0115] When l = (XY-1) / 2 + 1
[0116]
[0117] When XY / 2≤l≤XY-1
[0118]
[0119] When l = XY
[0120]
[0121] Where JR1(l) represents the l-th element in the first decryption sequence corresponding to the red channel, JR2(l) represents the l-th element in the second decryption sequence corresponding to the red channel, LR2(l) represents the l-th element in the initial red encryption sequence corresponding to the red channel, MR2(XY) represents the XY-th element in the initial green encryption sequence corresponding to the red channel, and NR2(XY) represents the XY-th element in the initial blue encryption sequence corresponding to the red channel. The green and blue channels can also be decrypted using the aforementioned inverse expansion operation.
[0122] The image encryption method provided in this invention first determines the average pixel value of the grayscale image corresponding to each color channel of the image to be sent. Then, using a preset initial value and the average pixel value, iterative calculations are performed on a preset chaotic system to obtain three monochrome chaotic sequences and one regular chaotic sequence corresponding to each color channel. Next, bidirectional diffusion processing is applied to the chaotic sequence to obtain an initial encryption sequence. Finally, using the correspondence between the initial encryption sequence and the regular chaotic sequence, DNA encoding processing is performed on the initial encryption sequence to obtain the target encryption sequence, thus completing the encryption of the image to be sent. Compared with other high-dimensional chaotic systems, using a four-dimensional chaotic system to encrypt the image makes the encrypted image less susceptible to cracking, provides a larger key space, and has better resistance to brute-force attacks, thus enhancing security and reliability. Furthermore, it has lower computational costs and lower requirements for system hardware resources.
[0123] Example 3
[0124] Figure 3 This is a schematic diagram of the structure of an image encryption device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a chaotic sequence determination module 301, a first encryption module 302, and a second encryption module 303, wherein:
[0125] A chaotic sequence determination module is used to iteratively process the image to be sent using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system.
[0126] The first encryption module is used to perform bidirectional diffusion processing on the chaotic sequence to obtain an initial encryption sequence.
[0127] The second encryption module is used to encode the initial encryption sequence using a preset DNA encoding rule to obtain the target encryption sequence, thereby encrypting the image to be sent.
[0128] The image encryption device provided in this embodiment of the invention first uses a preset chaotic system to iteratively process the image to be sent to obtain at least four chaotic sequences. Then, the chaotic sequences are subjected to bidirectional diffusion processing to obtain an initial encryption sequence. Finally, the initial encryption sequence is subjected to DNA encoding processing to obtain a target encryption sequence, thereby completing the encryption processing of the image to be sent. Through iterative processing, bidirectional diffusion processing, and DNA encoding processing, the confidentiality of the image to be sent is improved, and the encryption method is relatively simple and convenient. Compared with the method of directly performing asymmetric encryption on the image to be sent, this method does not require a large amount of resources for asymmetric decryption and key management, and reduces the resource consumption of the server during the decryption process.
[0129] Optionally, the chaotic sequence determination module includes:
[0130] A grayscale image determination unit is used to determine the grayscale image corresponding to each color channel in the image to be sent, wherein the number of color channels is at least three;
[0131] The pixel average value determination unit is used to calculate, for each color channel, the quotient of the sum of the brightness values of each pixel in the grayscale image corresponding to the current color channel and the number of pixels in the image to be sent, to obtain the pixel average value corresponding to the current color channel;
[0132] The chaotic sequence determination unit is used to perform iterative calculations on a preset chaotic system based on a preset initial value and the average value of each pixel to determine four chaotic sequences corresponding to each color channel, wherein each of the four chaotic sequences corresponding to each color channel contains three monochrome chaotic sequences and one regular chaotic sequence.
[0133] Optionally, the first encryption module includes:
[0134] A vector determination unit is used to determine the monochrome image sequence corresponding to each color channel in the image to be sent;
[0135] The first sequence determination unit is used to perform a dilation operation on the monochrome image sequence, red chaotic sequence and green chaotic sequence corresponding to the current color channel for each color channel when the number of pixels of the image to be sent is even, so as to obtain the first sequence corresponding to the current color channel. The three monochrome chaotic sequences corresponding to each color channel contain one red chaotic sequence and one green chaotic sequence.
[0136] The second sequence determination unit is used to perform a dilation operation on the first sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel for each color channel when the number of pixels in the image to be sent is even, so as to obtain the second sequence corresponding to the current color channel.
[0137] An initial encryption sequence determination unit is used to concatenate the first sequence and the second sequence corresponding to the current color channel for each color channel to obtain the initial encryption sequence corresponding to the current color channel.
[0138] Optionally, the second encryption module includes:
[0139] A bit sequence determination unit is used to convert the initial encryption sequence into a binary bit sequence;
[0140] The target encryption sequence determination unit is used to determine the encoding method of the binary bit sequence in the encoding table corresponding to the preset DNA encoding rule according to the correspondence between the initial encryption sequence and the rule chaotic sequence, and to encode the binary bit sequence according to the encoding method to obtain the target encryption sequence.
[0141] Optionally, the device may also include:
[0142] The channel determination module is used to establish a secure communication channel with the server based on the user identifier and a preset password before iteratively processing the image to be sent using a preset chaotic system to obtain at least four chaotic sequences. The secure communication channel is established based on fifth-generation mobile communication technology.
[0143] Optionally, the device may also include:
[0144] The decryption key value determination module is used to dynamically encrypt the encryption key value using a preset asymmetric encryption algorithm after the target encryption sequence is obtained, so as to obtain the decryption key value.
[0145] The information sending module is used to send the target encryption sequence and the decryption key value to the server based on the secure communication channel, so as to realize the encrypted transmission of the image to be sent. The encryption key value is determined based on the preset initial value of the iterative processing. The target encryption sequence and the decryption key value are used to instruct the server to use the decryption key value to complete the decryption of the target encryption sequence and obtain the decrypted image to be sent.
[0146] Optionally, the step of iteratively calculating a preset chaotic system based on a preset initial value and the average value of each pixel to determine four chaotic sequences corresponding to each color channel includes: iteratively calculating the preset chaotic system using the preset initial value and the average value of each pixel to obtain four chaotic value sets; filtering out a preset number of elements from each chaotic value set, and performing setting processing on the chaotic value sets after filtering out elements to determine four chaotic sequences corresponding to each color channel, wherein the chaotic value set is composed of multiple elements, and the setting processing includes rounding, absolute value taking, and modulo taking.
[0147] The image encryption apparatus provided in this embodiment of the invention can execute the image encryption method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0148] Example 4
[0149] Figure 4A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0150] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the ROM 42 or loaded into the RAM 43 from storage unit 48. The RAM 43 may also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0151] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0152] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as image encryption methods.
[0153] In some embodiments, the image encryption method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the image encryption method described above may be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the image encryption method by any other suitable means (e.g., by means of firmware).
[0154] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0155] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0156] The computer equipment provided above can be used to execute the image encryption method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.
[0157] Example 5
[0158] In the context of this invention, a computer-readable storage medium may be a tangible medium, and the computer-executable instructions, when executed by a computer processor, are used to perform a method of image encryption, the method comprising:
[0159] The image to be sent is iteratively processed using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system;
[0160] The chaotic sequence is subjected to bidirectional diffusion processing to obtain an initial encrypted sequence;
[0161] The initial encryption sequence is encoded using a preset DNA encoding rule to obtain the target encryption sequence, thereby encrypting the image to be sent.
[0162] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by, or in conjunction with, an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0163] The computer equipment provided above can be used to execute the image encryption method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.
[0164] It is worth noting that in the embodiments of the above-mentioned image encryption device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0165] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for image encryption, characterized in that, include: The image to be sent is iteratively processed using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system; The chaotic sequence is subjected to bidirectional diffusion processing to obtain an initial encrypted sequence; The initial encryption sequence is encoded using a preset DNA encoding rule to obtain the target encryption sequence, thereby encrypting the image to be sent. The step of iteratively processing the image to be sent using a preset chaotic system to obtain at least four chaotic sequences includes: Determine the grayscale image corresponding to each color channel in the image to be sent, wherein the number of color channels is at least three; For each color channel, the sum of the brightness values of each pixel in the grayscale image corresponding to the current color channel is calculated as the quotient of the number of pixels in the image to be sent, to obtain the average pixel value corresponding to the current color channel; Based on the preset initial value and the average value of each pixel, the preset chaotic system is iteratively calculated to determine the four chaotic sequences corresponding to each color channel. Each of the four chaotic sequences corresponding to each color channel contains three monochrome chaotic sequences and one regular chaotic sequence. The step of performing bidirectional diffusion processing on the chaotic sequence to obtain the initial encryption sequence includes: Determine the monochrome image sequence corresponding to each color channel in the image to be sent; For each color channel, when the number of pixels in the image to be sent is even, a dilation operation is performed on the monochrome image sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel to obtain the first sequence corresponding to the current color channel. Each of the three monochrome chaotic sequences corresponding to each color channel contains one red chaotic sequence and one green chaotic sequence. For each color channel, when the number of pixels in the image to be sent is even, a dilation operation is performed on the first sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel to obtain the second sequence corresponding to the current color channel. For each color channel, the first sequence and the second sequence corresponding to the current color channel are concatenated to obtain the initial encryption sequence corresponding to the current color channel.
2. The method according to claim 1, characterized in that, The step of encoding the initial encrypted sequence using a preset DNA encoding rule to obtain the target encrypted sequence includes: Convert the initial encryption sequence into a binary bit sequence; Based on the correspondence between the initial encrypted sequence and the rule-based chaotic sequence, the encoding method of the binary bit sequence in the encoding table corresponding to the preset DNA encoding rule is determined, and the binary bit sequence is encoded according to the encoding method to obtain the target encrypted sequence.
3. The method according to claim 1, characterized in that, Before iteratively processing the image to be sent using a preset chaotic system to obtain at least four chaotic sequences, the method further includes: A secure communication channel with the server is established based on the user identifier and a preset password, wherein the secure communication channel is established based on fifth-generation mobile communication technology.
4. The method according to claim 3, characterized in that, After obtaining the target encryption sequence, the process further includes: By using a preset asymmetric encryption algorithm, the encryption key value is dynamically encrypted to obtain the decryption key value; Based on the secure communication channel, the target encryption sequence and the decryption key value are sent to the server to achieve encrypted transmission of the image to be sent. The encryption key value is determined based on the preset initial value of the iterative processing. The target encryption sequence and the decryption key value are used to instruct the server to use the decryption key value to decrypt the target encryption sequence and obtain the decrypted image to be sent.
5. The method according to claim 1, characterized in that, The step of iteratively calculating a preset chaotic system based on a preset initial value and the average value of each pixel to determine four chaotic sequences corresponding to each color channel includes: Using a preset initial value and the average value of each pixel, an iterative calculation is performed on the preset chaotic system to obtain four sets of chaotic values; A preset number of elements are filtered out from each set of chaotic values, and the set of chaotic values after filtering out the elements is subjected to setting processing to determine four chaotic sequences corresponding to each color channel. The set of chaotic values consists of multiple elements, and the setting processing includes rounding, taking the absolute value, and taking the remainder.
6. An image encryption device, characterized in that, include: A chaotic sequence determination module is used to iteratively process the image to be sent using a preset chaotic system to obtain at least four chaotic sequences, wherein the preset chaotic system is determined based on a four-dimensional chaotic system. The first encryption module is used to perform bidirectional diffusion processing on the chaotic sequence to obtain an initial encryption sequence. The second encryption module is used to encode the initial encryption sequence using a preset DNA encoding rule to obtain the target encryption sequence, so as to encrypt the image to be sent. The chaotic sequence determination module includes: A grayscale image determination unit is used to determine the grayscale image corresponding to each color channel in the image to be sent, wherein the number of color channels is at least three; The pixel average value determination unit is used to calculate, for each color channel, the quotient of the sum of the brightness values of each pixel in the grayscale image corresponding to the current color channel and the number of pixels in the image to be sent, to obtain the pixel average value corresponding to the current color channel; The chaotic sequence determination unit is used to perform iterative calculations on a preset chaotic system based on a preset initial value and the average value of each pixel to determine four chaotic sequences corresponding to each color channel, wherein each of the four chaotic sequences corresponding to each color channel contains three monochrome chaotic sequences and one regular chaotic sequence. The first encryption module includes: A vector determination unit is used to determine the monochrome image sequence corresponding to each color channel in the image to be sent; The first sequence determination unit is used to perform a dilation operation on the monochrome image sequence, red chaotic sequence and green chaotic sequence corresponding to the current color channel for each color channel when the number of pixels of the image to be sent is even, so as to obtain the first sequence corresponding to the current color channel. The three monochrome chaotic sequences corresponding to each color channel contain one red chaotic sequence and one green chaotic sequence. The second sequence determination unit is used to perform a dilation operation on the first sequence, the red chaotic sequence, and the green chaotic sequence corresponding to the current color channel for each color channel when the number of pixels in the image to be sent is even, so as to obtain the second sequence corresponding to the current color channel. An initial encryption sequence determination unit is used to concatenate the first sequence and the second sequence corresponding to the current color channel for each color channel to obtain the initial encryption sequence corresponding to the current color channel.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image encryption method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the image encryption method according to any one of claims 1-5.
Citation Information
Patent Citations
An image encryption method based on four-dimensional Chen's hyperchaotic system and K-means clustering
CN109376793A
Image encryption method based on multidirectional diffusion and DNA coding
CN111008383A