A high-precision thumbnail encryption method for JPEG images

By encrypting the quantized DC coefficients of JPEG images and modifying the quantization table, combined with the multiple encryption method of generating pseudo-random sequences in the chaotic system, the problems of ciphertext security, thumbnail approximation effect and ciphertext expansion rate in the existing JPEG image encryption methods are solved, and high-precision ciphertext thumbnail consistency and security are achieved, which is suitable for efficient encryption of JPEG images.

CN115630390BActive Publication Date: 2025-08-19HENAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211090464.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-07
Publication Date
2025-08-19
Estimated Expiration
2042-09-07

AI Technical Summary

Technical Problem

The existing JPEG image retained thumbnail encryption method has defects in ciphertext security, thumbnail approximation effect, decrypted image quality, and ciphertext expansion rate, and cannot effectively take into account the privacy and usability of images.

Method used

By encrypting the quantized DC coefficients of plaintext JPEG images, modifying the quantization table, embedding decryption auxiliary information, and using the chaotic system to generate pseudo-random sequences for multiple encryption, high-precision ciphertext thumbnails are generated to ensure consistency between ciphertext and plaintext thumbnails, and combining the compression and coding rules of JPEG images to reduce the ciphertext expansion rate.

Benefits of technology

It realizes a high degree of consistency between ciphertext images and plaintext thumbnails, improves the security and availability of ciphertext images, reduces ciphertext storage overhead, and can effectively resist a variety of attack methods, which is suitable for the security and usability balance of different user needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115630390B_ABST
    Figure CN115630390B_ABST
Patent Text Reader

Abstract

The present invention provides a high-precision thumbnail encryption method for JPEG images. The method includes: parsing a bit stream of a plaintext JPEG image P to obtain three quantized Y, U, and V plane coefficient matrices; and obtaining original luminance and chrominance quantization tables; encrypting original QDCs of the plaintext JPEG image P; modifying the original luminance and chrominance quantization tables to suppress spatial pixel overflow; using the original luminance and chrominance quantization tables and deviation information generated during the encryption process of the original QDCs as decryption auxiliary information, and embedding the decryption auxiliary information into QACs to obtain new QACs, denoted as QACs3; generating four different keys using a user-defined preset key and QACs3, then generating initial parameters of a chaotic system using the four different keys, and then respectively generating four pseudo-random sequences using the chaotic system; and encrypting the QACs using the four pseudo-random sequences to obtain a final encrypted image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image encryption and information security, and in particular to a high-precision thumbnail-preserving encryption method for JPEG images. Background Art

[0002] Thanks to the rapid development of semiconductor technology, the cost of image acquisition equipment has continued to decline. People capture a large number of high-resolution images every day to record their daily lives. To efficiently store and facilitate device sharing, tens of thousands of digital images are uploaded to cloud service platforms. While cloud storage technology brings convenience to users, it also carries the risk of privacy leakage. In real life, private images often contain a wealth of personal and sensitive information. If plaintext images are directly uploaded to the cloud, cloud platform providers can easily obtain the user's image information. If the account is hacked, all the user's information will be completely leaked. Therefore, to protect user privacy, image encryption methods are often used to process user images.

[0003] Image encryption is the most effective solution for protecting image privacy. Numerous image encryption schemes with good security have been proposed within the scrambling-diffusion framework. However, traditional image encryption algorithms fail to consider the availability of ciphertext images, resulting in unusable, noise-like ciphertext images, making ciphertext image management difficult. Searchable encryption enables retrieval of ciphertext images, alleviating the conflict between image privacy and availability to some extent. However, the visual appearance of these ciphertext images remains the same as with traditional ciphertext images, lacking any visual information related to the plaintext. Therefore, users cannot preview these ciphertext images before decryption, which also complicates image management and search. In many cases, users only know which images they need after browsing them, so a certain level of visual availability is required for ciphertext images to facilitate user perception of image content. To ensure visual availability of ciphertext images, some studies have proposed methods that only encrypt private regions of images. This method provides visual information to users by leaking the image's background. However, privacy is a subjective concept that can have completely different definitions in different scenarios. Therefore, existing algorithms, which typically equate regions of interest with private regions of images, are inappropriate.

[0004] To balance the privacy and availability of cloud-based images, Wright et al. (Reference 1: CV Wright, W. Feng, and F. Liu, “Thumbnail-Preserving Encryption for JPEG,” in Proceedings of the 3rd ACM Workshop on Information Hiding and Multimedia Security, Portland, Oregon USA, June 2015, pp. 141–146. doi:10.1145 / 2756601.2756618.) first proposed thumbnail-preserving encryption (TPE), where the ciphertext image and the plaintext image have the same thumbnail. This encryption scheme allows users to adjust the security and availability of the ciphertext image by controlling the block parameters. Larger blocks increase the security of the ciphertext but decrease its availability. Availability is the low-quality plaintext information provided by the ciphertext thumbnail. Wright et al.'s scheme only uses scrambling operations to encrypt pixel blocks. The resulting ciphertext image leaks pixel statistics, resulting in insufficient security. Subsequently, Marohn et al. (Reference 2: B. Marohn, CV Wright, W. Feng, M. Rosulek, and RB Bobba, “Approximate Th-umbnail Preserving Encryption,” in Proceedings of the 2017 on Multimedia Privacy and Security, Dallas Texas USA, Oct. 2017, pp. 33–43. doi: 10.1145 / 3137616.3137621.) proposed two approximate TPE schemes, DRPE and LSB-TPE. However, both schemes have their own defects. On the one hand, the insufficient approximation leads to poor perceived quality of the ciphertext thumbnail. On the other hand, the DRPE algorithm may fail in decryption, and the decrypted image of LSB-TPE is noisy.

[0005] JPEG is a high-compression lossy compression format. It not only reduces image storage size, saving storage space and transmission bandwidth, but also maintains minimal visual quality, making it widely used. However, currently, only two TPE schemes for JPEG images exist (References 1 and 2). These schemes suffer from shortcomings in ciphertext security, thumbnail approximation, decrypted image quality, and ciphertext expansion ratio. Therefore, a TPE scheme with better performance is urgently needed. Summary of the Invention

[0006] The current TPE scheme for JPEG images has defects in ciphertext security, thumbnail approximation effect, decrypted image quality and ciphertext expansion rate. In order to solve some of these defects, the present invention provides a high-precision thumbnail-preserving encryption method for JPEG images.

[0007] The present invention provides a JPEG image high-precision thumbnail encryption method, comprising:

[0008] Step 1: Parse the bitstream of the plaintext JPEG image P to obtain the quantized Y, U, and V plane coefficient matrices, denoted as QY, QU, and QV respectively; and obtain the original luminance and chrominance quantization tables; where the size of QY is set to M×N, and the sizes of QU and QV are both set to M / 2×N / 2;

[0009] Step 2: For each plane coefficient matrix, encrypt the original QDCs of the plaintext JPEG image P; QDCs refers to the quantized DC coefficients;

[0010] Step 3: Modify the original brightness and chromaticity quantization tables to suppress spatial pixel overflow;

[0011] Step 4: Use the original luminance and chrominance quantization tables and the deviation information generated during the encryption process of the original QDCs as decryption auxiliary information, and embed the decryption auxiliary information into the QACs to obtain new QACs, denoted as QACs3; where QACs refers to quantized AC coefficients;

[0012] Step 5: Generate four different keys using the user-defined preset key and QACs3. Then use the four different keys to generate the initial parameters of the chaotic system. Then use the chaotic system to generate four pseudo-random sequences, which are denoted as Seq1, Seq2, Seq3, and Seq4 respectively.

[0013] Step 6: Encrypt the QACs using four pseudo-random sequences to obtain the final encrypted image.

[0014] Furthermore, step 2 specifically includes:

[0015] Step 2.1: For each coefficient matrix, divide it into several K×K SPBs; SPB stands for sum-preserving blocks;

[0016] Step 2.2: For each SPB, extract the QDCs therein, and finally obtain a vector consisting of all QDCs Then the Split into two parts, respectively and And should meet Among them, Φ sum represents the pixel sum, n = MN / K 2 ;

[0017] Step 2.3: Replace the coefficients in The original value of the corresponding position in , thus completing the entire QDCs encryption process.

[0018] Further, in step 2.2, the Split into two parts, respectively and Specifically include:

[0019] Calculate the mean value of QDCs to get Indicates rounding down;

[0020] Calculate the deviation and

[0021] According to formulas (7) and (8), we can get and

[0022]

[0023]

[0024] Furthermore, step 3 specifically includes:

[0025] Step 3.1: Keep the values corresponding to the coordinate (0,0) in the original luminance and chrominance quantization tables unchanged, and modify the quantization step sizes of all other ACs coefficients to the minimum value of 1;

[0026] Step 3.2: Store the modified luminance and chrominance quantization tables into the JPEG header file.

[0027] Furthermore, in step 4, the deviation information is embedded into the QACs, specifically including:

[0028] Step 4.1: Use numerical decomposition to divide the deviation information into two parts to reduce the amplitude of the deviation information, which are respectively denoted as QDC vh and QDC vl ;

[0029] Step 4.2: Determine at least two position spaces where the frequency coefficient value is 0 from the high frequency part of the QACs;

[0030] Step 4.3: Place the QDC vh and QDC vl Correspondingly stored in the two location spaces.

[0031] Furthermore, in step 4, the original luminance and chromaticity quantization tables are embedded into QACs, specifically including:

[0032] Step 4.4: Use Zigzag scanning to scan the original luminance and chromaticity quantization tables to gather the frequency AC coefficients with strong correlation together to obtain a one-dimensional array QT z ;

[0033] Step 4.5: Encode the one-dimensional array QT using the encoding method consistent with the JPEG compression standard z Encoding;

[0034] Step 4.6: Embed the encoded data into QACs using the reversible information hiding method of histogram shift.

[0035] Furthermore, step 4.6 specifically includes:

[0036] Data embedding is performed according to formula (9) and formula (10):

[0037]

[0038]

[0039] Among them, QACs 2i (u,v)=C, i represents the i-th unit DCT block, which is the QACs embedded in QDC v After the data is obtained, QACs 3i (u,v)=C' represents the new QACs after embedding QTs, b represents the bit value of the coded data stream, b∈{0,1}.

[0040] Furthermore, step 5 specifically includes:

[0041] Step 5.1: Make Representative CP DH The number of NZQACs in is the number of MUBs i, and then the key K is generated according to formula (13) init :

[0042]

[0043] Where i = 0, 1, 2, ..., 63, CP DH represents the image after the plaintext JPEG image P is processed from step 2 to step 4, NZQACs represents the number of non-zero QACs, MUB represents the minimum sum-preserving block of 8×8 size, SHA(·) represents the SHA-256 function, and n c Represents the number of image channels, K preset Indicates a user-defined preset key with a length of 256 bits;

[0044] Step 5.2: Make Representative CP DH The number of NZQACs with frequency f i in all MUBs is then calculated using formula (14). The key K1 is used to generate the pseudo-random sequence used for scrambling NZQACs with the same frequency.

[0045]

[0046] Where i = 1, 2, ..., num, and the value of num is set by the user;

[0047] Step 5.3: Make Representative CP DH The number of RS pairs in the j-th MUB is then used to generate the key according to formula (15) Using a key To generate the pseudo-random sequence used by all RS pairs in the j-th MUB for scrambling;

[0048]

[0049] Where j is the position index of MUB, j = 1, 2, ..., MN / 64, yes The binary character representation of

[0050] Step 5.4: Make represents the number of NZQACs in the i-th MUB, and then generates the key K3 according to formula (16), and uses the key K3 to generate the pseudo-random sequence used for unit DCT block scrambling;

[0051]

[0052] where sort(·) is the sorting function, i = 1, 2, …, MN / 64, n MUB is the number of MUBs;

[0053] Step 5.5: Make Representative CP DH The number of NZQACs in the , and then generate the key K4 according to formula (17), and use the key K4 to generate the pseudo-random sequence used by NZQACs diffusion;

[0054]

[0055] Furthermore, step 5 specifically includes:

[0056] For any of the four different keys, express it as a 256-bit binary string: b1, b2, ..., b 256 ;

[0057] Then, the initial parameters x, y and r of the two-dimensional chaotic system are generated according to formula (18);

[0058]

[0059] Among them, r∈[0.2,0.5], mod represents the remainder.

[0060] Furthermore, step 6 specifically includes:

[0061] First, use Seq1 to perform same-frequency NZQACs scrambling, then use Seq2 to perform RS pair scrambling, then use Seq3 to perform unit DCT block scrambling, and finally use Seq4 to perform NZQACs coding intra-group diffusion to obtain the final encrypted image;

[0062] Among them, the same-frequency NZQACs scrambling refers to classifying QACs into 63 groups, then selecting T groups, and scrambling the QACs of the T groups using Seq1, 1≤T≤63; RS pair scrambling refers to scrambling the entire RS pair within the DCT unit block using Seq2, which does not include the QACs of the end field; the DCT block that needs to be scrambled does not include QDC; the NZQACs coding intra-group diffusion formula is shown in Formula (20) and Formula (21);

[0063]

[0064]

[0065] Among them, σ represents a very small positive number, is an upward rounding function, Y represents the length L generated by the chaotic system a ACA represents the additional bits of the AC coefficient.

[0066] Beneficial effects of the present invention:

[0067] (1) In order to solve the problems of ciphertext thumbnail and plaintext thumbnail in existing methods Figure 1In order to solve the problems of poor consistency and poor decrypted image quality, the present invention encrypts the original QDCs of the plaintext JPEG image P, and at the same time improves the ciphertext generation effect by combining the operation of modifying the original quantization table, thereby generating a high-precision ciphertext thumbnail; wherein, in the process of encrypting the original QDCs, the method of replacing the mean of the quantization DC coefficient in the TPE block is adopted to encrypt the DC coefficient, ensuring that the sum of the quantization DC coefficients in the TPE block remains unchanged, laying the foundation for the consistency of the ciphertext thumbnail and the plaintext thumbnail. In order to further effectively improve the consistency accuracy of the ciphertext thumbnail and the plaintext thumbnail, the operation of modifying the original quantization table is added to greatly reduce the ciphertext pixel overflow, so that the two thumbnails are almost identical in visual effect, achieving an effect that is indistinguishable to the human eye. The high consistency of the thumbnails enables the ciphertext image to have highly identical plaintext thumbnail information, which is an important prerequisite and guarantee for ensuring usability. In addition, the necessary auxiliary information used for correct decryption is embedded in the ciphertext image using the information embedding method, ensuring the perceptual quality of the decrypted image.

[0068] (2) The encryption method of the present invention has good adaptability to the compression coding of JPEG images, and can minimize the damage to the compression performance advantages of the JPEG format. Specifically, the encryption method of the present invention is designed according to the compression coding rules of JPEG images, while taking into account the distribution and structural characteristics of the AC coefficients of the image. Therefore, the AC coefficients of the ciphertext image maintain the original coding characteristics and can still be effectively compressed and encoded, so that the ciphertext image has a low ciphertext expansion rate, thereby effectively reducing the ciphertext storage overhead and solving the problem of high expansion rate of JPEG ciphertext images. In addition, the combination of multiple encryption methods such as same-frequency NZQACs scrambling, RS pair scrambling, unit DCT block scrambling and NZQACs coding group diffusion in the present invention, as well as the introduction of the adaptive pseudo-random sequence generation method, greatly enhances the security of the ciphertext, can resist multiple attack methods such as brute force attack, chosen plaintext attack and contour attack, and greatly guarantees the privacy of users.

[0069] (3) The method of the present invention takes into account both the security and availability of ciphertext images, and solves the drawback of poor practicality of traditional ciphertext images due to their lack of availability. Users can freely choose different block sizes for encryption according to their own usage needs, thereby adjusting the encryption level of the ciphertext image and balancing the security and availability of the ciphertext image. When the block size is consistent with the image size, the effect of the encryption scheme is equivalent to that of the traditional encrypted image. The introduction of ciphertext image availability can avoid the need to decrypt ciphertext images in batches before querying the target image, reducing time costs and bandwidth consumption, and making it easier for users to query and manage image data sets. Therefore, the scope of application and functionality of the scheme of the present invention have obvious advantages over traditional encryption schemes. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 It is the JPEG image compression encoding process;

[0071] Figure 2 A schematic flow chart of a method for encrypting JPEG images with high precision and thumbnail preservation provided by an embodiment of the present invention;

[0072] Figure 3 Quantized AC coefficient grouping provided by an embodiment of the present invention;

[0073] Figure 4 An example of RS scrambling provided in an embodiment of the present invention;

[0074] Figure 5 The encryption and decryption image effects provided by the embodiment of the present invention;

[0075] Figure 6 The plaintext and ciphertext thumbnail effects provided by the embodiment of the present invention: (a) is a plaintext image and its corresponding thumbnail; (b) is a K=16 ciphertext image and its corresponding thumbnail;

[0076] Figure 7 This is the contour attack effect of the ciphertext image under different block conditions provided by the embodiment of the present invention. DETAILED DESCRIPTION

[0077] 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.

[0078] Before introducing the encryption method of the present invention, in order to enable those skilled in the art to more clearly understand the technical solution of the present invention, the theoretical basis for implementing TPE for JPEG images is first explained. The specific content is as follows:

[0079] The key to the thumbnail-preserving encryption scheme is to keep the pixel sums within the image block constant, where the block is called a TPE block. That is, when the pixel sums within the TPE blocks corresponding to the ciphertext image and the plaintext image remain consistent, the pixel values generated by the TPE blocks after mapping will also be equal, so that the ciphertext and plaintext can generate the same thumbnail. Since the pixel sums within the TPE block are always constant, it is a sum-preserving block and is denoted as SPB (sum-preserving block, SPB). Specifically, the spatial plane C on the plaintext image channel is sequentially mapped to the image. iDivide the data into blocks of size B1×B2 (B1 and B2 are both integer multiples of 8), denoted as SPB i,j , where the 8×8 size block is the minimum unit block (MUB). If there is an encryption scheme that can make SPB i,j If the sum of all pixel values in remains unchanged, the scheme is said to satisfy thumbnail-preserving encryption. Based on the single-channel SPB, the TPE scheme is defined as follows.

[0080] Definition: Assume that there is an information space (d is usually 256), for a vector containing n elements There is Φ sum (v1,...v n )=∑ i v i , if exists in satisfy Then the scheme is a TPE scheme.

[0081] For JPEG images, the encoding process is as follows Figure 1 As shown in the figure, lossy compression occurs during the generation of JPEG files. Therefore, if the spatial pixels are directly encrypted within the block, they will be affected by downsampling during compression when they are stored as JPEG images again, resulting in information loss and high-frequency noise, which will affect the sum-preserving algorithm.

[0082] The concept of the present invention is to achieve high-precision approximate TPE by ensuring that the sum of the quantized DC coefficients within the block remains unchanged. JPEG images are not directly stored spatial pixels but rather stored data that has been transformed and quantized. The DCT transform formula is as follows:

[0083]

[0084] In the JPEG encoding process, the Y, U, and V plane pixels in the spatial domain need to perform a zero-level offset operation before the DCT transform to reduce the quantization DC coefficient and thus reduce the amount of encoded data. The general offset is 2 n-1 (n represents the bit depth of the grayscale image). The image is scanned by 8×8 raster to obtain the minimum unit block (MUB), which is then subjected to DCT transformation in sequence. The DC coefficient generated by the transformation reflects the average value of the MUB pixels (denoted as B mean ), their specific relationship follows:

[0085]

[0086]

[0087] where Q 0,0 (Constant) refers to the value corresponding to the coordinate (0,0) in the quantization table, representing the quantization step size of the DC value. Round is a function that rounds the value. It is worth noting that the quantization tables for different quality factors are different.

[0088] Assume there is a SPB of size B1×B2, which contains B1·B2 / 64 MUBs, corresponding to the mean vector SPB is transformed into F-SPB through DCT, where the number of MUBs remains unchanged, and the DC coefficients are extracted to form a vector So:

[0089]

[0090] Obviously, when If it remains unchanged, then The same remains unchanged. However, as an essential step in generating JPEG images, quantization will produce an unavoidable quantization error (ε). We can express it as:

[0091] DC=Q 0,0 ·(QDC+ε) (5)

[0092]

[0093] Different DC values correspond to different ε, and the sum of ε in F-SPB is denoted as V ε , it is obviously not a constant. Due to the uncertainty error V ε The existence of and The equilibrium relationship, that is, even if Always remain the same, There will also be some fluctuations. Therefore, the TPE for JPEG images is an approximate TPE. The present invention achieves high-precision TPE by designing a QDCs sum-preserving encryption algorithm, and the difference between the thumbnails of plaintext and ciphertext is visually imperceptible.

[0094] Example 1

[0095] Based on the above theory, Figure 2As shown, an embodiment of the present invention provides a high-precision thumbnail encryption method for JPEG images. The main encryption operations include the following five operations: encryption of quantized DC coefficients (QDCs), modification of original quantization tables (QTs), embedding of auxiliary information, adaptive generation of pseudo-random sequences, and encryption of quantized AC coefficients (QACs). Specifically, the following steps are included:

[0096] S101: Parse the bitstream of the plaintext JPEG image P to obtain the quantized Y, U, and V plane coefficient matrices, denoted as QY, QU, and QV respectively; and obtain the original luminance and chrominance quantization tables;

[0097] Specifically, before performing any encryption operations, the bitstream of the plaintext JPEG image P must be parsed to obtain the quantized Y, U, and V plane coefficient matrices, denoted as QY, QU, and QV, respectively, as well as the luminance and chrominance quantization tables QTs for subsequent encryption operations. The size of QY is set to M×N. Since the three planes are generally downsampled according to 4:2:0 during JPEG image generation, the sizes of QU and QV are M / 2×N / 2. For ease of explanation, the TPE encryption block SPB is set to a square of size K×K (16≤K≤min(M / 2,N / 2)), that is, the block size is K.

[0098] S102: For each plane coefficient matrix, encrypt the original QDCs of the plaintext JPEG image P; QDCs refers to quantized DC coefficients;

[0099] S103: modifying the original brightness and chromaticity quantization tables to suppress spatial pixel overflow;

[0100] S104: Using the original luminance and chrominance quantization tables and the deviation information generated during the encryption process of the original QDCs as decryption auxiliary information, the decryption auxiliary information is embedded into the QACs to obtain new QACs, denoted as QACs3; wherein QACs refers to quantized AC coefficients;

[0101] S105: Generate four different keys using the user-defined preset key and QACs3, then use the four different keys to generate initial parameters of the chaotic system, and then use the chaotic system to generate four pseudo-random sequences, which are respectively recorded as Seq1, Seq2, Seq3, and Seq4;

[0102] S106: Encrypt the QACs using four pseudo-random sequences to obtain a final encrypted image.

[0103] Specifically, the encryption operation itself will cause QDCs and QACs to change, so after the ciphertext image is decompressed, it may cause spatial pixel overflow problems. This not only affects the effect of thumbnail generation, but also affects the format compatibility of the image. When the DCs coefficient is fixed (the coefficient is determined after the QDCs encryption operation is completed), the larger the ACs coefficient, the greater the possibility of spatial pixel overflow obtained by inverse DCT change, and the greater the impact on the visual quality of the decrypted image. Therefore, the ACs coefficient needs to be effectively controlled. The ACs coefficient is obtained by inverse quantization of QACs, where the quantization step size is affected by QTs. Therefore, the spatial pixels obtained after decompressing the image are affected by QDCs, QACs, and QTs. Therefore, in order to overcome the problems caused by changes in QDCs and QACs, the present invention suppresses spatial pixel overflow by modifying the quantization table. This operation also improves the effect of ciphertext image generation, and can generate high-precision ciphertext thumbnails, ensuring a high degree of consistency between plaintext thumbnails and ciphertext thumbnails.

[0104] Furthermore, the embodiment of the present invention also utilizes an information embedding method to embed necessary auxiliary information used for correct decryption into the ciphertext image, thereby ensuring the perceptual quality of the decrypted image.

[0105] The encryption method proposed in the present invention effectively realizes high-precision TPE. The thumbnail corresponding to the ciphertext image not only retains the plaintext thumbnail information to the greatest extent, but also has high security of the ciphertext.

[0106] Example 2

[0107] QDCs contain a large amount of plaintext information. Therefore, to ensure the security of the plaintext, the original QDCs must be effectively protected. In addition, the proper encryption of QDCs has a significant impact on improving the quality of JPEG ciphertext thumbnails. Therefore, based on the above embodiment, in order to further ensure the high consistency between plaintext thumbnails and ciphertext thumbnails, the embodiment of the present invention provides a specific QDCs encryption method, which specifically includes the following steps:

[0108] S1021: For each coefficient matrix, divide it into a number of K×K SPBs; SPB stands for sum-preserving blocks;

[0109] S1022: For each SPB, extract the QDCs therein, and finally obtain a vector composed of all QDCs Then the Split into two parts, respectively and And should meet Among them, Φ sum represents the pixel sum, n = MN / K 2 ;

[0110] Specifically, in the embodiments of the present invention, it is intended to use the elements in the vector as the encrypted QDCs values. Therefore, it is necessary to ensure that

[0111] As an implementable manner, the is split into two parts, denoted as and Specifically, it includes:

[0112] Calculate the mean value of QDCs to obtain denotes rounding down;

[0113] Calculate the deviation sum of QDCs

[0114] Obtain and

[0115]

[0116]

[0117] Specifically, obviously 0 ≤ V ds < n. Therefore, when the deviation V ds is not equal to 0, it only needs to be evenly distributed to ds QDCs m , and it can be ensured that always remains unchanged.

[0118] S1023: Replace the coefficients in with the original values at the corresponding positions in . Thus, the entire QDCs encryption process is completed.

[0119] In the embodiments of the present invention, In fact, it is the deviation information generated during the encryption process of the original QDCs, which is important information for correctly restoring the original QDCs and will be embedded into QACs as decryption auxiliary information.

[0120] Example 3

[0121] As mentioned above, spatial pixel overflow can be suppressed by modifying the quantization table. This operation also improves the ciphertext image generation effect, thereby generating a high-precision ciphertext thumbnail and ensuring a high degree of consistency between the plaintext thumbnail and the ciphertext thumbnail. On this basis, in order to maximize the suppression of spatial pixel overflow and maximize the consistency between the plaintext thumbnail and the ciphertext thumbnail, the embodiment of the present invention provides the following quantization table modification method, which mainly includes: modifying all the quantization step sizes corresponding to the AC coefficients in the quantization table to a minimum value of 1 to reduce the AC value obtained after inverse quantization, specifically including the following steps:

[0122] S1031: Keep the values corresponding to the coordinate (0,0) in the original luminance and chrominance quantization tables unchanged, and modify the quantization step sizes of all other ACs coefficients to the minimum value of 1;

[0123] Specifically, JPEG images have two quantization tables, namely the brightness quantization table QT l and colorimetric quantization table QT c , for the two quantization tables, both are modified according to the rules of this step, that is, QT r1 =Q 0,0 , QT ri =1(i=2,...64).

[0124] S1032: Store the modified brightness and chromaticity quantization tables into the JPEG header file.

[0125] Specifically, when decompressing the ciphertext image, since the quantization step size of the AC coefficient is 1, ACs and QACs are always consistent, so ACs are limited to a smaller range, thus reducing the possibility of pixel overflow.

[0126] Example 4

[0127] Deviation information QDC generated during the encryption QDCs stage v As well as the original QTs, they are important auxiliary information for correctly decrypting the original image and therefore must be effectively recorded and protected.

[0128] In the embodiment of the present invention, QACs are selected as the carrier for recording information, and the carrier after embedding the information is recorded as QACs3. After all the data is embedded, the QACs are encrypted to protect the embedded information and image texture details. v , so the amount of data to be stored is large, so QDC is selected v They are directly regarded as QACs and saved, while the original QTs with smaller data volume are first encoded and then saved using a reversible information hiding technique based on histogram shift.

[0129] As an implementation method, the deviation information is embedded into QACs, specifically including:

[0130] S1041: Using a numerical decomposition method to divide the deviation information into two parts to reduce the amplitude value of the deviation information, respectively denoted as QDC vh and QDC vl ;

[0131] Specifically, generally speaking, QACs are quantized values with relatively small amplitudes, and most of them are composed of 0 and 1, while QDC v The amplitude of is often larger than that of QAC, so it is not suitable to save it directly as QAC. Therefore, this scheme uses the numerical decomposition method to reduce the QDC v Amplitude value. First, QDC v Convert to binary, i.e. QDC v =b l b l-1 …b2b1 (l is the binary bit length of the amplitude), and then decompose it according to the lower four binary bits to get QDC vh =b l ...b5, QDC vl =b4…b1(|QDC vl |<16) two parts, and then convert them into decimal. It should be noted that the embodiment of the present invention can also control the length of the two parts as needed, and does not necessarily have to be decomposed according to the lower four binary bits.

[0132] S1042: Determine at least two position spaces where the frequency coefficient value is 0 from the high frequency part of the QACs;

[0133] Specifically, the AC coefficients represent the texture information of the image. The higher the frequency of the coefficients, the harder it is for the human eye to detect. Therefore, the corresponding quantization step size is larger during the quantization stage. Therefore, there are often a large number of continuous 0s in the high-frequency part of QACs (the lower the quality factor of the JPEG image, the greater the corresponding quantization degree, and the more 0s there are). The loss of some high-frequency information has little effect on the visual quality of the image. Based on these characteristics, sufficient information space can be provided for the embedding of auxiliary information. First, the QACs are converted from a two-dimensional coefficient matrix to a one-dimensional sequence according to the Zigzag scan, and then the high-frequency data QACs in the last two digits are removed. f62 , QAC f63 (usually 0), and then shift the frequency coefficients of f1 to f61 to f3 to f63 to generate a one-dimensional sequence QAC r1 =(0,0,QAC f1 ,...,QAC f61 ), so that the freed-up f1 and f2 locations can be used to store QDC vl, QDC vh .

[0134] S1043: QDC vh and QDC vl Correspondingly stored in the two location spaces.

[0135] Specifically, QDC vl , QDC vh The two components are stored in positions f1 and f2 respectively, and the new components are regarded as QACs. At this point, we can get the new sequence as QAC r2 =(QAC vl ,QAC vh ,QAC f1 ,...,QAC f61 ), and a new two-dimensional QDCT block can be obtained by inverse Zigzag scanning.

[0136] As an implementation method, the original luminance and chromaticity quantization tables are embedded into QACs, specifically including:

[0137] S1044: Zigzag scan the original brightness and chromaticity quantization tables to gather the frequency AC coefficients with strong correlation together to obtain a one-dimensional array QT z ;

[0138] Specifically, although the JPEG compression standard corresponds to different quantization tables for luminance and chrominance, they all have a common feature, that is, the quantization step sizes corresponding to adjacent frequency AC coefficients have a strong correlation. Therefore, using Zigzag scanning on the quantization table can bring these values together to obtain a one-dimensional array QT z .

[0139] S1045: Encoding the one-dimensional array QT using a coding method consistent with the JPEG compression standard z Encoding;

[0140] Specifically, due to QT z The adjacent values in the equation do not change much, so first we calculate QT z The coefficients in the quantization table are encoded using DPCM to reduce the amount of encoded data, while increasing the length of zero runs. Run-length encoding and Huffman encoding are then performed to generate the bitstream data, completing the encoding process of the original quantization table data. This operation effectively reduces the amount of hidden information data and avoids insufficient embedding capacity. All encoding methods used are consistent with those in the JPEG compression standard.

[0141] S1046: Embed the encoded data into QACs using a reversible information hiding method using histogram shifting.

[0142] Specifically, the encoded data stream is embedded using the histogram shifting for reversible data hiding (HS-RDH) technique. In this solution, this technique uses QACs with a modulus of 1 as the data carrier. Therefore, the information embedding capability of the image is closely related to the number of QACs with a modulus of 1 contained in the image. Data embedding is performed according to formulas (9) and (10):

[0143]

[0144]

[0145] Among them, QACs 2i (u,v)=C (i represents the i-th unit DCT block, i=1, ...) is the QACs embedded in the QDC v After the data is obtained, QACs 3i (u, v) = C' represents the new QACs after embedding the QTs coding information, and b represents the bit value b∈{0,1} of the coded data stream.

[0146] The advantage of adopting this data embedding method is that it can restore the carrier information and embedded data losslessly. The data extraction process can be expressed as formulas (11) and (12):

[0147]

[0148]

[0149] Example 5

[0150] Based on the above embodiments, to further enhance the security of ciphertext and enable it to resist multiple attack methods, the present invention provides a multiple encryption method. In this invention, multiple encryption methods combining same-frequency NZQACs scrambling, RS pair scrambling, unit DCT block scrambling, and NZQACs code intra-packet diffusion are combined to greatly ensure user privacy security. The multiple encryption method will be specifically introduced in the next embodiment and will not be repeated here. In order to generate the pseudo-random sequence required for the multiple encryption method, the embodiment of the present invention also provides a method for adaptively generating pseudo-random sequences, which is mainly explained in the embodiment of the present invention.

[0151] As an implementable method, the method for adaptively generating a pseudo-random sequence according to an embodiment of the present invention specifically includes the following steps:

[0152] S1051: Order Representative CP DHThe number of NZQACs in is the number of MUBs i, and then the key K is generated according to formula (13) init :

[0153]

[0154] Where i = 0, 1, 2, ..., 63, CP DH represents the image after the plaintext JPEG image P is processed from step 2 to step 4. It should be noted that no random sequence is required in steps 2 to 4; NZQACs represents the number of non-zero QACs, MUB represents the minimum sum-preserving block of 8×8 size, SHA(·) represents the SHA-256 function, and n c Represents the number of image channels (for example, for grayscale images, n c =1; for color images, n c =3; In this embodiment, taking color image as an example, n c =3), K preset Indicates a user-defined key with a length of 256 bits; K init The length is also 256.

[0155] Specifically, since the encryption process of QACs does not change CP DH The number of non-zero QACs (NZQACs) in the CP DH Generate encryption keys. For a MUB, there are at least 0 NZQACs and at most 63 NZQACs, so the value range of superscript i is 0≤i≤63.

[0156] S1052: Order Representative CP DH The number of NZQACs with frequency f i in all MUBs is then calculated using formula (14). The key K1 is used to generate the pseudo-random sequence used for scrambling NZQACs with the same frequency.

[0157]

[0158] Where i = 1, 2, ..., num, and the value of num is set by the user;

[0159] S1053: Order Representative CP DH The number of RS pairs in the j-th MUB is then used to generate the key according to formula (15) Using a key To generate the pseudo-random sequence used by all RS pairs in the j-th MUB for scrambling;

[0160]

[0161] Where j is the position index of MUB, j = 1, 2, ..., MN / 64, yes The binary character representation of It is understandable that, since there are at most 63 RS pairs in an 8×8 DCT block, they can be represented by a 6-bit binary number, that is, i takes values from 1 to 6. The RS pair refers to a run-length coded pair of quantized AC coefficients.

[0162] S1054: Order represents the number of NZQACs in the i-th MUB, and then generates the key K3 according to formula (16), and uses the key K3 to generate the pseudo-random sequence used for unit DCT block scrambling;

[0163]

[0164] where sort(·) is the sorting function, i = 1, 2, …, MN / 64, n MUB is the number of MUBs;

[0165] S1055: Order Representative CP DH The number of NZQACs in the , and then generate the key K4 according to formula (17), and use the key K4 to generate the pseudo-random sequence used by NZQACs diffusion;

[0166]

[0167] S1056: For any of the four different keys, express it as a 256-bit binary string: b1, b2, ..., b 256 ;

[0168] Then, the initial parameters x, y and r of the two-dimensional chaotic system are generated according to formula (18);

[0169]

[0170] Among them, r∈[0.2,0.5]; for example, the initial parameter values of the four pseudo-random sequences are recorded as and

[0171] S1057: Under respective initial parameters, four pseudo-random sequences are generated using the chaotic system, which are denoted as Seq1, Seq2, Seq3, and Seq4 respectively.

[0172] Specifically, the two-dimensional chaotic system (two-dimensional Cosine-Coupling-Logistic and Sine Map, 2D-CCLS) used in the embodiment of the present invention is defined as follows:

[0173]

[0174] Here, r is the control parameter, r∈[0,1], while x0 and y0 represent the initial state of the system. When r∈[0,1], the chaotic system exhibits not only chaotic but also hyperchaotic properties. Furthermore, considering the Kolmogorov entropy, this embodiment selects r∈[0.2,0.5] to ensure that the system-generated sequence has better randomness.

[0175] The adaptive pseudo-random sequence generation method provided by the present invention uses a user-defined preset key and QACs3 data, and then uses the SHA256 function and some mathematical processing to obtain the initial parameters of a chaotic system. The chaotic system is then iterated to generate a pseudo-random sequence for encryption. Since QACs3 is closely related to the plaintext content, the initial parameters and random sequences generated for different images will vary. Therefore, the encryption scheme provided by the present invention can achieve a one-time pad.

[0176] Furthermore, in order for the encryption algorithm to have sufficient resistance to brute force attacks, the key length should be at least greater than 100 bits. In addition, in order to resist chosen plaintext attacks, the encryption key must be related to the plaintext image content. This ensures that different images use different encryption keys, thereby improving the security of the ciphertext. Based on the above two considerations, the embodiment of the present invention uses the SHA-256 function to generate a unique initial key K for different target images. init , meaning the initial key length is set to 256 bits. Clearly, the encryption key used for an image is closely related to its content. If the image changes, a different key will be generated, and the initial state value will also change. Using different initial state values as input into a two-dimensional chaotic system can generate different data with good random properties, thus ensuring the security of the ciphertext image.

[0177] Example 6

[0178] The AC coefficients represent texture details in the image and can reveal contour information, which cannot be protected by encrypted DC coefficients. Furthermore, after the auxiliary information embedding process, QACs contain a large amount of auxiliary decryption information, making encryption of QACs crucial. A key characteristic of JPEG images is achieving high visual quality with minimal storage. This high compression ratio relies heavily on the distribution and structural characteristics of QACs. Therefore, encryption of QACs must preserve these characteristics to ensure that the ciphertext image still maintains a high compression ratio.

[0179] Based on the above embodiments, the present invention further provides a QACs encryption method, which mainly includes three rounds of scrambling and one round of diffusion operations, namely, scrambling of nonzero QACs (NZQACs) of the same frequency, scrambling of QACs run-length coding (RS) pairs, scrambling of unit DCT blocks, and diffusion within NZQACs packets. Specifically, the method includes the following steps:

[0180] S1061: Merge chroma coefficients. During the JPEG compression process, RGB images are converted to YUV images. Y represents brightness information, which is sensitive to the human eye. U and V represent chroma information, which is relatively less sensitive to the human eye, and therefore the degree of compression is greater. In fact, JPEG uses a brightness quantization table and a chroma quantization table respectively, which is determined by the characteristics of the data. From this, we can see that YUV image information can still be divided into two types of data after quantization. Therefore, this solution chooses to merge QU and QV data with the same characteristics to expand the data volume, denoted as QC. This not only achieves better encryption results but also has good compatibility with the compression standard.

[0181] S1062: Use Seq1 to perform same-frequency NZQACs scrambling.

[0182] Specifically, QACs can be classified into 63 groups according to the frequency of AC coefficients. Since the higher the frequency, the less sensitive the human eye's visual perception is, so high-frequency coefficients often correspond to larger quantization steps, that is, the quantization degree of AC coefficients is positively correlated with the frequency. As the frequency increases, there are fewer NZQACs in the corresponding group, so there is no need to scramble all groups. Selecting an appropriate number of scrambling groups T (1≤T≤63) can balance time efficiency and ciphertext security. This scheme selects 25 groups for QY scrambling and 10 groups for QC scrambling (group T can be changed according to different purposes, and the larger T is, the more secure the ciphertext is). Statistical analysis shows that this has basically included most NZQACs. In addition, in order to prevent scrambling from destroying consecutive 0 coefficients in the unit block, resulting in reduced run-length coding efficiency and affecting compression performance, only NZQACs in the target group are scrambled. The target group for scrambling is generated as follows: Figure 3 shown.

[0183] S1063: Use Seq2 to perform RS scrambling.

[0184] Specifically, to further improve the scrambling effect, the positions of QACs (including coefficient 0) at different frequencies also need to be changed. However, the efficiency of JPEG encoding is highly dependent on the structure of the RS pairs. Therefore, to maintain a stable file size, we choose to scramble the entire RS pair within the DCT unit block, excluding the QACs at the end of block (EOB). Figure 4 This is an example of RS scrambling within a block. Obviously, the combination of the two scrambling methods mentioned above can not only scramble all QACs except the EOB part, but also keep the structure of the run-length coding intact.

[0185] S1064: Use Seq3 to perform unit DCT block scrambling.

[0186] Specifically, the purpose of this operation is to resist contour attacks. By scrambling between DCT blocks, the number, energy distribution and positional relationship of AC coefficients in the entire image can be changed, thereby effectively resisting various contour attacks on AC coefficients, such as nonzero coefficients count attack (NCCA), energy of AC coefficients attack (EACA), and position of last nonzero coefficients attack (PLZA). Since JPEG encoding is based on unit DCT blocks, the scrambling operation on the DCT block will not affect the efficiency of run-length encoding. It is worth noting that the DCT block here cannot contain QDC, otherwise the sum of the QDCs in the SPB will change and will not meet the TPE conditions.

[0187] S1065: Use Seq4 to perform NZQACs encoding intra-group diffusion.

[0188] Specifically, scrambling encryption does not essentially change the statistical characteristics of the data, resulting in the inability to resist statistical attacks. Therefore, in order to further increase security, NZQACs need to be diffused. Combined with the characteristics of Huffman coding adopted by JPEG, a diffusion within the coding group is proposed that can balance security and coding efficiency. The entropy coding result of QACs consists of two parts, namely the Huffman coding of AC coefficients (AC Huffman, ACH) and the additional bits (AC Appended Bits, ACA). Among them, ACH is the result of Huffman coding of the run (run / size) of QACs, run is the length of the 0 run, size represents the amplitude of NZQAC, and coefficients of the same amplitude will be encoded as ACA with the same bit length. Diffusion within the coding group means that the amplitudes of the coefficients before and after diffusion are consistent, so their encoding is still in the same group, which does not affect the efficiency of Huffman coding. Given an NZQAC with an amplitude of a (a≥1), the corresponding ACA bit length is L a , which means that the amplitude a can be obtained by L a bits, and the corresponding relationship is as follows:

[0189]

[0190] Among them, σ represents a very small positive number, Is a rounded function. Using the chaotic system to generate a length of L a The pseudo-random bit stream Y is then diffused and encrypted using the following formula:

[0191]

[0192] Example 7

[0193] Corresponding to the above encryption method, an embodiment of the present invention further provides an image decryption method. Image decryption is the inverse process of image encryption. For a JPEG ciphertext image, the original image can be decrypted according to the following steps.

[0194] S201: Decrypting the QACs. Based on the ciphertext image content, different decryption keys can be generated using the method described in Example 5. These keys are then used to generate corresponding random sequences through a chaotic system to recover the pre-encrypted QACs. The random sequences are sequentially used to perform NZQAC de-diffusion, unit DCT block de-scrambling, RS pair de-scrambling, and same-frequency NZQAC de-scrambling to complete QAC decryption.

[0195] S202: Extract decryption auxiliary information. First, according to formula (11) and formula (12), the coded bit stream of the original quantization table can be extracted. Then, according to the coding rules of Huffman coding and DPCM, the original quantization table can be further restored. The QACs obtained at this time still contain the difference information of the original QDCs. Extract the QDCs at the f1 and f2 positions of the MUB respectively. f1 , QDC f2 , and then convert the bit stream into binary and splice it, and finally convert it back into decimal value to get the auxiliary information QDC of decrypted QDCs v .

[0196] S203: Restoring the original quantization table. The original quantization table replaces the modified quantization table in the JPEG header file and saves the data.

[0197] S204: Decrypt QDCs. Each unit DCT block corresponds to a QDC in turn. v , add the QDC in the MUB of the ciphertext image to the corresponding deviation information QDC v , we can get the original QDC. So far, the decrypted JPEG image is generated.

[0198] In order to verify the effectiveness of the encryption method provided by the present invention, the present invention also provides the following experimental data.

[0199] The experimental simulation platform is as follows: Processor: Intel(R) Core(TM) i7-4600M, 2.90GHz; Memory: 8.00GB; Operating System: Windows 10; Programming Tool: Matlab R2019a. The custom key K used in this experiment preset =F(100), where F(·) is a function that converts decimal to 256-bit binary. Lenna images in JPEG format with a size of 512×512 and the holidays dataset are selected as experimental test images.

[0200] (1) Encrypted and decrypted image effects under different TPE blocks

[0201] like Figure 5 The figure shows the ciphertext and decrypted images of the Lenna image with a quality factor of 75, using different TPE block sizes K×K. Clearly, as K increases, the ciphertext image contains less plaintext information, visual quality decreases, and security increases. When the block size matches the plaintext image size, that is, K = 512, the TPE image is equivalent to a traditional encrypted image. Therefore, users can adjust the security and usability of the ciphertext image by controlling the size of K. Furthermore, the decrypted image is visually consistent with the plaintext image.

[0202] (2) Encrypted and decrypted image effects under different TPE blocks

[0203] The purpose of TPE is to generate consistent thumbnails for plaintext images and ciphertext images, so that the target image can be quickly managed and queried through the ciphertext thumbnail. Figure 6 The results show the effect of generating a thumbnail corresponding to the plaintext and a thumbnail corresponding to the ciphertext when the TPE block size is K = 16. The difference between the two thumbnails is visually indistinguishable, thus achieving the experimental purpose.

[0204] (3) Decryption Image Perceptual Quality

[0205] To more accurately assess the difference between decrypted images and original plaintext images, the experiment used PSNR and SSIM metrics to evaluate the quality of decrypted images. The test images used were the holidays dataset, which contains 1,491 JPEG images from 500 image categories. The test results are shown in Table 1. Lossless decryption represents the percentage of images in the encrypted image dataset that were losslessly decrypted, while the perceptual quality evaluation metrics for decrypted images are calculated based on the remaining non-lossless decrypted images. It is worth noting that SSIM = 1 indicates that the decrypted image is identical to the original image. However, the data in the table is rounded to the nearest integer, so SSIM = 1.0000 is an approximation.

[0206] A vertical examination of Table 1 reveals that for JPEG images of different quality factors, the higher the quality factor, the lower the lossless decryption rate, and the quality of the decrypted image also decreases. This is because the higher the quality factor of the image, the fewer zeros there are in the corresponding QACs, which increases the probability of high-frequency coefficient loss when embedding auxiliary information. Furthermore, when observing Table 2 horizontally, the quality of the decrypted images corresponding to the ciphertext images under different block sizes is consistent. This is because no matter how large the TPE block size is, the auxiliary information embedding component only discards the coefficients at positions f62 and f63. As shown in Table 1, even for lossy decrypted images with different quality factors and different block sizes, their image quality remains very high, and the difference between the original image and the decrypted image is visually indistinguishable.

[0207] Table 1 Perceptual quality of decrypted images under different quality factors

[0208]

[0209] (4) Perceptual Quality of Ciphertext Thumbnails

[0210] Again, the experiment used the holidays dataset as test images. Table 2 shows the perceptual quality of the ciphertext thumbnails generated by the TPE algorithm for JPEG images at different quality factors, and the corresponding plaintext thumbnails. Clearly, for JPEG images of different quality factors, the ciphertext thumbnails generated from different block partitions are highly consistent with the plaintext thumbnails, making the difference visually indistinguishable.

[0211] Table 2 Perceptual quality of ciphertext thumbnails under different quality factors

[0212]

[0213] (5) Ciphertext Expansion Rate

[0214] JPEG images are widely used because they occupy a small amount of storage space while maintaining minimal visual quality. Therefore, the storage overhead of JPEG ciphertext images must be considered. This experiment uses the Holidays dataset to test the expansion ratio of ciphertext images with different quality factors. The smaller the expansion ratio, the better the encryption scheme preserves the JPEG compression properties. The test results are shown in Table 3. As the quality factor increases, the ciphertext expansion ratio decreases, and the effect of block size on the expansion ratio gradually decreases.

[0215] Table 3 Ciphertext expansion rate under different quality factors

[0216]

[0217] (6) Ciphertext Perception Quality

[0218] The smaller the PSNR between the plaintext and ciphertext images, the more the encryption scheme perturbs the plaintext information, and thus the less image information is leaked from the ciphertext. Table 4 shows the test results for the dataset. Experiments show that, vertically, for ciphertext images with the same TPE block, changes in image quality factor have little effect on the PSNR value. Horizontally, for images with the same quality factor, changing the block size significantly changes the PSNR value. Experimental results demonstrate that by varying the block size used for encryption, ciphertext images of varying visual quality can be obtained, meeting diverse usage requirements.

[0219] Table 4 Perceptual quality of ciphertext images under different quality factors

[0220]

[0221] (7) Contour attack

[0222] Contour attack is a common attack method based on the AC coefficient of JPEG images. This attack can reveal the contour information of the original image and thus obtain the image content. The experiment uses a lenna image with a quality factor of 75 to test the effectiveness of this encryption scheme against contour attacks. The contour attacks are NCCA, EACA, and PLZA respectively. The experimental results are shown in the figure. Figure 7 As shown in Figure 1. The rows represent the attack effects on different images using the same attack method, while the columns represent the attack effects on the same attack image using different attack methods. In this experiment, the attack images used were ciphertext images with four different block sizes. For ease of comparison, the first column shows the image contour information obtained from the plaintext images using different attack methods. The experimental results demonstrate that our encryption scheme is effective against contour attacks.

[0223] (8) Availability of Ciphertext Images

[0224] The usability of ciphertext images is reflected in the ciphertext thumbnail and plaintext thumbnail Figure 1 Therefore, it is possible to obtain part of the plaintext image content from the leaked thumbnail information. This experiment uses the holidays dataset with a quality factor of 75 and returns 10 images similar to the query image each time. First, the dataset images are encrypted according to different block sizes. Then, ciphertext thumbnails are generated one by one. Finally, a retrieval test is performed on the thumbnails and the Precision and mAP values of the returned results are calculated to verify the usability of the ciphertext images. The retrieval results are shown in Table 5. The experiment shows that as the block size increases, the Precision and mAP values both show a decreasing trend, indicating that the usability of the image is affected. It also shows that users can balance the security and usability of images by controlling the block size.

[0225] Table 5 Retrieval accuracy of ciphertext thumbnails under different block divisions

[0226]

[0227] 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 JPEG image high-precision thumbnail encryption method, characterized in that: include: Step 1: Parse the bitstream of the plaintext JPEG image P to obtain the quantized Y, U, and V plane coefficient matrices, denoted as QY, QU, and QV respectively; And get the original brightness and chromaticity quantization table; wherein, the size of QY is set to M×N, and the sizes of QU and QV are both M / 2×N / 2; Step 2: For each plane coefficient matrix, encrypt the original QDCs of the plaintext JPEG image P; QDCs refers to the quantized DC coefficients; Step 3: Modify the original brightness and chromaticity quantization tables to suppress spatial pixel overflow; Step 4: Use the original luminance and chrominance quantization tables and the deviation information generated during the encryption process of the original QDCs as decryption auxiliary information, and embed the decryption auxiliary information into the QACs to obtain new QACs, denoted as QACs3; where QACs refers to quantized AC coefficients; Step 5: Generate four different keys using the user-defined preset key and QACs3. Then use the four different keys to generate the initial parameters of the chaotic system. Then use the chaotic system to generate four pseudo-random sequences, which are denoted as Seq1, Seq2, Seq3, and Seq4 respectively. Step 6: Encrypt the QACs using four pseudo-random sequences to obtain the final encrypted image.

2. A JPEG image high-precision thumbnail encryption method according to claim 1, characterized in that: Step 2 specifically includes: Step 2.1: For each coefficient matrix, divide it into several K×K SPBs; SPB stands for sum-preserving blocks; Step 2.2: For each SPB, extract the QDCs therein, and finally obtain a vector consisting of all QDCs Then the Split into two parts, respectively and And should meet Among them, Φ sum represents the pixel sum, n = MN / K 2 ; Step 2.3: Replace the coefficients in The original value of the corresponding position in , thus completing the entire QDCs encryption process.

3. A JPEG image high-precision thumbnail encryption method according to claim 2, characterized in that: In step 2.2, the Split into two parts, respectively and Specifically include: Calculate the mean value of QDCs to get Indicates rounding down; Calculate the deviation and According to formulas (7) and (8), we can get and 4. The method for encrypting a JPEG image with high precision and thumbnail preservation according to claim 1, wherein: Step 3 specifically includes: Step 3.1: Keep the values corresponding to the coordinate (0,0) in the original luminance and chrominance quantization tables unchanged, and modify the quantization step sizes of all other ACs coefficients to the minimum value of 1; Step 3.2: Store the modified luminance and chrominance quantization tables into the JPEG header file.

5. The method for encrypting a JPEG image with high precision and thumbnail preservation according to claim 1, wherein: In step 4, the deviation information is embedded into the QACs, which includes: Step 4.1: Use numerical decomposition to divide the deviation information into two parts to reduce the amplitude of the deviation information, which are respectively denoted as QDC vh and QDC vl ; Step 4.2: Determine at least two position spaces where the frequency coefficient value is 0 from the high frequency part of the QACs; Step 4.3: Place the QDC vh and QDC vl Correspondingly stored in the two location spaces.

6. The method for encrypting a JPEG image with high precision and thumbnail preservation according to claim 1, wherein: In step 4, the original luminance and chromaticity quantization tables are embedded into QACs, which includes: Step 4.4: Use Zigzag scanning to scan the original luminance and chromaticity quantization tables to gather the frequency AC coefficients with strong correlation together to obtain a one-dimensional array QT z ; Step 4.5: Encode the one-dimensional array QT using the encoding method consistent with the JPEG compression standard z Encoding; Step 4.6: Embed the encoded data into QACs using the reversible information hiding method of histogram shift.

7. A JPEG image high-precision thumbnail encryption method according to claim 6, characterized in that: Step 4.6 specifically includes: Data embedding is performed according to formula (9) and formula (10): Among them, QACs 2i (u,v)=C, i represents the i-th unit DCT block, which is the QACs embedded in QDC v After the data is obtained, QACs 3i (u,v)=C' represents the new QACs after embedding QTs, b represents the bit value of the coded data stream, b∈{0,1}.

8. The method for encrypting a JPEG image with high precision and thumbnail preservation according to claim 1, wherein: Step 5 specifically includes: Step 5.1: Make Representative CP DH The number of NZQACs in is the number of MUBs i, and then the key K is generated according to formula (13) init : Where i = 0, 1, 2, ..., 63, CP DH represents the image after the plaintext JPEG image P is processed from step 2 to step 4, NZQACs represents the number of non-zero QACs, MUB represents the minimum sum-preserving block of 8×8 size, SHA(·) represents the SHA-256 function, and n c Represents the number of image channels, K preset Indicates a user-defined preset key with a length of 256 bits; Step 5.2: Make Representative CP DH The number of NZQACs with frequency f i in all MUBs is then calculated using formula (14). The key K1 is used to generate the pseudo-random sequence used for scrambling NZQACs with the same frequency. Where i = 1, 2, ..., num, and the value of num is set by the user; Step 5.3: Make Representative CP DH The number of RS pairs in the j-th MUB is then used to generate the key according to formula (15) Using a key To generate the pseudo-random sequence used by all RS pairs in the j-th MUB for scrambling; Where j is the position index of MUB, j = 1, 2, ..., MN / 64, yes The binary character representation of Step 5.4: Make represents the number of NZQACs in the i-th MUB, and then generates the key K3 according to formula (16), and uses the key K3 to generate the pseudo-random sequence used for unit DCT block scrambling; where sort(·) is the sorting function, i = 1, 2, …, MN / 64, n MUB is the number of MUBs; Step 5.5: Make Representative CP DH The number of NZQACs in the , and then generate the key K4 according to formula (17), and use the key K4 to generate the pseudo-random sequence used by NZQACs diffusion; 9. The method for encrypting a JPEG image with high precision and thumbnail preservation according to claim 1, wherein: Step 5 specifically also includes: For any of the four different keys, express it as a 256-bit binary string: b1, b2, ..., b 256 ; Then, the initial parameters x, y and r of the two-dimensional chaotic system are generated according to formula (18); Among them, r∈[0.2,0.5], mod represents the remainder.

10. The method for encrypting a JPEG image with high precision and thumbnail preservation according to claim 1, wherein: Step 6 specifically includes: First, use Seq1 to perform same-frequency NZQACs scrambling, then use Seq2 to perform RS pair scrambling, then use Seq3 to perform unit DCT block scrambling, and finally use Seq4 to perform NZQACs coding intra-group diffusion to obtain the final encrypted image; Among them, the same-frequency NZQACs scrambling refers to classifying QACs into 63 groups, then selecting T groups, and scrambling the QACs of the T groups using Seq1, 1≤T≤63; RS pair scrambling refers to scrambling the entire RS pair within the DCT unit block using Seq2, which does not include the QACs of the end field; the DCT block that needs to be scrambled does not include QDC; the NZQACs coding intra-group diffusion formula is shown in Formula (20) and Formula (21); ACA'=ACA⊕Y (21) Among them, σ represents a very small positive number, is an upward rounding function, Y represents the length L generated by the chaotic system a ACA represents the additional bits of the AC coefficient.