Color image encryption method and system based on three-dimensional dynamic pixel coding replacement

By constructing a three-dimensional dynamic pixel replacement matrix and performing three-dimensional rectangular coordinate replacement and diffusion operations on the R, G, and B channels of the color image, the problem of high channel correlation in the existing color image encryption algorithm is solved, and a more efficient and secure encryption effect is achieved.

CN120263916BActive Publication Date: 2025-09-16CHANGCHUN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510742590.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-09-16
Estimated Expiration
2045-06-05

AI Technical Summary

Technical Problem

Existing color image encryption algorithms fail to fully utilize the characteristics of color images and ignore the high correlation between R, G, and B components, resulting in poor encryption effect and difficulty in resisting differential attacks and chosen plaintext attacks.

Method used

A three-dimensional dynamic pixel coding replacement method is adopted to construct a three-dimensional dynamic pixel replacement matrix. A diffusion sequence is generated through a random number sequence stream. The three-dimensional rectangular coordinates of the R, G, and B channels of the color image are replaced and a diffusion operation is performed to achieve secondary encryption.

Benefits of technology

It improves the security and reliability of ciphertext images, reduces the correlation between channels, enhances the ability to resist differential attacks and chosen plaintext attacks, and improves encryption efficiency and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120263916B_ABST
    Figure CN120263916B_ABST
Patent Text Reader

Abstract

The present invention discloses a color image encryption method and system based on three-dimensional dynamic pixel coding replacement, comprising: encoding the color image to be encrypted; constructing a three-dimensional dynamic pixel replacement matrix using a random number sequence stream and generating a diffusion sequence required for secondary encryption; replacing the pixels of the encoded color image to be encrypted according to three-dimensional rectangular coordinates using the three-dimensional dynamic pixel replacement matrix, and performing a diffusion operation on the replacement result to complete secondary encryption, thereby obtaining a ciphertext image of the color image to be encrypted. The present invention makes full use of the characteristics of color images and constructs a method for simultaneously replacing the pixels of the color image to be encrypted. R、G、B The 3D-DPRM three-dimensional pixel replacement matrix of three-channel pixels reduces the correlation between channels, achieves the effect of "one image, one code", and improves the security and reliability of the ciphertext image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of information security, and relates to a color image encryption method and system based on three-dimensional dynamic pixel coding replacement. Background Art

[0002] With the rapid development of network communications, information security technology has fully entered the digital age. Digital images are a crucial form of information transmission. Compared to traditional text messages, images are more vivid and intuitive, and contain more information. Therefore, image data encryption and protection requires more than simply encrypting text information such as account numbers and passwords, nor can it rely on standard text encryption techniques.

[0003] At present, the encryption and decryption algorithms for grayscale images have been widely studied, but the current color image encryption algorithms still have shortcomings. Many algorithms only use the grayscale image encryption algorithm to encrypt color images. R 、 G 、 B Repeated in each of the three components, ignoring the inherent properties of the color image itself and R, G, B How to make full use of the characteristics of various existing conditions and combine them with the characteristics of color images for encryption to design more efficient and secure algorithms has considerable driving significance and application value for information security in the current environment. Summary of the Invention

[0004] The purpose of the present invention is to provide a color image encryption method and system based on three-dimensional dynamic pixel coding replacement, which utilizes the characteristics of color images to construct a method for simultaneously replacing R, G, B The three-dimensional dynamic pixel replacement matrix of the three-channel pixels reduces the correlation between the channels and achieves "one Figure 1 The effect of "encryption" is achieved, which improves the security and reliability of the ciphertext image.

[0005] The technical solutions for achieving the purpose of the present invention are:

[0006] A color image encryption method based on three-dimensional dynamic pixel code replacement includes the following steps:

[0007] S01: Encode the color image to be encrypted;

[0008] S02: Use the random number sequence stream to construct a three-dimensional dynamic pixel replacement matrix and generate the diffusion sequence required for secondary encryption;

[0009] S03: Using a three-dimensional dynamic pixel replacement matrix to replace the pixels of the encoded color image to be encrypted according to the three-dimensional rectangular coordinates, and performing a diffusion operation on the replaced result to complete secondary encryption, thereby obtaining a ciphertext image of the color image to be encrypted.

[0010] In the preferred technical solution, step S01 includes:

[0011] Get the length M 、Width N Color image , for the Row, No. Column pixels ,have ;in , , Respectively expressed in The intensity of the red, green, and blue channels at

[0012] for Every pixel in Add code, respectively R, G, B The channel code is 00, 01, 10, and each pixel Convert to 2-bit channel-specific encoding and splice 8-bit pixel original encoding to obtain :

[0013] ;

[0014] ;

[0015] The encoded image Splicing into data stream form D :

[0016] .

[0017] In the preferred technical solution, the method for generating the random number sequence stream in step S02 includes:

[0018] use SM3 Algorithm calculation of color image to be encrypted and binary numbers salt Hash value of the sum to get the initial key :

[0019] ;

[0020] is from a uniform distribution Random variables sampled from ; is the sum index of the salt value here, from 0 to 15; Indicates passing SM3 The hash value calculated by the algorithm;

[0021] Will Divided into secret key seeds KEY and random vectors IV , through Zu Chongzhi's algorithm generate L Random number sequence stream , the resulting random number sequence stream Z :

[0022] .

[0023] In a preferred technical solution, the method for constructing a three-dimensional dynamic pixel replacement matrix in step S02 includes:

[0024] S21: After obtaining the random number sequence stream Z, convert Z into decimal Z 10 , convert the decimal number Z 10 Sequence divided into groups of 4 decimal digits ; For each group of 4 decimal digits;

[0025] S22: Calculate the replacement sequence :

[0026] ;

[0027] All the calculated Get a vector in the range of 0-767 , index is a one-dimensional vector S Assign index values ​​in order from 0 to 767;

[0028] S23: Vector S After three-dimensional folding, a three-dimensional dynamic replacement matrix is ​​obtained.

[0029] In the preferred technical solution, in step S23, vector S Three-dimensional folding methods include:

[0030] Generate a three-dimensional matrix Matrix[3]

[16]

[16] , arrange the vector S into Matrix[3]

[16]

[16] according to the following formula, and assign its three-dimensional coordinates according to the following formula ,Right now:

[0031] ;

[0032] ;

[0033] Where x, y, and z correspond to the three-dimensional array subscripts, and Matrix is ​​a three-dimensional replacement matrix sequence in a rectangular coordinate system;

[0034] After the sequence S is arranged, a three-dimensional dynamic replacement matrix is ​​obtained.

[0035] In a preferred technical solution, the method of replacing the pixels of the color image to be encrypted according to the three-dimensional rectangular coordinates using the three-dimensional dynamic pixel replacement matrix in step S03 includes:

[0036] Will D Each pixel in the 10-bit encoding is represented as: , divided into 2-bit, 4-bit, and 4-bit forms from high to low, respectively, convert them into decimal, and D Each pixel is converted into a rectangular coordinate system :

[0037] ;

[0038] Where k is the channel;

[0039] Find its corresponding coordinates in the three-dimensional dynamic pixel replacement matrix and replace it with the pixel at the coordinate position. After the replacement is completed, the initial encrypted sequence is obtained :

[0040] ;

[0041] Matrix is ​​a three-dimensional replacement matrix sequence in a rectangular coordinate system.

[0042] In the preferred technical solution, the method for completing the secondary encryption in step S03 includes:

[0043] Convert the obtained random number sequence stream Z into binary Make Length and D Perform XOR operation on each bit of ;

[0044] The initially encrypted sequence and Bitwise XOR:

[0045] ;

[0046] Perform diffusion operation, That is the complete encrypted sequence, the pixel sequence recover:

[0047] ;

[0048] ;

[0049] That is the ciphertext image.

[0050] In the preferred technical solution, during the decryption process, if the initially encrypted sequence Restore to original encoding D , you need to first decrypt the data Decompose into single pixels :

[0051] ;

[0052] ;

[0053] Will Convert to , and traverse the 3D-DPRM, according to The value of finds the unique corresponding position in the three-dimensional dynamic pixel replacement matrix, and the coordinates of the position ( P , Q , R ) is The decimal representation of the original text is:

[0054] ;

[0055] in, P , Q , R is the subscript of the three-dimensional array;

[0056] Convert it to binary and concatenate it to get :

[0057] ;

[0058] After inversely replacing all pixels, Splice in sequence to get the original code D :

[0059] .

[0060] The present invention also discloses a color image encryption system based on three-dimensional dynamic pixel code replacement, comprising:

[0061] The original encoding module encodes the color image to be encrypted;

[0062] The calculation module uses the random number sequence stream to construct a three-dimensional dynamic pixel replacement matrix and generate the diffusion sequence required for secondary encryption;

[0063] The encryption module uses a three-dimensional dynamic pixel replacement matrix to replace the pixels of the encoded color image to be encrypted according to the three-dimensional rectangular coordinates, and performs a diffusion operation on the replaced result to complete the secondary encryption to obtain the ciphertext image of the color image to be encrypted.

[0064] The present invention further discloses a computer storage medium on which a computer program is stored. When the computer program is executed, the color image encryption method based on three-dimensional dynamic pixel coding replacement is implemented.

[0065] Compared with the prior art, the present invention has the following significant advantages:

[0066] (1) Improving ciphertext security: The present invention is based on a three-dimensional dynamic pixel code replacement method to perform secondary encryption on plaintext images, which can resist cryptanalysis methods such as differential attacks and chosen plaintext attacks, thereby improving the security of ciphertext during transmission.

[0067] (2) Reduced correlation between channels: The present invention makes full use of the inherent properties of color images and replaces the pixels of the three channels R, G, and B of the color image with unified coding. This avoids the duplication of calculations of each channel during the encryption process, thereby reducing the high correlation between channels while improving efficiency and ensuring security.

[0068] (3) Based on the method of three-dimensional dynamic pixel coding replacement, the present invention studies an encryption method for color images to promote the application of commercial cryptographic algorithms. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 A schematic flow chart of a color image encryption method and a decryption method based on three-dimensional dynamic pixel code replacement provided by the present invention;

[0070] Figure 2 This is a schematic diagram of the original image encoding process of the present invention;

[0071] Figure 3 A schematic diagram of the process of generating a three-dimensional dynamic pixel replacement matrix 3D-DPRM according to the present invention;

[0072] Figure 4 This is a schematic diagram of image encryption and decryption according to the present invention;

[0073] Figure 5 Schematic diagram of pixel distribution of the ciphertext image of the present invention;

[0074] Figure 6 Schematic diagram of the correlation between pixels of the ciphertext image of the present invention. DETAILED DESCRIPTION

[0075] The principle of the present invention is as follows: the method specifically encodes the plaintext image, constructs a three-dimensional dynamic pixel replacement matrix (3D-DPRM) using a random number sequence stream, and generates a diffusion sequence required for secondary encryption. The 3D-DPRM is used to replace the pixels of the encoded plaintext image according to three-dimensional rectangular coordinates, and the replacement result is subjected to a diffusion operation to complete the secondary encryption. The required initial secret key is calculated based on the color image to be encrypted itself, and a ciphertext image of the plaintext image to be protected is generated.

[0076] Example 1:

[0077] A color image encryption method based on three-dimensional dynamic pixel code replacement includes the following steps:

[0078] S01: Encode the color image to be encrypted;

[0079] S02: Use the random number sequence stream to construct a three-dimensional dynamic pixel replacement matrix and generate the diffusion sequence required for secondary encryption;

[0080] S03: Using a three-dimensional dynamic pixel replacement matrix to replace the pixels of the encoded color image to be encrypted according to the three-dimensional rectangular coordinates, and performing a diffusion operation on the replaced result to complete secondary encryption, thereby obtaining a ciphertext image of the color image to be encrypted.

[0081] The following describes the workflow of a color image encryption system based on three-dimensional dynamic pixel code replacement using a preferred embodiment as an example:

[0082] like Figure 1 As shown, the color image encryption method includes an encryption process and a decryption process:

[0083] Encryption process steps:

[0084] A1. Get the size M × N Color image , for each pixel ,have

[0085] ;

[0086] in , , Respectively expressed in The intensity of the red, green, and blue channels at .

[0087] A2. Every pixel in Add code, such as Figure 2 As shown. R、 G, BThe channel code is 00, 01, 10, and each pixel Convert to 2-bit channel-specific encoding and splice 8-bit pixel original encoding to obtain . As shown in formula (1)(2).

[0088] (1)

[0089] (2)

[0090] Next, the encoded image Splicing into data stream form D , as shown in formula (3).

[0091] (3)

[0092] A3. Use SM3 calculate and binary numbers salt The hash value of the sum. Get the initial key . As shown in formula (4).

[0093] (4)

[0094] A4. Convert 256-bit The first and last 128 bits are divided into the secret key seed KEY and the random vector IV. Then the ZUC algorithm is used to generate L 32-bit hexadecimal random number sequence streams. , L is a manual input option. The formula is shown below (5). The detailed calculation process of the ZUC algorithm refers to the national standard GB / T 33133.1 2016.

[0095] (5)

[0096] A5. Calculate the three-dimensional dynamic substitution matrix and the diffusion sequence required for secondary encryption:

[0097] Convert Z to decimal Z 10 . Convert the decimal number Z 10 Sequence divided into groups of 4 decimal digits , according to formula (6), calculate , all the calculated Select the first 768 unique values ​​and store them in the vector S In S After three-dimensional folding, the three-dimensional dynamic replacement matrix 3D-DPRM is obtained, as Figure 3As shown, the folding process is shown in step S2. In addition, the random number sequence obtained in step A4 is Z Convert to binary , and guarantee Length can be D Each bit is XORed.

[0098] (6)

[0099] A6. The 10-bit encoding of each pixel in D can be expressed as: , divided into 2-bit, 4-bit, and 4-bit forms from high to low, respectively, convert them into decimal, and D Each pixel is converted into a rectangular coordinate system The form is as shown in formula (7).

[0100] (7)

[0101] Where k is the channel;

[0102] Find its corresponding coordinates in 3D-DPRM and replace it with the pixel at the coordinate position. After the replacement is completed, the initial encrypted sequence is obtained , Matrix is ​​a three-dimensional replacement matrix sequence in a rectangular coordinate system, as shown in the following formula (8).

[0103] (8)

[0104] A7. and Bitwise XOR:

[0105] (9)

[0106] Perform diffusion operation, That is the complete encrypted sequence, the pixel sequence Recovery, that is, the ciphertext image The formulas are shown below (10)(11).

[0107] (10)

[0108] (11)

[0109] Decryption process steps:

[0110] B1. Obtaining the ciphertext image , initial secret key According to the method in step A4, the random number sequence stream Z is calculated.

[0111] B2. According to step A5, we get Z 10 , , , and calculate according to step A5 , get the 3D-DPRM initial vector S .Will S After three-dimensional folding, the three-dimensional dynamic replacement matrix 3D-DPRM is obtained.

[0112] B3. As shown in formula (12), calculate , and Perform the reverse diffusion operation. Since the XOR operation is reversible, after receiving Then, use the and Perform the operation and get , as shown in formula (13).

[0113] (12)

[0114] (13)

[0115] B4. Acquisition Afterwards, Each pixel in is inversely replaced using 3D-DPRM to obtain Then, through formula (7), the binary code of the original pixel can be restored D The detailed reverse replacement process is shown in step S4 below.

[0116] B5. After obtaining D, obtain the original image according to the following formula .

[0117] (14)

[0118] Preferably, a three-dimensional dynamic pixel replacement matrix 3D-DPRM is designed, and the generation, replacement, and reverse replacement methods of the 3D-DPRM in steps A5, A6, and B4 include the following steps:

[0119] S1. According to steps A4 and A5, after obtaining the random number sequence stream Z, calculate Z 10 , , , and then obtain a vector in the range of 0-767 , index Assign index values ​​to the one-dimensional vector S in sequence from 0 to 767.

[0120] S2. Generate a three-dimensional matrix Matrix[3]

[16]

[16] with a total capacity of 768. Arrange S into Matrix[3]

[16]

[16] according to formula (15) and assign its three-dimensional coordinates , the sequence S is arranged to obtain 3D-DPRM.

[0121] (15)

[0122] (16)

[0123] S3. Replace: D encoded in step A2 is obtained in the same way as in step A6 , found in 3D-DPRM Corresponding coordinates, use the value of the coordinate position Replace its pixel value. After all pixel values ​​are replaced, we get .

[0124] S4. Reverse substitution: During the decryption process, if you want to Restore to original encoding D , you need to first decrypt the data Decompose into single pixels .

[0125] (17)

[0126] (18)

[0127] Will Convert to , and traverse the 3D-DPRM, according to The value of finds the unique corresponding position in 3D-DPRM, and the coordinates of the position ( P , Q , R ) is The original text is represented in decimal. As shown in formulas (19) and (20), it is converted into binary and concatenated to obtain .

[0128] (19)

[0129] (20)

[0130] in, P , Q , R is the subscript of the three-dimensional array;

[0131] After inversely replacing all pixels, Splice in sequence to get the original code D .

[0132] (twenty one)

[0133] The decryption steps of the image are opposite to the encryption process mentioned above. Since the operations of each cryptographic component in this algorithm are reversible, it can be regarded as a symmetric encryption system. The receiving end obtains the 、 , you can calculate Z 10 , , , , and calculate according to step A5 , and then 3D-DPRM was obtained by the same method as above.

[0134] Furthermore, calculation , as shown in step B3. Perform the reverse diffusion operation. Since the XOR operation is reversible, after receiving Then, use the and Perform the operation and get .

[0135] Get Afterwards, Each pixel Convert to , and traverse the 3D-DPRM, according to Find the unique corresponding position of the value in 3D-DPRM, convert its value into binary and splice it to get After all pixels are replaced in reverse, After obtaining D, restore D to the original image according to step B5. .

[0136] Take the color image with R, G, and B channels of 512×512 as an example to apply this method. Figure 4 The diagram of the encrypted and decrypted images is shown below. The original image is a 512×512 sample image; the ciphertext image is the final encrypted image using this method; and the decrypted image is the decrypted image restored using this method.

[0137] The following image is in TIFF format Take the encrypted image as an example, and analyze the pixel ratios of the three channels R, G, and B. Figure 5As shown in the figure, taking the red channel histogram as an example, the horizontal axis pixel value is the ciphertext image pixel value 0-255, and the vertical axis frequency is the frequency of occurrence of each pixel value. It is not difficult to find that in the R channel, the frequency of occurrence of each pixel value tends to be average.

[0138] Correspondingly, the frequency of occurrence of pixel values ​​in channels G and B is similar to that of the R channel (e.g. Figure 5 ).

[0139] The algorithm performance analysis of the color image encryption method based on three-dimensional dynamic pixel code replacement of the present invention is carried out. The specific process of the algorithm performance analysis is as follows:

[0140] (1) Correlation analysis between pixels: 5000 pairs of pixels were randomly selected for visualization and analysis, referring to Figure 6 Shown, including:

[0141] In the figure, the horizontal, vertical and diagonal correlation of R, G and B channels. Figure 6 As shown in the schematic diagram of the correlation between pixels of the ciphertext image, Figure 6 In the nine sub-images, from top to bottom, these are the R, G, and B channels; from left to right, these are the horizontal, vertical, and diagonal correlations of the channels. The correlation distribution of the ciphertext image is very uniform in all three directions, and the correlation between adjacent pixels is approximately zero.

[0142] (2) Key sensitivity analysis: A good encryption scheme should be sensitive to changes in the key. A small change in the key should have a significant impact on the output, that is, it will produce a completely different encrypted image, so that attackers cannot easily obtain plaintext information. Change 1 bit K1, decrypt the image The unreadable noise-like state is still maintained, indicating that the present invention is very sensitive to tiny perturbations of the secret key.

[0143] (3) Information entropy test: The concept of entropy in physics is related to the unpredictability of information sources. The entropy of a digital image is a random estimate used to measure the clarity of the histogram peak. , its information entropy is defined as follows:

[0144] (twenty two)

[0145] in Indicates pixel value According to this formula, the ideal value of information entropy is 8; the closer it is to 8, the more secure the image information is. After multiple tests, the method presented in this paper consistently maintained an average value above 7.991, close to the ideal value of 8, indicating that the randomization effect of the ciphertext image achieved by this method meets the requirements.

[0146] (4) Analysis of resistance to differential attacks: Differential attacks can analyze the impact of any change in the original image on the corresponding encryption result and establish a relationship between the two. A feasible image encryption method must be able to resist differential attacks. In the experiment, the given image is randomly changed. A pixel in , generates 100 images ( ), one hundred encrypted images ( ), for each ciphertext image change, calculate its The NPCR and UACI values ​​are calculated using the following formulas. and UACI and NPCR were calculated, and the average NPCR value was approximately 99.61%; the average UACI value was 33.37%, which is very close to the ideal value and has good anti-differential performance.

[0147] (twenty three)

[0148] In another embodiment, a computer storage medium stores a computer program, which implements the above-mentioned color image encryption method based on three-dimensional dynamic pixel code replacement when executed.

[0149] The specific encryption method adopts the above-mentioned color image encryption method based on three-dimensional dynamic pixel coding replacement, which will not be described in detail here.

[0150] In yet another embodiment, a color image encryption system based on three-dimensional dynamic pixel code replacement includes:

[0151] The original encoding module encodes the color image to be encrypted;

[0152] The calculation module uses the random number sequence stream to construct a three-dimensional dynamic pixel replacement matrix and generate the diffusion sequence required for secondary encryption;

[0153] The encryption module uses a three-dimensional dynamic pixel replacement matrix to replace the pixels of the encoded color image to be encrypted according to the three-dimensional rectangular coordinates, and performs a diffusion operation on the replaced result to complete the secondary encryption to obtain the ciphertext image of the color image to be encrypted.

[0154] The specific implementation method adopts the above-mentioned color image encryption method based on three-dimensional dynamic pixel coding replacement, which will not be described in detail here.

[0155] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered as equivalent replacement methods and are included in the scope of protection of the present invention.

Claims

1. A color image encryption method based on three-dimensional dynamic pixel code replacement, characterized in that: The following steps are involved: S01: Encode the color image to be encrypted; S02: Using a random number sequence stream to construct a three-dimensional dynamic pixel replacement matrix and generate a diffusion sequence required for secondary encryption; the random number sequence stream generation method includes: use SM3 Algorithm calculation of color image to be encrypted and binary numbers salt Hash value of the sum to get the initial key : Will Divided into secret key seeds KEY and random vectors IV , through Zu Chongzhi's algorithm generate L Random number sequence stream , the resulting random number sequence stream Z ; The method of constructing a three-dimensional dynamic pixel replacement matrix includes: S21: After obtaining the random number sequence stream Z, convert Z into decimal Z 10 ,Will Z 10 Sequence divided into groups of 4 decimal digits , For each group of 4 decimal digits; S22: Calculate the replacement sequence : , All the calculated Get a vector in the range of 0-767 , index is a one-dimensional vector S Assign index values ​​in order from 0 to 767; S23: Vector S After three-dimensional folding, a three-dimensional dynamic replacement matrix is ​​obtained; S03: Using a three-dimensional dynamic pixel replacement matrix to replace the pixels of the encoded color image to be encrypted according to the three-dimensional rectangular coordinates, and performing a diffusion operation on the replaced result to complete secondary encryption, thereby obtaining a ciphertext image of the color image to be encrypted.

2. The color image encryption method based on three-dimensional dynamic pixel code replacement according to claim 1, characterized in that: Step S01 includes: Get the length M 、Width N Color image , for the Row, No. Column pixels ,have ;in , , Respectively expressed in The intensity of the red, green, and blue channels at for Every pixel in Add code, respectively R, G, B The channel code is 00, 01, 10, and each pixel Convert to 2-bit channel-specific encoding and splice 8-bit pixel original encoding to obtain : , , The encoded image Splicing into data stream form D : 。 3. The color image encryption method based on three-dimensional dynamic pixel code replacement according to claim 1, characterized in that: The salt value in step S02 is: , in, is from a uniform distribution Random variables sampled from ; is the sum index of the salt value, from 0 to 15; 。 4. The color image encryption method based on three-dimensional dynamic pixel code replacement according to claim 1, characterized in that: The method for folding the vector S in three dimensions in step S23 includes: Generate a three-dimensional matrix Matrix[3][16][16], and transform the vector S Arrange them into Matrix[3][16][16] according to the following formula, and assign their three-dimensional coordinates according to the following formula ,Right now: , , x, y, and z correspond to the three-dimensional array subscripts, and Matrix is ​​a three-dimensional replacement matrix sequence in a rectangular coordinate system; After the sequence S is arranged, a three-dimensional dynamic replacement matrix is ​​obtained.

5. The color image encryption method based on three-dimensional dynamic pixel code replacement according to claim 2, characterized in that: The method of replacing the pixels of the color image to be encrypted according to the three-dimensional rectangular coordinates using the three-dimensional dynamic pixel replacement matrix in step S03 includes: The 10-bit encoding of each pixel in D is represented as: , divided into 2-bit, 4-bit, and 4-bit forms from high to low, respectively, convert them into decimal, and D Each pixel is converted into a rectangular coordinate system : , Where k is the channel; Find its corresponding coordinates in the three-dimensional dynamic pixel replacement matrix and replace it with the pixel at the coordinate position. After the replacement is completed, the initial encrypted sequence is obtained : , Matrix is ​​a three-dimensional replacement matrix sequence in a rectangular coordinate system.

6. The color image encryption method based on three-dimensional dynamic pixel code replacement according to claim 5, characterized in that: The method for completing the secondary encryption in step S03 includes: Convert the obtained random number sequence stream Z into binary , making Length and D Perform XOR operation on each bit of ; The initially encrypted sequence and Bitwise XOR: , Perform diffusion operation, That is the complete encrypted sequence, the pixel sequence recover: , , That is the ciphertext image.

7. The color image encryption method based on three-dimensional dynamic pixel code replacement according to claim 1, characterized in that: During the decryption process, if you want to convert the initially encrypted sequence Restore to original encoding D , you need to first decrypt the data Decompose into single pixels : , , Will Convert to , and traverse the 3D-DPRM, according to The value of finds the unique corresponding position in the three-dimensional dynamic pixel replacement matrix, and the coordinates of the position ( P , Q , R ) is The decimal representation of the original text is: , in, P , Q , R is the subscript of the three-dimensional array; Convert it to binary and concatenate it to get : , After inversely replacing all pixels, Splice in sequence to get the original code D : 。 8. A color image encryption system based on three-dimensional dynamic pixel code replacement, characterized in that: include: The original encoding module encodes the color image to be encrypted; The calculation module uses the random number sequence stream to construct a three-dimensional dynamic pixel replacement matrix and generate the diffusion sequence required for secondary encryption; The methods for generating random number sequence streams include: use SM3 Algorithm calculation of color image to be encrypted and binary numbers salt Hash value of the sum to get the initial key : Will Divided into secret key seeds KEY and random vectors IV , through Zu Chongzhi's algorithm generate L Random number sequence stream , the resulting random number sequence stream Z ; The method of constructing a three-dimensional dynamic pixel replacement matrix includes: S21: After obtaining the random number sequence stream Z, convert Z into decimal Z 10 ,Will Z 10 Sequence divided into groups of 4 decimal digits , For each group of 4 decimal digits; S22: Calculate the replacement sequence : , All the calculated Get a vector in the range of 0-767 , index is a one-dimensional vector S Assign index values ​​in order from 0 to 767; S23: Vector S After three-dimensional folding, a three-dimensional dynamic replacement matrix is ​​obtained; The encryption module uses a three-dimensional dynamic pixel replacement matrix to replace the pixels of the encoded color image to be encrypted according to the three-dimensional rectangular coordinates, and performs a diffusion operation on the replaced result to complete the secondary encryption to obtain the ciphertext image of the color image to be encrypted.

9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the color image encryption method based on three-dimensional dynamic pixel coding replacement described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Decryption method of encrypted image based on hyper-chaotic system and automatic cell machine

    CN108898024A

  • Chaotic sequence and DNA mutation image encryption method and device

    CN112084514A