Color image encryption and decryption method based on compressed sensing and Latin cube

Through a color image encryption method based on compressed sensing and Latin cube, chaotic system and Latin cube are used to perform sparse transformation and scrambling of color images, which solves the problems of low computational efficiency and poor security of existing color image encryption methods and realizes efficient image encryption and decryption.

CN116506615BActive Publication Date: 2025-09-23HENAN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310528077.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2025-09-23
Estimated Expiration
2043-05-10

AI Technical Summary

Technical Problem

Existing color image encryption methods have low computational efficiency and poor security, and cannot meet encryption requirements.

Method used

An encryption method based on compressed sensing and Latin cube is adopted. The color image is decomposed into three pixel matrices. The Logistic-Sine-Cosine and Henon chaotic systems are used to generate chaotic sequences for sparse transformation and scrambling. The Latin cube is combined for image scrambling and diffusion. Finally, compression measurement and quantization processing are performed.

Benefits of technology

It improves encryption efficiency, reduces storage space, enhances security, resists plaintext attacks and statistical attacks, and is suitable for practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116506615B_ABST
    Figure CN116506615B_ABST
Patent Text Reader

Abstract

The present invention provides a color image encryption and decryption method based on compressed sensing and Latin cube. The encryption method mainly includes the following steps: based on a given external key and initial value, the Logistic-Sine-Cosine chaotic system is iteratively generated into four chaotic sequences X1, X2, X3, and X4, and the Henon chaotic system is iteratively generated into chaotic sequences Y1 and Y2; the plaintext image is sparsely processed using a wavelet sparse basis, and then the sparse matrix is ​​reordered using the chaotic sequences X1, X2, and X3. According to X4, a measurement matrix that meets the requirements is obtained, and compressed sensing measurement is performed on the three sparse matrices. In the scrambling and diffusion process, the chaotic sequence Y1 is used to generate a three-dimensional Latin cube and a two-dimensional 0-1 square matrix. The compressed and encrypted image is then scrambled and diffused according to specific rules to obtain the final compressed ciphertext image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image encryption technology, and in particular to a color image encryption and decryption method based on compressed sensing and Latin cube. Background Art

[0002] With the development of communication technology and the advent of the big data era, digital images are occupying an increasingly larger proportion of the online information space and are gradually becoming the most important information carrier in Internet transmission. This is not only reflected in our daily lives, but is even more important in the military and medical fields. Therefore, protecting these images distributed on the open network is extremely important and necessary.

[0003] Traditional algorithms such as DES and AES can effectively encrypt text data. However, due to the large amount of color image data, high redundancy, and strong correlation between adjacent pixels, they have defects such as low computational efficiency and poor security when encrypting digital images, and cannot meet encryption requirements. Summary of the Invention

[0004] Aiming at the problems of low computational efficiency and poor security of existing color image encryption methods, the present invention provides an image encryption and decryption method based on compressed sensing and Latin cube.

[0005] In one aspect, the present invention provides a color image encryption method based on compressed sensing and Latin cube, comprising:

[0006] Step 1: Divide the original image P into three pixel matrices PicR, PicG, and PicB of size M*N;

[0007] Step 2: Based on the given external key and initial value, the Logistic-Sine-Cosine chaotic system is iterated to generate four chaotic sequences X1, X2, X3, and X4 of length M*N; the Henon chaotic system is iterated to generate a chaotic sequence Y1 of length M*N*3 and a chaotic sequence Y2 of length M*N;

[0008] Step 3: Use the wavelet sparse basis to perform sparse transformation on the three pixel matrices PicR, PicG, and PicB, and obtain three corresponding sparse matrices. Use the chaotic sequences X1, X2, and X3 to scramble the three sparse matrices respectively;

[0009] Step 4: Based on the compression rate c, the chaotic sequence X4 is transformed into a measurement matrix Φ of size (c*M)*N;

[0010] Step 5: Use the measurement matrix Φ to perform compression measurement on the three scrambled matrices, and obtain the compressed encrypted images CSR, CSG, and CSB of size (c*M)*N. Perform uniform quantization on CSR, CSG, and CSB, and obtain the quantized images CSR', CSG', and CSB'.

[0011] Step 6: Generate a three-dimensional Latin cube L of size M*N*3 and a two-dimensional 0-1 matrix LH of size M*N according to the chaotic sequence Y1;

[0012] Step 7: Calculate the scrambling mode indicator value l0 according to the Latin cube L, use l0 to select the corresponding scrambling mode to perform row and column cross scrambling on the quantized images CSR', CSG', and CSB' to obtain the scrambled images ScramCR, ScramCG, and ScramCB;

[0013] Step 8: First, reorder the matrix LH according to the index matrix Index Y1 of the chaotic sequence Y1, and then perform an XOR diffusion operation to obtain three images CR, CG, and CB;

[0014] Step 9: Combine CR, CG, and CB to obtain the ciphertext image C.

[0015] Furthermore, step 2 specifically includes:

[0016] Step 2.1: Generate a 256-bit hash value H of the plaintext image P using the hash function SHA-256, and divide the 256-bit hash value H into 32 groups of 8 bits each, as shown in formula (1):

[0017] H=[h1,h2,...h 32 ](1)

[0018] Step 2.2: Calculate the initial values ​​x0, y0, z0, w0, p0, q0 of the Logistic-Sine-Cosine chaotic system and the Henon chaotic system according to formula (2):

[0019]

[0020] Among them, mod represents the remainder operation, t1, t2, t3, t4 represent the given external key, and hex2dec represents the conversion of a hexadecimal number to a decimal number;

[0021] Step 2.3: Take x0, y0, z0, and w0 as initial values, and bring them into the Logistic-Sine-Cosine system in turn. Iterate each of them d+M*N times and discard the first d values. Correspondingly, the chaotic sequences X1, X2, X3, and X4 of length M*N are obtained.

[0022] Step 2.4: Substitute the initial values ​​p0 and q0 into the Henon chaotic system, iterate d+M*N*3 and d+M*N times respectively, discard the first d values, and finally generate a chaotic sequence Y1 of length M*N*3 and a chaotic sequence Y2 of length M*N.

[0023] Furthermore, step 3 specifically includes:

[0024] Step 3.1: Generate a wavelet sparse basis U of size M*N using discrete cosine transform;

[0025] Step 3.2: Based on the wavelet sparse basis U, perform sparse transformation on PicR, PicG, and PicB according to formula (5) to obtain three sparse matrices SparsePR, SparsePG, and SparsePB;

[0026]

[0027] Step 3.3: Arrange the chaotic sequences X1, X2, and X3 in ascending order to obtain the corresponding index matrices Index X1, Index X2, and Index X3. Use Index X1, Index X2, and Index X3 to scramble SparsePR, SparsePG, and SparsePB respectively to obtain the scrambled matrices SparsePR', SparsePG', and SparsePB'.

[0028] Furthermore, step 5 specifically includes:

[0029] Step 5.1: Use the measurement matrix Φ to perform compression measurement on the scrambled matrix according to formula (6):

[0030]

[0031] Step 5.2: Perform uniform quantization on CSR, CSG, and CSB respectively according to formula (7):

[0032]

[0033] Where C(min) is the minimum pixel value of image C, C(max) is the maximum pixel value, round is rounded to the nearest integer, C(i,j) and C'(i,j) represent the pixel values ​​of the i-th row and j-th column in image C before and after quantization, and C represents CSR, CSG, and CSB, respectively.

[0034] Furthermore, step 6 specifically includes:

[0035] Step 6.1: Generate a three-dimensional Latin cube L of size M*N*3 according to the chaotic sequence Y1 according to formula (8), and divide L into three M*N matrices L1, L2, and L3;

[0036] L(i,j,k)=Y1(k)+a*Y1(j)+a*a*Y1(i) (8)

[0037] Where a represents the control parameter of the Latin cube, Y1(i), Y1(j), and Y1(k) represent the values ​​of the i-th, j-th, and k-th elements in the chaotic sequence Y1, respectively;

[0038] Step 6.2: According to the matrices L1, L2, and L3, we can obtain the matrix LH according to formula (9):

[0039]

[0040] Among them, L1(i,j), L2(i,j), L3(i,j), and LH(i,j) represent the pixel values ​​of the i-th row and j-th column in the corresponding matrix respectively.

[0041] Furthermore, step 7 specifically includes:

[0042] Step 7.1: Obtain the scrambling mode indicator value l0 according to formula (10);

[0043] l0=floor(mod(trace(L1)+trace(L2)+trace(L3)),3) (10)

[0044] Among them, trace is to find the trace of the matrix, floor is the integer operation, and mod is the remainder operation;

[0045] Step 7.2: If l0=0, replace the odd-numbered pixel values ​​of the matrix CSB' with the odd-numbered pixel values ​​of the matrix CSG' to obtain the image ScramCB, replace the odd-numbered pixel values ​​of the matrix CSG' with the odd-numbered pixel values ​​of the matrix CSR' to obtain the matrix ScramCG, and replace the odd-numbered pixel values ​​of the matrix CSB' with the odd-numbered pixel values ​​of the matrix CSR' to obtain the matrix ScramCR;

[0046] Step 7.3: If l0=1, rotate the matrix CSR' counterclockwise by 90° to obtain the matrix NEWCSR', replace the odd-numbered row pixel values ​​of the matrix CSB' with the odd-numbered row pixel values ​​of the matrix CSG' to obtain the matrix ScramCB, replace the odd-numbered column pixel values ​​of the matrix CSG' with the odd-numbered column pixel values ​​of the matrix NEWCSR' to obtain the matrix ScramCG, and replace the odd-numbered row pixel values ​​of the matrix NEWCSR' with the odd-numbered row pixel values ​​of the matrix CSB' to obtain the matrix ScramCR;

[0047] Step 7.4: If l0=2, rotate the matrix CSR' counterclockwise by 180° to obtain the matrix NEWCSR', replace the even-numbered row pixel values ​​of the matrix CSB' with the even-numbered row pixel values ​​of the matrix CSG' to obtain the matrix ScramCB, replace the even-numbered row pixel values ​​of the matrix CSG' with the even-numbered row pixel values ​​of the matrix NEWCSR' to obtain the matrix ScramCG, and replace the even-numbered row pixel values ​​of the matrix NEWCSR' with the even-numbered row pixel values ​​of the matrix CSB' to obtain the matrix ScramCR.

[0048] Furthermore, step 8 specifically includes:

[0049] Step 8.1: Arrange the chaotic sequence Y1 in ascending order to obtain the corresponding index matrix Index Y1, and use IndexY1 to reorder the matrix LH to obtain the matrix LH';

[0050] Step 8.2: quantize the chaotic sequence Y2 according to formula (11);

[0051] Y(i)=mod(floor(Y2(i)*10 10 ),256) (11)

[0052] Step 8.3: Convert the matrix LH' and ScramCR, ScramCG, and ScramCB into a one-dimensional sequence;

[0053] Step 8.4: Perform XOR diffusion operation according to formula (12) to obtain three images CR, CG, and CB;

[0054]

[0055] Among them, ScramCR(i), ScramCG(i), ScramCB(i), LH'(i), Y(i), CR(i), CG(i) and CB(i) respectively represent the value of the i-th element in the corresponding sequence or image.

[0056] In another aspect, the present invention provides a color image decryption method based on compressed sensing and Latin cube, comprising:

[0057] Step 1: Divide the ciphertext image C into three images CR, CG, and CB;

[0058] Step 2: Based on the given control parameters and initial values, the Henon chaotic system is iterated to generate a chaotic sequence Y1 of length M*N*3 and a chaotic sequence Y2 of length M*N; where M and N represent the number of rows and columns of the ciphertext image C;

[0059] Step 3: Generate a three-dimensional Latin cube L of size M*N*3 and a matrix LH of size M*N according to the chaotic sequence Y1;

[0060] Step 4: Use the chaotic sequence Y2 and matrix LH to perform inverse diffusion on CR, CG, and CB to obtain the preliminary restored images ScramCR, ScramCG, and ScramCB;

[0061] Step 5: Calculate the scrambling mode indicator value l0 according to the Latin cube L, and use l0 to select the corresponding scrambling mode to perform inverse scrambling on ScramCR, ScramCG, and ScramCB, and obtain the quantized images CSR', CSG', and CSB' accordingly;

[0062] Step 6: Perform inverse quantization on the quantized images CSR', CSG', and CSB' to obtain compressed encrypted images CSR, CSG, and CSB;

[0063] Step 7: Use the SP algorithm to reconstruct the compressed encrypted images CSR, CSG, and CSB, and obtain three corresponding wavelet sparse images. Perform inverse wavelet transform on the three wavelet sparse images to obtain decrypted decompressed images PicR, PicG, and PicB.

[0064] Step 8: Combine PicR, PicG, and PicB to obtain the plaintext image P.

[0065] Beneficial effects of the present invention:

[0066] The color image encryption method based on compressed sensing and Latin cube proposed in this paper differs from most existing image encryption algorithms in that it first compresses the image, then uses the plaintext image to generate the initial parameter values ​​of the chaotic system and obtain the Latin cube, which is then used for scrambling and diffusion. This method exhibits significant compression performance, saves storage space during transmission, improves transmission efficiency, and achieves good encryption results for various images, making it suitable for practical applications. Furthermore, quantization processing is added to the compressed sensing process, minimizing data distortion. The Latin cube used in the scrambling and diffusion processes is generated from the plaintext image, resulting in strong randomness and high key sensitivity, effectively resisting both plaintext and statistical attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 A flowchart of a color image encryption method based on compressed sensing and Latin cube provided by an embodiment of the present invention;

[0068] Figure 2The encryption and decryption effect diagram of the embodiment of the present invention: (a) is the Lena plaintext image, size 256*256; (b) is the ciphertext image with a compression rate of 0.25; (c) is the Lena decrypted image with a compression rate of 0.25;

[0069] Figure 3 Histograms of Lean plaintext images and ciphertext images provided by the embodiments of the present invention;

[0070] Figure 4 Correlation distribution diagram of adjacent pixels of Lean plaintext image and ciphertext image provided by the embodiment of the present invention. DETAILED DESCRIPTION

[0071] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0072] Example 1

[0073] like Figure 1 As shown, an embodiment of the present invention provides a color image encryption method based on compressed sensing and Latin cube, comprising the following steps:

[0074] S101: Divide the original image P into three pixel matrices PicR, PicG, and PicB of size M*N;

[0075] S102: Based on a given external key and initial value, the Logistic-Sine-Cosine chaotic system is iterated to generate four chaotic sequences X1, X2, X3, and X4, each of which has a length of M*N; the Henon chaotic system is iterated to generate a chaotic sequence Y1 with a length of M*N*3 and a chaotic sequence Y2 with a length of M*N;

[0076] S103: Using a wavelet sparse basis to perform sparse transformation on the three pixel matrices PicR, PicG, and PicB, and obtain three corresponding sparse matrices. The three sparse matrices are scrambled using chaotic sequences X1, X2, and X3 respectively;

[0077] S104: Based on the compression rate c, the chaotic sequence X4 is converted into a measurement matrix Φ of size (c*M)*N;

[0078] S105: Using the measurement matrix Φ, the three scrambled matrices are compressed and measured to obtain compressed encrypted images CSR, CSG, and CSB of size (c*M)*N, and CSR, CSG, and CSB are uniformly quantized to obtain quantized images CSR', CSG', and CSB'.

[0079] S106: Generate a three-dimensional Latin cube L with a size of M*N*3 and a two-dimensional 0-1 matrix LH with a size of M*N according to the chaotic sequence Y1;

[0080] S107: Calculate the scrambling mode indicator value l0 according to the Latin cube L, use l0 to select the corresponding scrambling mode to perform row and column cross scrambling on the quantized images CSR', CSG', and CSB', and obtain the scrambled images ScramCR, ScramCG, and ScramCB;

[0081] S108: First, reorder the matrix LH according to the index matrix Index Y1 of the chaotic sequence Y1, and then perform an XOR diffusion operation to obtain three images CR, CG, and CB;

[0082] S109: Combine CR, CG, and CB to obtain the ciphertext image C.

[0083] The encryption method provided by the present invention utilizes a compressed sensing-based encryption algorithm based on the characteristics of color images. Leveraging its high encryption efficiency, simultaneous encryption and compression, and robustness against noise and packet loss, the algorithm is improved and optimized, combined with a classic encryption module. This significantly enhances encryption effectiveness while ensuring security. Furthermore, the use of two different chaotic systems further improves the overall performance of the encryption method due to their inherent characteristics, such as sensitivity to initial conditions, ergodicity, unpredictability, and good pseudo-randomness.

[0084] Example 2

[0085] On the basis of the above embodiment, Figure 2 Taking the plaintext Lean image of size 256*256 in (a) as an example of the plaintext image P, the color image encryption method based on compressed sensing and Latin cube in an embodiment of the present invention specifically includes the following steps:

[0086] S201: Divide the original image P into three pixel matrices PicR, PicG, and PicB of size 256*256;

[0087] S202: Based on the given control parameters and initial values, the Logistic-Sine-Cosine chaotic system is iteratively generated to generate four chaotic sequences X1, X2, X3, and X4, each with a length of 256*256; the Henon chaotic system is iteratively generated to generate a chaotic sequence Y1 with a length of 256*256*3 and a chaotic sequence Y2 with a length of M*N;

[0088] Specifically, the method includes the following sub-steps:

[0089] S2021: Generate a 256-bit hash value H of the plaintext Lean image using the hash function SHA-256, and divide the 256-bit hash value H into 32 groups of 8 bits each, expressed as formula (1):

[0090] H=[h1,h2,...h 32 ] (1)

[0091] S2022: Calculate the initial values ​​x0, y0, z0, w0, p0, q0 of the Logistic-Sine-Cosine chaotic system and the Henon chaotic system according to formula (2):

[0092]

[0093] Among them, mod represents the remainder operation, t1, t2, t3, t4 represent the given external key, and hex2dec represents the conversion of a hexadecimal number to a decimal number;

[0094] Specifically, in this embodiment, given the external key t1=0.354564, t2=0.154354, t3=0.254168, t4=0.445635, it is calculated that x0=0.3677, y0=0.5370, z0=0.7396, w0=0.9370, p0=0.2154, q0=0.2153.

[0095] S2023: Take x0, y0, z0, and w0 as initial values, and sequentially introduce them into the Logistic-Sine-Cosine system. Iterate each of them d+M*N times and discard the first d values. This will give the chaotic sequences X1, X2, X3, and X4 of length M*N. Where d=200 and M=N=256.

[0096] Specifically, the equation of the Logistic-Sine-Cosine chaotic system is expressed using formula (3):

[0097] A(i+1)=cos(pi*(4*r*A(i)*(1-A(i))+(1-r)*sin(pi*A(i))-0.5)) (3)

[0098] Among them, r is the control parameter. When r=0.7, the system exhibits chaos.

[0099] Taking X1 as an example, set A(0) = x0, substitute it into formula (3), iterate 200+256*256 times, discard the first 200 values, and obtain a chaotic sequence X1 with a length of 256*256. Similarly, X2, X3, and X4 can be obtained accordingly.

[0100] S2024: Substitute the initial values ​​p0 and q0 into the Henon chaotic system, iterate d+M*N*3 and d+M*N times respectively, discard the first d values, and finally generate a chaotic sequence Y1 of length M*N*3 and a chaotic sequence Y2 of length M*N; where d = 200 and M = N = 256;

[0101] Specifically, the equation of the Henon chaotic system is expressed using formula (4):

[0102]

[0103] Among them, a and b are control parameters. When a=1.4 and b=0.3, the system exhibits chaotic phenomena.

[0104] Taking Y1 as an example, set x(0) = p0 and y(0) = q0, substitute into formula (4), iterate 200 + 256 * 256 * 3 times, discard the first 200 values, and obtain a chaotic sequence Y1 with a length of 256 * 256 * 3. Similarly, Y2 can be obtained.

[0105] S203: Using a wavelet sparse basis to perform sparse transformation on the three pixel matrices PicR, PicG, and PicB, and obtain three corresponding sparse matrices. The three sparse matrices are scrambled using chaotic sequences X1, X2, and X3 respectively;

[0106] Specifically, the method includes the following sub-steps:

[0107] S2031: Generate a wavelet sparse basis U of size M*N using discrete cosine transform;

[0108] S2032: Perform sparse transformation on PicR, PicG, and PicB according to formula (5) based on the wavelet sparse basis U to obtain three sparse matrices SparsePR, SparsePG, and SparsePB;

[0109]

[0110] S2033: Arrange the chaotic sequences X1, X2, and X3 in ascending order to obtain the corresponding index matrices Index X1, IndexX2, and Index X3, and use Index X1, Index X2, and Index X3 to scramble SparsePR, SparsePG, and SparsePB respectively to obtain the scrambled matrices SparsePR', SparsePG', and SparsePB'.

[0111] S204: Given a compression ratio c=0.25, the chaotic sequence X4 is transformed into a measurement matrix Φ of size (0.25*256)*256;

[0112] S205: Using the measurement matrix Φ, the three scrambled matrices are compressed and measured to obtain compressed encrypted images CSR, CSG, and CSB of size (3*256)*256. CSR, CSG, and CSB are uniformly quantized to obtain quantized images CSR', CSG', and CSB'.

[0113] Specifically, the method includes the following sub-steps:

[0114] S2051: Use the measurement matrix Φ to perform compression measurement on the scrambled matrix according to formula (6):

[0115]

[0116] S2052: Since the compressed sensing measurement obtains double-precision measurement values, it is necessary to perform uniform quantization processing on CSR, CSG, and CSB according to formula (7) to keep the pixel values ​​within the range of (0-255):

[0117]

[0118] Where C(min) is the minimum pixel value of image C, C(max) is the maximum pixel value, round is rounding, C(i,j) and C'(i,j) represent the pixel values ​​of the i-th row and j-th column in image C before and after quantization, and C represents CSR, CSG, and CSB.

[0119] S206: Generate a three-dimensional Latin cube L with a size of M*N*3 and a matrix LH with a size of M*N according to the chaotic sequence Y1;

[0120] Specifically, the method includes the following sub-steps:

[0121] S2061: Generate a 3D Latin cube L with a size of 256*256*3 according to the chaotic sequence Y1 according to formula (8), and divide L into three 256*256 matrices L1, L2, and L3;

[0122] L(i,j,k)=Y1(k)+a*Y1(j)+a*a*Y1(i) (8)

[0123] Wherein, a represents the control parameter of the Latin cube. In this embodiment, a=3; Y1(i), Y1(j), and Y1(k) represent the values ​​of the i-th, j-th, and k-th elements in the chaotic sequence Y1, respectively;

[0124] S2062: Obtain a two-dimensional 0-1 matrix LH according to formula (9) based on matrices L1, L2, and L3:

[0125]

[0126] Among them, L1(i,j), L2(i,j), L3(i,j), and LH(i,j) respectively represent the pixel values ​​of the i-th row and j-th column in the corresponding matrix.

[0127] S207: Calculate the scrambling mode indicator value l0 according to the Latin cube L, use l0 to select the corresponding scrambling mode to perform row and column cross scrambling on the quantized images CSR', CSG', and CSB', and obtain the scrambled images ScramCR, ScramCG, and ScramCB;

[0128] Specifically, the method includes the following sub-steps:

[0129] S2071: Obtain the scrambling mode indicator value l0 according to formula (10);

[0130] l0=floor(mod(trace(L1)+trace(L2)+trace(L3)),3) (10)

[0131] Among them, trace is to find the trace of the matrix, floor is the integer operation, and mod is the remainder operation;

[0132] S2072: If l0=0, replace the odd-numbered pixel values ​​of the matrix CSB' with the odd-numbered pixel values ​​of the matrix CSG' to obtain the image ScramCB, replace the odd-numbered pixel values ​​of the matrix CSG' with the odd-numbered pixel values ​​of the matrix CSR' to obtain the matrix ScramCG, and replace the odd-numbered pixel values ​​of the matrix CSB' with the odd-numbered pixel values ​​of the matrix CSR' to obtain the matrix ScramCR;

[0133] S2073: If l0=1, rotate the matrix CSR' counterclockwise by 90° to obtain the matrix NEWCSR', replace the odd-numbered row pixel values ​​of the matrix CSB' with the odd-numbered row pixel values ​​of the matrix CSG' to obtain the matrix ScramCB, replace the odd-numbered column pixel values ​​of the matrix CSG' with the odd-numbered column pixel values ​​of the matrix NEWCSR' to obtain the matrix ScramCG, and replace the odd-numbered row pixel values ​​of the matrix NEWCSR' with the odd-numbered row pixel values ​​of the matrix CSB' to obtain the matrix ScramCR;

[0134] S2074: If l0=2, rotate the matrix CSR' counterclockwise by 180° to obtain the matrix NEWCSR', replace the even-numbered row pixel values ​​of the matrix CSB' with the even-numbered row pixel values ​​of the matrix CSG' to obtain the matrix ScramCB, replace the even-numbered row pixel values ​​of the matrix CSG' with the even-numbered row pixel values ​​of the matrix NEWCSR' to obtain the matrix ScramCG, and replace the even-numbered row pixel values ​​of the matrix NEWCSR' with the even-numbered row pixel values ​​of the matrix CSB' to obtain the matrix ScramCR.

[0135] S208: First, reorder the matrix LH according to the index matrix Index Y1 of the chaotic sequence Y1, and then perform an XOR diffusion operation to obtain three images CR, CG, and CB;

[0136] Specifically, it includes the following sub-steps:

[0137] S2081: Arrange the chaotic sequence Y1 in ascending order to obtain the corresponding index matrix Index Y1, and use Index Y1 to reorder the matrix LH to obtain the matrix LH';

[0138] S2082: quantize the chaotic sequence Y2 according to formula (11) so that the chaotic value is maintained in the range of (0-255);

[0139] Y(i)=mod(floor(Y2(i)*10 10 ),256) (11)

[0140] S2083: Convert the matrix LH' and ScramCR, ScramCG, and ScramCB into a one-dimensional sequence;

[0141] S2084: Perform an XOR diffusion operation according to formula (12) to obtain three images CR, CG, and CB;

[0142]

[0143] Among them, ScramCR(i), ScramCG(i), ScramCB(i), LH'(i), Y(i), CR(i), CG(i) and CB(i) respectively represent the value of the i-th element in the corresponding sequence or image.

[0144] S209: Combine CR, CG, and CB to obtain the ciphertext image C. The encryption effect is as follows Figure 2 (b) shown.

[0145] Example 3

[0146] On the basis of the above embodiment 2, Figure 2 Taking the ciphertext image in (b) as an example, an embodiment of the present invention provides a color image decryption method based on compressed sensing and Latin cube, including the following steps:

[0147] S301: Divide the ciphertext image C into three images CR, CG, and CB;

[0148] S302: Based on the given control parameters and initial values, the Henon chaotic system is iterated to generate a chaotic sequence Y1 of length M*N*3 and a chaotic sequence Y2 of length M*N; where M and N represent the number of rows and columns of the ciphertext image C;

[0149] S303: Generate a three-dimensional Latin cube L with a size of M*N*3 and a matrix LH with a size of M*N according to the chaotic sequence Y1;

[0150] S304: using the chaotic sequence Y2 and the matrix LH to perform inverse diffusion on CR, CG, and CB to obtain preliminary restored images ScramCR, ScramCG, and ScramCB;

[0151] S305: Calculate the scrambling mode indicator value l0 according to the Latin cube L, use l0 to select the corresponding scrambling mode to perform inverse scrambling on ScramCR, ScramCG, and ScramCB, and obtain the quantized images CSR', CSG', and CSB' accordingly;

[0152] S306: Perform inverse quantization on the quantized images CSR', CSG', and CSB' to obtain compressed encrypted images CSR, CSG, and CSB;

[0153] S307: reconstructing the compressed encrypted images CSR, CSG, and CSB using the SP algorithm to obtain three corresponding wavelet sparse images, and performing inverse wavelet transform on the three wavelet sparse images to obtain decrypted decompressed images PicR, PicG, and PicB;

[0154] S308: Combine PicR, PicG, and PicB to obtain the plaintext image P. The decryption effect is as follows: Figure 2 shown.

[0155] In the present invention, the simulation software and hardware environment of the above-mentioned embodiment 2 and embodiment 3 is shown in Table 1:

[0156] Table 1 Hardware and software environment

[0157]

[0158]

[0159] Figure 3 In the figure, the three images in the first row are the histograms of the three RGB components of the plaintext Lena image; the three images in the second row are the histograms of the three RGB components of the ciphertext Lena image. Figure 3 It can be clearly seen that the histogram of the plaintext image has obvious ripple characteristics, while the histogram of the ciphertext image after adopting the encryption method of the present invention tends to be evenly distributed.

[0160] Figure 4 In the figure, the three images in the first row are the adjacent pixel correlation distribution maps of the three RGB components of the plaintext Lena image; the three images in the second row are the adjacent pixel correlation distribution maps of the three RGB components of the ciphertext Lena image. Figure 4 It can be seen that the adjacent pixels of the plaintext image are linearly distributed, while the pixels of the ciphertext image are evenly distributed, which shows that the encryption method of the present invention can effectively weaken the correlation between adjacent pixels of the plaintext image.

[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A color image encryption method based on compressed sensing and Latin cube, characterized in that: include: Step 1: Divide the original image P into three pixel matrices PicR, PicG, and PicB of size M*N; Step 2: Based on the given external key and initial value, the Logistic-Sine-Cosine chaotic system is iterated to generate four chaotic sequences X1, X2, X3, and X4, each with a length of M*N. The Henon chaotic system is iterated to generate a chaotic sequence Y1 with a length of M*N*3 and a chaotic sequence Y2 with a length of M*N. Step 3: Use the wavelet sparse basis to perform sparse transformation on the three pixel matrices PicR, PicG, and PicB, and obtain three corresponding sparse matrices. Use the chaotic sequences X1, X2, and X3 to scramble the three sparse matrices respectively; Step 4: Based on the compression rate c, the chaotic sequence X4 is transformed into a measurement matrix Φ of size (c*M)*N; Step 5: Use the measurement matrix Φ to perform compression measurement on the three scrambled matrices, and obtain the compressed encrypted images CSR, CSG, and CSB of size (c*M)*N. Perform uniform quantization on CSR, CSG, and CSB, and obtain the quantized images CSR', CSG', and CSB'. Step 6: Generate a three-dimensional Latin cube L of size M*N*3 and a two-dimensional 0-1 matrix LH of size M*N based on the chaotic sequence Y1; specifically, the steps include: Step 6.1: Generate a three-dimensional Latin cube L of size M*N*3 according to the chaotic sequence Y1 according to formula (8), and divide L into three M*N matrices L1, L2, and L3; L(i,j,k)=Y1(k)+a*Y1(j)+a*a*Y1(i) (8) Where a represents the control parameter of the Latin cube, Y1(i), Y1(j), and Y1(k) represent the values ​​of the i-th, j-th, and k-th elements in the chaotic sequence Y1, respectively; Step 6.2: According to the matrices L1, L2, and L3, we can obtain the matrix LH according to formula (9): Among them, L1(i,j), L2(i,j), L3(i,j), and LH(i,j) represent the pixel values ​​of the i-th row and j-th column in the corresponding matrix respectively; Step 7: Calculate the scrambling mode indicator value l0 according to the Latin cube L, use l0 to select the corresponding scrambling mode to perform row and column cross scrambling on the quantized images CSR', CSG', and CSB' to obtain the scrambled images ScramCR, ScramCG, and ScramCB; Step 8: First, reorder the matrix LH according to the index matrix Index Y1 of the chaotic sequence Y1, and then perform an XOR diffusion operation to obtain three images CR, CG, and CB; specifically, the following steps are included: Step 8.1: Arrange the chaotic sequence Y1 in ascending order to obtain the corresponding index matrix Index Y1, and use Index Y1 to reorder the matrix LH to obtain the matrix LH'; Step 8.2: quantize the chaotic sequence Y2 according to formula (11); Y(i)=mod(floor(Y2(i)*10 10 ),256) (11) Step 8.3: Convert the matrix LH' and ScramCR, ScramCG, and ScramCB into a one-dimensional sequence; Step 8.4: Perform XOR diffusion operation according to formula (12) to obtain three images CR, CG, and CB; Wherein, ScramCR(i), ScramCG(i), ScramCB(i), LH'(i), Y(i), CR(i), CG(i), and CB(i) represent the value of the i-th element in the corresponding sequence or image respectively; Step 9: Combine CR, CG, and CB to obtain the ciphertext image C.

2. The color image encryption method based on compressed sensing and Latin cube according to claim 1, characterized in that: Step 2 specifically includes: Step 2.1: Generate a 256-bit hash value H of the plaintext image P using the hash function SHA-256, and divide the 256-bit hash value H into 32 groups of 8 bits each, as shown in formula (1): H=[h1,h2,...h 32 ](1) Step 2.2: Calculate the initial values ​​x0, y0, z0, w0, p0, q0 of the Logistic-Sine-Cosine chaotic system and the Henon chaotic system according to formula (2): Among them, mod represents the remainder operation, t1, t2, t3, t4 represent the given external key, and hex2dec represents the conversion of a hexadecimal number to a decimal number; Step 2.3: Take x0, y0, z0, and w0 as initial values, and bring them into the Logistic-Sine-Cosine system in turn. Iterate each of them d+M*N times and discard the first d values. Correspondingly, the chaotic sequences X1, X2, X3, and X4 of length M*N are obtained. Step 2.4: Substitute the initial values ​​p0 and q0 into the Henon chaotic system, iterate d+M*N*3 and d+M*N times respectively, discard the first d values, and finally generate a chaotic sequence Y1 of length M*N*3 and a chaotic sequence Y2 of length M*N.

3. The color image encryption method based on compressed sensing and Latin cube according to claim 1, characterized in that: Step 3 specifically includes: Step 3.1: Generate a wavelet sparse basis U of size M*N using discrete cosine transform; Step 3.2: Based on the wavelet sparse basis U, perform sparse transformation on PicR, PicG, and PicB according to formula (5) to obtain three sparse matrices SparsePR, SparsePG, and SparsePB; Step 3.3: Arrange the chaotic sequences X1, X2, and X3 in ascending order to obtain the corresponding index matrices Index X1, Index X2, and Index X3. Use Index X1, Index X2, and Index X3 to scramble SparsePR, SparsePG, and SparsePB respectively to obtain the scrambled matrices SparsePR', SparsePG', and SparsePB'.

4. The color image encryption method based on compressed sensing and Latin cube according to claim 3, characterized in that: Step 5 specifically includes: Step 5.1: Use the measurement matrix Φ to perform compression measurement on the scrambled matrix according to formula (6): Step 5.2: Perform uniform quantization on CSR, CSG, and CSB respectively according to formula (7): Where C(min) is the minimum pixel value of image C, C(max) is the maximum pixel value, round is rounding, C(i,j) and C'(i,j) represent the pixel values ​​of the i-th row and j-th column in image C before and after quantization, and C represents CSR, CSG, and CSB.

5. The color image encryption method based on compressed sensing and Latin cube according to claim 1, characterized in that: Step 7 specifically includes: Step 7.1: Obtain the scrambling mode indicator value l0 according to formula (10); l0=floor(mod(trace(L1)+trace(L2)+trace(L3)),3) (10) Among them, trace is to find the trace of the matrix, floor is the integer operation, and mod is the remainder operation; Step 7.2: If l0=0, replace the odd-numbered pixel values ​​of the matrix CSB' with the odd-numbered pixel values ​​of the matrix CSG' to obtain the image ScramCB, replace the odd-numbered pixel values ​​of the matrix CSG' with the odd-numbered pixel values ​​of the matrix CSR' to obtain the matrix ScramCG, and replace the odd-numbered pixel values ​​of the matrix CSB' with the odd-numbered pixel values ​​of the matrix CSR' to obtain the matrix ScramCR; Step 7.3: If l0=1, rotate the matrix CSR' counterclockwise by 90° to obtain the matrix NEWCSR', replace the odd-numbered row pixel values ​​of the matrix CSB' with the odd-numbered row pixel values ​​of the matrix CSG' to obtain the matrix ScramCB, replace the odd-numbered column pixel values ​​of the matrix CSG' with the odd-numbered column pixel values ​​of the matrix NEWCSR' to obtain the matrix ScramCG, and replace the odd-numbered row pixel values ​​of the matrix NEWCSR' with the odd-numbered row pixel values ​​of the matrix CSB' to obtain the matrix ScramCR; Step 7.4: If l0=2, rotate the matrix CSR' counterclockwise by 180° to obtain the matrix NEWCSR', replace the even-numbered row pixel values ​​of the matrix CSB' with the even-numbered row pixel values ​​of the matrix CSG' to obtain the matrix ScramCB, replace the even-numbered row pixel values ​​of the matrix CSG' with the even-numbered row pixel values ​​of the matrix NEWCSR' to obtain the matrix ScramCG, and replace the even-numbered row pixel values ​​of the matrix NEWCSR' with the even-numbered row pixel values ​​of the matrix CSB' to obtain the matrix ScramCR.

6. A color image decryption method based on compressed sensing and Latin cube, characterized in that: include: Step 1: Divide the ciphertext image C into three images CR, CG, and CB; the ciphertext image C is obtained by using the color image encryption method based on compressed sensing and Latin cube as claimed in claim 1; Step 2: Based on the given control parameters and initial values, the Henon chaotic system is iterated to generate a chaotic sequence Y1 with a length of M*N*3 and a chaotic sequence Y2 with a length of M*N; Where M and N represent the number of rows and columns of the ciphertext image C; Step 3: Generate a three-dimensional Latin cube L of size M*N*3 and a matrix LH of size M*N according to the chaotic sequence Y1; Step 4: Use the chaotic sequence Y2 and matrix LH to perform inverse diffusion on CR, CG, and CB to obtain the preliminary restored images ScramCR, ScramCG, and ScramCB; Step 5: Calculate the scrambling mode indicator value l0 according to the Latin cube L, and use l0 to select the corresponding scrambling mode to perform inverse scrambling on ScramCR, ScramCG, and ScramCB, and obtain the quantized images CSR', CSG', and CSB' accordingly; Step 6: Perform inverse quantization on the quantized images CSR', CSG', and CSB' to obtain compressed encrypted images CSR, CSG, and CSB; Step 7: Use the SP algorithm to reconstruct the compressed encrypted images CSR, CSG, and CSB, and obtain three corresponding wavelet sparse images. Perform inverse wavelet transform on the three wavelet sparse images to obtain decrypted decompressed images PicR, PicG, and PicB. Step 8: Combine PicR, PicG, and PicB to obtain the plaintext image P.

Citation Information

Patent Citations

  • Image encryption method based on 3D orthogonal Latin square and chaotic system

    CN110225222A

  • Color image compression encryption method based on two-dimensional compressed sensing and memristor chaotic system

    CN111614455A