Image encryption method and system against chosen-plaintext attack
By using plaintext image hash values and timestamps to generate initial values for a chaotic system, and combining pseudo-random sequences and DNA encoding to hide hash values and timestamps, multiple keys are used for image encryption. This solves the problem of keys not being reusable and achieves high performance against chosen-plaintext attacks and efficient key management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAZHONG UNIV OF SCI & TECH
- Filing Date
- 2023-08-03
- Publication Date
- 2026-04-24
AI Technical Summary
In existing image encryption methods resistant to chosen-plaintext attacks, the key cannot be reused, which makes key distribution and transmission difficult, and the encryption effect is similar to the one-time pad algorithm, making it difficult to implement in practical applications.
The initial values or parameters of a chaotic system are generated using the hash value and timestamp of a plaintext image. The image is scrambled and diffused using pseudo-random sequences and DNA encoding. The hash value and timestamp are hidden using the Chinese Remainder Theorem. Multiple keys are used to encrypt the image, generating the final ciphertext image.
It enables key reuse, enhances resistance to chosen-plaintext attacks, improves the randomness and security of encryption, and solves the problems of key management and frequent key transmission.
Smart Images

Figure CN116760630B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of multimedia data encryption technology, specifically relating to an image encryption method and system resistant to chosen-plaintext attacks. Background Technology
[0002] With the rapid development of the internet age, the internet has become the largest information transmission platform. In recent years, the emergence of various security vulnerabilities has led to a rapid increase in people's attention to communication security. Images, as a frequently used means of information transmission in communication, are characterized by their large amount of information and strong correlation. How to quickly and securely encrypt images has become a mainstream research direction. Excellent random sequence generation algorithms are the foundation of image encryption algorithms, but excellent image encryption algorithms also rely on more complex and random encryption processes. Because DNA encoding operations have the characteristics of high storage density, high parallelism, and good resistance to attacks, and encryption algorithms using DNA encoding operations often exhibit excellent encryption performance, they have great application prospects in cryptography. Many people have proposed encryption algorithms that combine various chaotic systems with DNA encoding operations, achieving good encryption results.
[0003] However, the lack of connection between the key and the plaintext makes it vulnerable to chosen-plaintext attacks. By exploiting this weakness, an equivalent encryption matrix can be obtained by encrypting plaintext images with specific differences, thereby cracking the algorithm.
[0004] To resist chosen-plaintext attacks and strengthen the connection between plaintext images and the encryption process, existing technologies have proposed schemes using hash functions such as SHA-256 or MD5. For example, the invention patent with publication number CN113538203A uses the SHA-256 hash function to calculate the hash value of the plaintext image. This hash value is then used to generate the initial value of a chaotic system, strengthening the connection between the plaintext and the key. Any slight change in the plaintext will produce a completely different ciphertext image, providing a certain degree of resistance to chosen-plaintext attacks. However, these encryption schemes require regenerating the key each time the plaintext image is encrypted, meaning the encryptor needs to constantly transmit the key to the decryptor. This essentially makes these schemes one-time pad image encryption algorithms. As is well known, key distribution for one-time pad algorithms is extremely difficult, and transmitting large amounts of key is extremely inconvenient in practical applications. Therefore, it is necessary to develop image encryption methods where the key can be reused while achieving encryption effects similar to one-time pad. Summary of the Invention
[0005] In view of this, the present invention proposes an image encryption method and system resistant to chosen plaintext attacks, which solves the problem that the key of existing image encryption methods resistant to chosen plaintext attacks cannot be reused, while achieving a similar effect to one-time pad encryption.
[0006] In a first aspect, this invention discloses an image encryption method resistant to chosen-plaintext attacks, the method comprising:
[0007] The hash value of the plaintext image is calculated using the SHA-256 function, a timestamp is generated, and the initial value or parameters of the chaotic mapping are generated based on the hash value, timestamp information and the first key.
[0008] Based on the initial value or parameters of the chaotic mapping, the first and second pseudo-random sequences are generated by any pseudo-random number generator based on the chaotic system.
[0009] Multiple random coordinate points are generated based on the first pseudo-random sequence. The plaintext image is then scrambled based on these multiple random coordinate points to obtain a scrambled image.
[0010] Based on the second pseudo-random sequence, DNA encoding and DNA operations are used to perform diffusion operations on the scrambled image, and the diffused image is obtained by DNA decoding.
[0011] A third pseudo-random sequence is generated using the second key, and the size of the diffusion image is expanded using the Chinese Remainder Theorem. The hash value of the plaintext image is then hidden in the expanded diffusion image to obtain the hidden image.
[0012] Based on the third key, a noisy image is generated by a pseudo-random number generator based on a chaotic system and XORed with the hidden image to obtain the final ciphertext image.
[0013] Based on the above technical solutions, preferably, the step of generating the initial value or parameters of the chaotic map according to the hash value, timestamp, and first key specifically includes:
[0014] The hash value H is XORed with the timestamp, and the result is denoted as h value h = (h1, h2, h3, ..., h). 15 ,h 16 );
[0015] Obtain the first key α, and generate the initial value or parameter α1 of the chaotic mapping based on the h value and the first key α, as shown in the following formula:
[0016]
[0017] in, It is the XOR operator.
[0018] Based on the above technical solutions, preferably, the step of generating multiple random coordinate points according to the first pseudo-random sequence and scrambling the plaintext image according to the multiple random coordinate points to obtain a scrambled image specifically includes:
[0019] Based on the first pseudo-random sequence A, M×N random coordinate points (X) are generated according to the following formula. k ,Y k ):
[0020]
[0021] Among them, A 2k-1 A 2k These are the values of the (2k-1)th and 2kth elements in A, respectively. mod(·) is the modulo operation, and M×N represents the size of the plaintext image.
[0022] Scramble all pixels in the plaintext image PT to obtain the scrambled image D. The formula for the scrambling operation is as follows:
[0023] a = PT(i,j)
[0024] D(i,j)=PT(X (i-1)N+j ,Y (i-1)N+j )
[0025] D(X (i-1)N+j ,Y (i-1)N+j = a, i∈[1,M], j∈[1,N]
[0026] Where PT(i,j) is the pixel at coordinate (i,j) in the plaintext image PT, and PT(X) is the pixel at coordinate (i,j). (i-1)N+j ,Y (i-1)N+j ) represents the coordinates (X) in the plaintext image PT. (i-1)N+j ,Y (i-1)N+j Let D(i,j) be the pixel at coordinate (i,j) in the scrambled image D, and D(X) be the pixel at coordinate (i,j). (i-1)N+j ,Y (i-1)N+j ) represents the coordinates (X) in the scrambled image D. (i-1)N+j ,Y (i-1)N+j The pixel at position ) is an intermediate variable, where 'a' is an intermediate variable.
[0027] Based on the above technical solutions, preferably, the formula for calculating the diffusion image is as follows:
[0028]
[0029] Among them, B1, B t B t+1 S1 and S2 are the 1st, tth, and (t+1th)th pixels in the diffuse image B, respectively. t S t+1 Let D be the 1st, tth, and (t+1th)th elements in the second pseudo-random sequence S, respectively. t F represents the t-th pixel in the scrambled image D. m (·) represents DNA coding, O n(·) represents DNA operations. This represents DNA decoding, and mod(·) represents the modulo operation.
[0030] Based on the above technical solutions, preferably, the size of the expanded diffusion image, which hides the hash value and timestamp of the plaintext image in the expanded diffusion image, specifically includes:
[0031] The h value is divided into multiple sub-h values, and each sub-h value is denoted as h. r ;
[0032] The second key is input into an arbitrary pseudo-random number generator based on a chaotic system to generate a third pseudo-random sequence. Multiple pseudo-random numbers U from the third pseudo-random sequence are then used to generate the sequence. r V r Generate image coordinates (X) for information hiding. r ,Y r );
[0033]
[0034] Pixels in diffuse image B Sub-h value h r Construct a system of congruence equations:
[0035]
[0036] Where p1 and p2 are two relatively prime positive integers, where p1 ≥ 257, p2 ≥ 17, and p1p2 ≤ 2. 16 ;
[0037] Solving the system of congruence equations using the Chinese Remainder Theorem yields a unique solution for the hidden image pixels.
[0038] Will Decompose into T 1r and T 2r :
[0039]
[0040] Use T 1r Replace the original diffusion image Point, T 2r Added to T 1r After the point, the subsequent image pixels in the original diffused image are shifted one position to the right, expanding it into one image. The size of the hidden image T.
[0041] Based on the above technical solutions, preferably, the solution for the hidden image pixels is unique. The expression is:
[0042]
[0043] Where P = p1p2, P1 -1 Let P1 be the inverse of P1 modulo p1, satisfying the following equation:
[0044] P1 -1 P1≡1mod(p1).
[0045] Based on the above technical solutions, preferably, the method of generating a noisy image using an arbitrary pseudo-random number generator based on a chaotic system and embedding it into the hidden image to obtain the final ciphertext image specifically includes:
[0046] A noisy map W of the same size as the hidden image T is generated using a third key and a pseudo-random number generator based on a chaotic system.
[0047] The noisy image is embedded into the hidden image T to obtain the final ciphertext image R:
[0048]
[0049] in, It is the XOR operator.
[0050] In a second aspect, the present invention discloses an image encryption system resistant to chosen-plaintext attacks, the system comprising:
[0051] The pseudo-random sequence generation module is used to calculate the hash value of the plaintext image using the SHA-256 function, generate a timestamp, and generate the initial value or parameters of the chaotic map together with the hash value, timestamp and first key; based on the initial value or parameters of the chaotic map, it generates a first pseudo-random sequence and a second pseudo-random sequence through an arbitrary pseudo-random number generator based on a chaotic system.
[0052] Point scrambling module: Used to generate multiple random coordinate points based on the first pseudo-random sequence, and to scramble the plaintext image based on the multiple random coordinate points to obtain a scrambled image;
[0053] The DNA-based diffusion module is used to perform diffusion operations on a scrambled image based on a second pseudo-random sequence, utilizing DNA encoding and DNA operations, and obtain the diffused image through DNA decoding.
[0054] Hash value and timestamp hiding module: used to generate a third pseudo-random sequence using the second key, and combined with the Chinese Remainder Theorem to expand the size of the diffusion image, hiding the hash value and timestamp of the plaintext image into the expanded diffusion image to obtain the hidden image;
[0055] Noise Image Masking Module: Based on the third key, a noisy image is generated by a pseudo-random number generator based on a chaotic system, and then XORed with the hidden image to obtain the final ciphertext image.
[0056] A third aspect of the present invention discloses an electronic device comprising: at least one processor, at least one memory, a communication interface, and a bus;
[0057] The processor, memory, and communication interface communicate with each other through the bus.
[0058] The memory stores program instructions that can be executed by the processor, which invokes the program instructions to implement the method as described in the first aspect of the present invention.
[0059] In a fourth aspect, the present invention discloses a computer-readable storage medium storing computer instructions that cause a computer to perform the method described in the first aspect of the present invention.
[0060] The present invention has the following advantages over the prior art:
[0061] 1) This invention utilizes the hash value and timestamp of a plaintext image and a first key to generate initial values or parameters for a chaotic system. Furthermore, it uses the Chinese Remainder Theorem to expand the size of the ciphertext image and hides the hash value and timestamp information of the plaintext image within the diffused image. This achieves the hiding of hash value and timestamp information, solving the problem of frequent key transmission and distribution required to encrypt different plaintext images. Moreover, the same plaintext image encrypted at different times using the same key yields different ciphertext images. The encryption algorithm of this invention not only allows for key reuse and easy management but also exhibits excellent resistance to chosen-plaintext attacks.
[0062] 2) This invention utilizes dynamic DNA encoding and DNA operations to perform diffusion operations on scrambled images, and obtains the diffused image through DNA decoding. Dynamic DNA encoding has more complexity than traditional XOR operations, which can enhance the complexity and security of image scrambling and diffusion.
[0063] 3) This invention utilizes three keys to generate pseudo-random sequences using an arbitrary chaotic system pseudo-random number generator to achieve image scrambling and diffusion, hiding h-value information, and masking noisy images, thereby enhancing the randomness of the image encryption process and results and improving the encryption level. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 This is a flowchart of the image encryption method against chosen-plaintext attacks according to the present invention;
[0066] Figure 2 This is a schematic diagram of DNA encoding / decoding and DNA operations;
[0067] Figure 3 The original image provided for the embodiments of the present invention;
[0068] Figure 4 The scrambled image provided in this embodiment of the invention;
[0069] Figure 5 The diffused image provided in an embodiment of the present invention;
[0070] Figure 6 The image with embedded hash values provided in this embodiment of the invention;
[0071] Figure 7 The noise image provided in the embodiments of the present invention;
[0072] Figure 8 The final encrypted image provided for embodiments of the present invention. Detailed Implementation
[0073] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0074] Please see Figure 1 This invention proposes an image encryption method resistant to chosen-plaintext attacks, the method comprising:
[0075] S1. Calculate the hash value of the plaintext image using the SHA-256 function, and generate the initial value of the chaotic map based on the hash value.
[0076] In this invention, the plaintext image is the image to be encrypted. The plaintext image information is compressed using the SHA-256 function to generate a 256-bit binary hash value H, which is then XORed with a timestamp. The resulting h value is denoted as h = (h1, h2, h3, ..., h...). 15 ,h 16 Obtain the first key α, and generate the initial value α1 of the chaotic mapping based on the h value and the first key α, as follows:
[0077]
[0078] in, It is the XOR operator.
[0079] S2. Based on the initial value of the chaotic mapping, generate the first and second pseudo-random sequences using an arbitrary chaotic system pseudo-random number generator.
[0080] Using the initial value α1 of the chaotic mapping, a pseudo-random sequence A and a pseudo-random sequence S of length M×N are generated through an arbitrary pseudo-random sequence generator based on a chaotic system, where M×N is the size of the plaintext image, and the value of A ranges from 1 to 2. The value of S ranges from 0 to 255.
[0081] S3. Generate multiple random coordinate points based on the first pseudo-random sequence, and scramble the plaintext image based on the multiple random coordinate points to obtain a scrambled image.
[0082] Using a point scrambling model to scramble the image with maximum complexity, step S3 specifically includes the following sub-steps:
[0083] S31. Based on the first pseudo-random sequence A, generate M×N random coordinate points (X... k ,Y k ):
[0084]
[0085] Among them, A 2k-1 A 2k These are the values of the (2k-1)th and 2kth elements in A, respectively. mod(·) is the modulo operation, and M×N represents the size of the plaintext image.
[0086] S32. Scramble all pixels in the plaintext image PT to obtain the scrambled image D. The formula for the scrambling operation is as follows:
[0087] a = PT(i,j)
[0088] D(i,j)=PT(X (i-1)N+j ,Y (i-1)N+j )
[0089] D(X (i-1)N+j ,Y (i-1)N+j ) = a
[0090] Where i and j are both integers, i∈[1,M], j∈[1,N], PT(i,j) is the pixel at coordinate (i,j) in the plaintext image PT, and PT(X) is the pixel at coordinate (i,j) in the plaintext image PT. (i-1)N+j ,Y (i-1)N+j ) represents the coordinates (X) in the plaintext image PT. (i-1)N+j ,Y (i-1)N+j Let D(i,j) be the pixel at coordinate (i,j) in the scrambled image D, and D(X) be the pixel at coordinate (i,j). (i-1)N+j ,Y (i-1)N+j ) represents the coordinates (X) in the scrambled image D. (i-1)N+j ,Y (i-1)N+j The pixel at position ) is an intermediate variable, where 'a' is an intermediate variable.
[0091] S4. Based on the second pseudo-random sequence, the scrambled image is diffused using DNA encoding and DNA operations, and the diffused image is obtained through DNA decoding.
[0092] This invention utilizes DNA encoding, DNA computation, and DNA decoding to perform diffusion operations on images, further increasing the complexity of the diffused images.
[0093] First, the DNA encoding / decoding rules and DNA operation rules are set. Table 1 shows the DNA encoding / decoding rules F. m m = 0, 1, 2, ..., 7, Tables 2-4 show the DNA operation rules O n n = 0, 1, 2, where Table 2 is the DNA operation rule O1, Table 3 is the DNA operation rule O2, and Table 4 is the DNA operation rule O3.
[0094] Table 1 DNA Encoding / Decoding Rules F m
[0095]
[0096] Table 2 DNA Operation Rules O1
[0097]
[0098] Table 3 DNA Operation Rules O2
[0099]
[0100]
[0101] Table 4 DNA Operation Rules O3
[0102]
[0103] like Figure 2 The diagram illustrates DNA encoding / decoding, DNA computation, and the DNA decoding process. The principle of DNA encoding / decoding is as follows: assuming a certain element S... t =27, then according to m=S t Mod 8 = 3, the encoding rule number is calculated to be m = 3. Looking up Table 1, encoding rule F3 is obtained. Therefore, S can be encoded according to encoding rule F3. t The binary 00011011 is encoded into DNA to obtain CATG, and so on.
[0104] This invention defines three DNA operation rules: O1, O2, and O3. Based on n = 1 + S t The modulo 3 algorithm calculates the DNA operation rule number n, and then finds the corresponding DNA operation rule table O. n In order to find the operation rule table O n Determine the DNA operation rules to be used. For example, S t =27 corresponds to the DNA code CATG, S t+1 =120 corresponds to the DNA code AGTC, then n = 1 + 27 mod 3 = 1, indicating that the corresponding DNA operation rule is O1. Then, according to Table 2, DNA operations are performed on CATG and AGTC to obtain a new DNA sequence CGAT, and so on.
[0105] The scrambled image D is processed according to the DNA encoding rules in Table 1 and the DNA operation rules in Tables 2-4, and finally decoded to obtain the diffused image B, where each pixel value of B is B. t The calculation formula is:
[0106]
[0107] Among them, B1, B t B t+1 S1 and S2 are the 1st, tth, and (t+1th)th pixels in the diffuse image B, respectively. t S t+1 Let D be the 1st, tth, and (t+1th)th elements in the second pseudo-random sequence S, respectively. t F represents the t-th pixel in the scrambled image D. m (·) represents DNA coding, O n (·) represents DNA operations. This represents DNA decoding, which is the inverse operation of DNA encoding. mod(·) represents the modulo operation.
[0108] This invention is based on element S in the second pseudo-random sequence S. t Perform modulo operations separately to dynamically select the DNA encoding / decoding rule F. mand DNA operation rules O n This can enhance the complexity and security of image scrambling and diffusion.
[0109] S5. Expand the size of the diffusion image using the Chinese Remainder Theorem, and hide the hash value and timestamp of the plaintext image into the corresponding diffusion image to obtain the hidden image.
[0110] By using the Chinese Remainder Theorem to expand the size of the diffusion image, the hash value and timestamp of the plaintext image can be hidden in the diffusion image, thereby achieving the secret transmission of hash value and timestamp information.
[0111] Step S5 specifically includes the following sub-steps:
[0112] S51. Divide the h value into multiple sub-h values, and denot the sub-h values embedded into the ciphertext image as h. r .
[0113] First, the 256-bit h value is divided into 64 sub-h values, each ranging from 0 to 15. To improve the system's resistance to noise attacks, each h value is repeatedly embedded 8 times, resulting in 512 sub-h values embedded into the diffusion image, denoted as h0. r r = 1, 2, ..., 512.
[0114] S52. Input the second key into an arbitrary pseudo-random number generator based on a chaotic system to generate a third pseudo-random sequence, and then use the pseudo-random number U in the third pseudo-random sequence to generate a third pseudo-random sequence. r V r Generate image coordinates (X) for information hiding. r ,Y r ).
[0115] Specifically, a third pseudo-random sequence is generated using an arbitrary pseudo-random number generator based on a chaotic system, combined with a second key. This sequence consists of 512 8-bit pseudo-random numbers U. r V r The image coordinates (X, X) used for information hiding are generated using the following formula. r ,Y r ):
[0116]
[0117] S53, from the pixel point B(X) in the diffused image B r ,Y r ), sub-h value h r Construct a system of congruence equations:
[0118]
[0119] Where p1 and p2 are two relatively prime positive integers, where p1 ≥ 257, p2 ≥ 17, and p1p2 ≤ 2. 16 .
[0120] S54. Solve the system of congruence equations using the Chinese Remainder Theorem to obtain a unique solution for the hidden image pixels.
[0121]
[0122] in P1 -1 Let P1 be the inverse of P1 modulo p1, satisfying the following equation:
[0123] P1 -1 P1≡1mod(p1).
[0124] S55, will Decompose into T 1r and T 2r :
[0125]
[0126] S56, Using T 1r Replace the original encrypted image Point, T 2r Added to T 1r After the point, the subsequent image pixels in the original ciphertext image are shifted one position to the right, expanding it into one image. The hidden image T of size is padded with 0s if the last row is not full. It represents rounding up.
[0127] This invention uses the hash value and timestamp of the plaintext image for encryption and hides them in the ciphertext. The relationship between the plaintext and ciphertext images depends on the plaintext hash value and timestamp, which enhances the algorithm's resistance to chosen-plaintext attacks and makes the key management of the algorithm superior to similar encryption algorithms.
[0128] S6. Generate a noisy image using an arbitrary pseudo-random number generator based on a chaotic system and embed it into the hidden image to obtain the final ciphertext image.
[0129] The number of pixels is generated using a third key and a pseudo-random number generator based on a chaotic system. The noisy image W is embedded into the hidden image T to obtain the final ciphertext image R:
[0130]
[0131] in, It is the XOR operator.
[0132] The image decryption method is the inverse operation of the above image encryption method. Before decryption, noise needs to be removed, and the hash value of the plaintext image is extracted in the reverse order of hiding, and the resulting h value is XORed with the timestamp. This h value, along with the key, yields the initial value of the chaotic system. The h value is extracted eight times, and the h value that appears most frequently is taken as the final h value. The formula for solving the diffusion image B and the h value h using the inverse operation is as follows:
[0133]
[0134] During the decryption phase of image diffusion based on DNA operations, the inverse O1 operation of DNA operations is... The inverse operation of O2 is O3, and the inverse operation of O3 is O2. That is, O2 operation is used when encrypting, and O3 operation is needed when decrypting, and vice versa.
[0135] The invention will now be described in detail with reference to specific examples.
[0136] This example selects the logistic chaotic system as the chaotic sequence generator. The original image (256×256) is as follows: Figure 3 As shown, the value of h after XORing the original image hash value H with the timestamp is:
[0137] h=AC7386DCE246190C91880CC049BB67D8192564AF960F839F2E5F4C91345F9807
[0138] First, substitute the value of h into the following formula to calculate the initial chaotic value α1:
[0139]
[0140] Since the logistic chaotic system exhibits the best chaotic effect when the branch coefficient μ = 4, this embodiment selects the first key α = 0.59331 and calculates the initial value α1 = 0.67849131531, which is then substituted into the arbitrary chaotic system. Taking the logistic chaotic system as an example, a chaotic sequence is generated. After quantization, a first pseudo-random sequence A with a size of 0–255 and a second pseudo-random sequence S with a value range of 0–255 are obtained, which are used for image scrambling and diffusion, respectively.
[0141] Then, random coordinate points (X) are extracted according to the pseudo-random sequence using the following formula. k ,Y k ):
[0142]
[0143] According to the following formula Figure 3 Scramble the pixels in the array:
[0144] t = PT(i,j), D(i,j) = PT(X) (i-1)N+j ,Y (i-1)N+j ),D(X (i-1)N+j ,Y (i-1)N+j )=t,
[0145] i∈[1,256],j∈[1,256]
[0146] The scrambled image D is as follows Figure 4 As shown.
[0147] In sequence Figure 4 The diffusion image B is obtained by combining the pixels in Table 1 and the elements in the pseudo-random sequence S with the DNA encoding / decoding rules in Table 1 and the DNA operation rules in Tables 2-4 using the following formula:
[0148]
[0149] Finally, the diffused image B is obtained by decoding. Figure 5 As shown.
[0150] Next, the h-value is hidden. First, the 256-bit h-value is divided into 64 sub-h-values, each ranging from 0 to 15. Each h-value is then repeatedly embedded 8 times, resulting in 512 sub-h-values being embedded into the ciphertext. These sub-h-values are denoted as h. r r = 1, 2, ..., 512.
[0151] Using the second key and an initial value of x0 = 0.46130 and a branch coefficient μ = 4, a logistic chaotic system generates 512 8-bit pseudo-random numbers U. r and V r The image coordinates used for information hiding are obtained, denoted as (X... r ,Y r ).
[0152]
[0153] From pixels Sub-hash value h r Construct a system of congruence equations, choosing p1 = 259 and p2 = 19:
[0154]
[0155] According to the Chinese Remainder Theorem, a unique solution can be obtained from the congruence equation.
[0156]
[0157] Therefore, h r Hide to middle, The size ranges from 0 to 4921, which significantly exceeds the maximum pixel value of 255.
[0158] Using the following formula Decompose into T 1r and T 2r :
[0159]
[0160] Finally, using T 1r Replace the original diffusion image Point, T 2r Added to T 1r After the dot, shift the subsequent image pixels one position to the right, appending to create a hidden image of 256×258 pixels. If the last row is not full, pad it with 0s. For example... Figure 6 The image shown is the hidden image T after embedding the hash value.
[0161] The steps for masking noise maps are as follows:
[0162] A logistic chaotic system with a third key of x0 = 0.18949 and a branch coefficient of μ = 4 is used to generate a noisy image with 256 × 258 pixels, such as... Figure 7 The image shown is a noisy image W. Figure 7 and Figure 6 Perform an XOR operation to obtain the final ciphertext image R, as shown below. Figure 8 As shown.
[0163] The decryption process follows the reverse of the above process. First, the chaotic system with 256×258 pixels is restored using the third key x0=0.18949 and μ=4. Figure 7 and with Figure 8 Perform XOR operation to restore Figure 6 Then, using the logistic chaotic system with the second key x0 = 0.46130 and μ = 4, a pseudo-random sequence is generated to extract the hash value of the plaintext image and obtain... Figure 5 Then, using the obtained hash value and the first key, a pseudo-random sequence for encryption is generated. Figure 5 The plaintext image is obtained by performing reverse diffusion and reverse scrambling. The decrypted image is as follows: Figure 2 As shown.
[0164] Corresponding to the above method embodiments, the present invention also proposes an image encryption system resistant to chosen-plaintext attacks, the system comprising:
[0165] The pseudo-random sequence generation module is used to calculate the hash value of the plaintext image using the SHA-256 function, generate a timestamp, and generate the initial value or parameters of the chaotic map together with the hash value, timestamp and first key; based on the initial value or parameters of the chaotic map, it generates a first pseudo-random sequence and a second pseudo-random sequence through an arbitrary pseudo-random number generator based on a chaotic system.
[0166] Point scrambling module: Used to generate multiple random coordinate points based on the first pseudo-random sequence, and to scramble the plaintext image based on the multiple random coordinate points to obtain a scrambled image;
[0167] The DNA-based diffusion module is used to perform diffusion operations on a scrambled image based on a second pseudo-random sequence, utilizing DNA encoding and DNA operations, and obtain the diffused image through DNA decoding.
[0168] Hash value and timestamp hiding module: used to generate a third pseudo-random sequence using the second key, and combined with the Chinese Remainder Theorem to expand the size of the diffusion image, hiding the hash value and timestamp of the plaintext image into the expanded diffusion image to obtain the hidden image;
[0169] Noise image masking module: Based on the third key, it generates a noisy image using a pseudo-random number generator based on a chaotic system and performs an XOR operation with the hidden image to obtain the final ciphertext image;
[0170] Image decryption module: Used to decrypt images by performing the inverse operation of the encryption process.
[0171] The above system embodiments and method embodiments are one-to-one correspondences. For a brief description of the system embodiments, please refer to the method embodiments.
[0172] The present invention also discloses an electronic device, comprising: at least one processor, at least one memory, a communication interface, and a bus; wherein the processor, memory, and communication interface communicate with each other through the bus; the memory stores program instructions executable by the processor, and the processor calls the program instructions to implement the aforementioned method of the present invention.
[0173] The present invention also discloses a computer-readable storage medium that stores computer instructions, which cause the computer to implement all or part of the steps of the method described in the embodiments of the present invention. The storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0174] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, meaning they can be distributed across multiple network units. Those skilled in the art can select some or all of the modules to achieve the purpose of this embodiment without any inventive effort, based on actual needs.
[0175] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An image encryption method resistant to chosen-plaintext attacks, characterized in that, The method includes: The SHA-256 function is used to calculate the hash value of the plaintext image and generate a timestamp. The initial value or parameters of the chaotic map are generated together with the hash value, timestamp and first key. Based on the initial value or parameters of the chaotic mapping, the first and second pseudo-random sequences are generated by any pseudo-random number generator based on the chaotic system. Multiple random coordinate points are generated based on the first pseudo-random sequence. The plaintext image is then scrambled based on these multiple random coordinate points to obtain a scrambled image. Based on the second pseudo-random sequence, DNA encoding and DNA operations are used to perform diffusion operations on the scrambled image, and the diffused image is obtained by DNA decoding. A third pseudo-random sequence is generated using the second key, and the size of the diffusion image is expanded by combining it with the Chinese Remainder Theorem. The hash value and timestamp of the plaintext image are then hidden in the expanded diffusion image to obtain the hidden image. Based on the third key, a noisy image is generated by a pseudo-random number generator based on a chaotic system and XORed with the hidden image to obtain the final ciphertext image. The process of generating the initial value or parameters of the chaotic map based on the hash value, timestamp, and first key specifically includes: The hash value H The value obtained by XORing the timestamp is denoted as h value, ; Obtain the first key ,according to h Value and first key Generate initial values or parameters for chaotic mappings. The formula is as follows: ; in, It is the XOR operator; The formula for calculating the diffusion image is: ; in, , , Diffusion images B The first one, the first t The, the t +1 pixel, S 1. S t , For the second pseudo-random sequence, respectively S The first one, the first t The, the t +1 element, D t Represents the scrambled image D. t 1 pixel Represents DNA coding, Represents DNA computation. This represents DNA decoding, and mod(·) represents the modulo operation. M , N These represent the number of rows and columns of the plaintext image, respectively. The size of the expanded diffusion image, which hides the hash value and timestamp of the plaintext image within the expanded diffusion image, specifically includes: The h Values are divided into multiple sub-values h Value, will child h The value is denoted as ; The second key is input into an arbitrary pseudo-random number generator based on a chaotic system to generate a third pseudo-random sequence. The pseudo-random numbers in the third pseudo-random sequence are then used to generate... Generate image coordinates for information hiding ; ; M and N represent the number of rows and columns of the plaintext image, respectively; Let the diffusion image be B , from diffuse image B pixels in ,son h value Construct a system of congruence equations: ; in, They are two relatively prime positive integers, where , , ; Solving the system of congruence equations using the Chinese Remainder Theorem yields a unique solution for the hidden image pixels. ; Will Decomposed into and : ; floor (·) is the floor function; use Replace the original diffusion image Point, will Added to After the point, the subsequent image pixels in the original diffused image are shifted one position to the right, expanding it into one image. The size of the hidden image T; The process of generating a noisy image using a pseudo-random number generator based on a chaotic system and then XORing it with the hidden image to obtain the final ciphertext image specifically includes: Let the hidden image be T. Use a third key and a pseudo-random number generator based on a chaotic system to generate a noisy image W of the same size as the hidden image T. The noisy image is embedded into the hidden image T to obtain the final ciphertext image R: ; in, It is the XOR operator.
2. The image encryption method resistant to chosen-plaintext attacks according to claim 1, characterized in that, The step of generating multiple random coordinate points based on the first pseudo-random sequence and scrambling the plaintext image based on these multiple random coordinate points to obtain a scrambled image specifically includes: The first pseudo-random sequence A is generated according to the following formula. random coordinate points : ; in, A 2k-1 , A 2k They are the 2nd in A. k -1, 2nd k The value of each element, mod(·) is the modulo operation. Represents the size of the plaintext image; Scramble all pixels in the plaintext image PT to obtain the scrambled image D. The formula for the scrambling operation is as follows: ; Among them, PT( i , j ) represents the coordinates in the plaintext image PT. i , j The pixel at position ) Coordinates in plaintext image PT The pixel at that location, To scramble the coordinates in image D ( i , j The pixel at position ) To scramble the coordinates in image D The pixel at that location, a It is an intermediate variable.
3. The image encryption method resistant to chosen-plaintext attacks according to claim 1, characterized in that, The unique solution for the hidden image pixels The expression is: ; in , , , for right Find the modular inverse that satisfies the following equation: 。 4. An image encryption system resistant to chosen-plaintext attacks, for implementing the method as described in any one of claims 1 to 3, characterized in that, The system includes: The pseudo-random sequence generation module is used to calculate the hash value of the plaintext image using the SHA-256 function, generate a timestamp, and generate the initial value or parameters of the chaotic map together with the hash value, timestamp and first key; based on the initial value or parameters of the chaotic map, it generates a first pseudo-random sequence and a second pseudo-random sequence through an arbitrary pseudo-random number generator based on a chaotic system. Point scrambling module: Used to generate multiple random coordinate points based on the first pseudo-random sequence, and to scramble the plaintext image based on the multiple random coordinate points to obtain a scrambled image; The DNA-based diffusion module is used to perform diffusion operations on a scrambled image based on a second pseudo-random sequence, utilizing DNA encoding and DNA operations, and obtain the diffused image through DNA decoding. Hash value and timestamp hiding module: used to generate a third pseudo-random sequence using the second key, and combined with the Chinese Remainder Theorem to expand the size of the diffusion image, hiding the hash value and timestamp of the plaintext image into the expanded diffusion image to obtain the hidden image; Noise Image Masking Module: Based on the third key, a noisy image is generated by a pseudo-random number generator based on a chaotic system, and then XORed with the hidden image to obtain the final ciphertext image.
5. An electronic device, characterized in that, include: At least one processor, at least one memory, a communication interface, and a bus; The processor, memory, and communication interface communicate with each other through the bus. The memory stores program instructions that can be executed by the processor, and the processor invokes the program instructions to implement the method as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause the computer to perform the method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Image encryption method and device based on novel two-dimensional composite chaotic mapping and SHA-256
CN113538203A
Enterprise information image encryption method based on chaotic system and biological evolution strategy
CN116346302A