Encrypted image reversible information hiding method and system based on adaptive block coding
Through the adaptive block coding method, after the image is encrypted, the encoding method is selected according to the characteristics of each block, which solves the problem of insufficient embedding capacity in the existing technology to free up space after encryption, and achieves efficient information hiding and Image recovery.
Patent Information
- Application Number
- CN202410646731.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-08-30
AI Technical Summary
The existing reversible information hiding technology based on the space freed up after encryption has shortcomings in data embedding capacity, especially the problem of difficulty in balancing the reversibility and embedding capacity of the image.
The adaptive block coding method is used to perform block XOR encryption on the image, and Huffman coding is performed based on the prediction error of each block and the number of high-order continuous zero-valued bit planes, and the appropriate coding method is selected to maximize redundancy. Utilize space to form new ciphertext images.
On the basis of ensuring image reversibility, the data embedding capacity is significantly improved, the payload of the image is improved, and more efficient information hiding performance is achieved.
Smart Images

Figure CN118573786A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of multimedia content security of information security, and in particular relates to a method and system for reversible information hiding of encrypted images based on adaptive block coding. Background Art
[0002] With the rapid development of science and technology in recent years, the Internet has become increasingly important in people's lives. From online shopping in the initial stage, to various social platforms later, to today's AI question-answering programs such as ChatGPT, every product born from the Internet has greatly refreshed people's cognition and facilitated daily life. The open and transparent nature of the Internet makes people willing to share users' personal information with each other, but data may be intercepted, tampered with or stolen by hackers during network transmission, resulting in more and more privacy leakage problems. In order to protect the security of data during transmission, different technologies have been proposed.
[0003] Information hiding is a privacy protection technology that can embed secret information into multimedia files for transmission. Since it is difficult for third parties to detect changes in multimedia content, the embedded data can be effectively protected. Reversible information hiding technology can further restore the carrier of embedded information losslessly on the original basis, so it plays an important role in military medical image processing, copyright protection and other fields. With the development of cloud technology, when users transmit images and other content to the receiver in the cloud environment, they need to be processed by the cloud server. For the convenience of management, the cloud server may embed user information such as watermarks and timestamps into the received image. In order to prevent privacy leakage in this process, the sender needs to encrypt the image before sending it. Then, the cloud server can only perform reversible information hiding on the encrypted image. Finally, the receiver performs image recovery and information extraction processes according to the different permissions it has. The whole process is called reversible data hiding in encrypted images (RDHEI), and its method types can be specifically divided into reserving room before encryption (RRBE) and vacating room after encryption (VRAE). RDHEI not only solves the problem that original images are easily leaked in cloud environments, but also enables a relatively secure communication mechanism among senders, cloud servers, and receivers, which has important practical application value.
[0004] At present, some RRBE methods that can provide large-capacity embedding have appeared in the field, among which the RRBE method based on entropy coding and the RRBE method based on high-order zero-value bit planes are particularly notable (such as Chinese Patent Publication No. CN116582344A discloses a reversible information hiding method for encrypted images with bit plane compression and block rearrangement). Since VRAE performs space-free operations on encrypted images, the correlation between pixels is weakened, so it is more difficult to obtain a sufficiently high embedding capacity than RRBE. In order to solve this problem and ensure that the embedded image can be restored losslessly. Based on this, the present invention proposes a VRAE method and system based on adaptive block coding, which combines the advantages of entropy coding or high-order zero-value bit plane coding compression proposed in RRBE. The encrypted blocks in the image can adaptively choose which coding to apply to obtain the maximum compression, effectively avoiding the disadvantages of the two types of coding in specific blocks, and greatly improving the data embedding capacity of the RDHEI method based on the VRAE architecture. Summary of the invention
[0005] In view of the above-mentioned status of the prior art, the present invention proposes a reversible information hiding method and system for encrypted images based on adaptive block coding. Using the technical solution of the present invention, for the image owner, he first uses the encryption key to block XOR encrypt the image, and then sends the encrypted image to the cloud server. For the cloud server as the information hider, first, the received encrypted image is divided into blocks, and the prediction error and the number of high-order continuous zero-value bit planes of each block are calculated; secondly, the prediction error and the number of high-order continuous zero-value bit planes of all blocks are counted and Huffman coding is performed respectively; then, each block of the image is traversed, and the size of the embeddable space vacated is used to determine whether the block is subjected to prediction error coding compression or high-order zero-value bit plane compression; finally, all auxiliary information and data encrypted with the hidden key are embedded into the redundant space of each block to form a new ciphertext image, and sent to the receiver. For the receiver, if it has a hidden key, it can extract and decrypt the data to obtain the embedded information; if it has an encryption key, it can restore the original image losslessly through auxiliary information and XOR decryption; if it has both a hidden key and an encryption key, the embedded data can not only be correctly extracted, but the original image can also be restored losslessly. The technical solution proposed by the present invention belongs to the VRAE architecture, that is, the information hider performs a space-free operation on the encrypted image. Compared with the prior art, each encrypted block of the encrypted image in the technical solution of the present invention is adaptively entropy encoded or high-bit zero-valued bit plane encoded. The present invention gives full play to the advantages of the two types of compression encoding, avoids the disadvantages, and can improve the data embedding capacity under the premise of ensuring the reversibility of the image, and has very superior performance.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] A reversible information hiding method for encrypted images based on adaptive block coding comprises the following steps:
[0008] S1, use the encryption key to perform block-by-block XOR encryption and block rearrangement on the image, and then send the encrypted image to the cloud server;
[0009] S2, dividing the encrypted image into blocks, and calculating the prediction error set and the number of high-order continuous zero-valued bit planes of each block;
[0010] S3, counting the prediction errors and the number of high-order continuous zero-value bit planes of all blocks and performing Huffman coding respectively;
[0011] S4, traversing each block of the image, and determining whether the block is to be subjected to prediction error coding compression or high-order zero-value bit plane compression according to the size of the vacated embeddable space;
[0012] S5, embedding all auxiliary information, part of the image information and the secret data encrypted with the hidden key into a specific position of each block to form a new ciphertext image;
[0013] S6. Perform data extraction and image recovery operations on the received image according to the hidden key and the encryption key.
[0014] Further, step S1 is specifically as follows:
[0015] S1-1. Assume that the size of the transmitted image x is m×n, and the pixel value is x(i,j), where 1≤i≤m, 1≤j≤n. Divide the image into There are blocks b(k) of size t×t,
[0016]
[0017] S1-2, traverse each block in the same order, for the first row and first column of the block, the value remains unchanged; for the other pixels in the first row or first column of the block, the predicted value p(i, j) is the pixel value of the previous row or previous column; for the remaining pixels, the predicted value p(i, j) is obtained according to the median edge prediction; finally, collect the remaining t×t-1 prediction errors of each block except the first pixel in the order from top to bottom and from left to right, and the prediction error sequence of each block is expressed as e(k),
[0018]
[0019] S1-3, traverse each block again, for a single block b(k), use the encryption key K e Generate a random integer r k , Then, block b(k) is XOR-encrypted according to the following formula to obtain b e (k):
[0020] b e (k) = [b(k) + r k ]% 256 (% is the modulo symbol, indicating that the result of the previous formula is modulo 256)
[0021] Replace block b(k) with b e (k), calculate b e If the prediction error of block b(k) is different from the prediction error of the original block b(k), a random integer is generated again using the encryption key to calculate the prediction error of block b. e (k) performing XOR encryption until the generated encrypted block has the same prediction error value as the replaced block;
[0022] S1-4, each block in the image x is encrypted through one or more rounds of XOR encryption, and then encrypted according to the encryption key K e The order of all blocks in the image is scrambled, and finally the encrypted image x is generated. e And send it to the cloud server.
[0023] Further, step S2 is specifically as follows:
[0024] S2-1, receive image x e After that, the prediction error of each block is obtained according to S1-1 and S1-2;
[0025] S2-2, according to the formula:
[0026]
[0027] The absolute value of the prediction error of each block is converted from decimal to 8 bits of binary, and s(k) is used to represent the sign of the prediction error of the block;
[0028] S2-3. For a single block e l (k), start from the most significant bit (MSB) bit plane and count the t×t-1 bits of the bit plane. If all values in the current bit plane are 0, continue to compare the next layer of bit planes; if the values in the current bit plane are not all 0, stop comparing; use the symbol LR k To express e l (k) Center front LR k -The values in the MSB layer plane are all 0.
[0029] Further, step S3 is specifically as follows:
[0030] S3-1. Count e(k) and LR of all blocks k, where -255≤e(k)≤255, 0≤LR k ≤8;
[0031] S3-2, according to e(k) and LR k The frequency of occurrence of each value is Huffman coded separately, and the single prediction error value in e(k) is Among them for 2T+1 different codes are generated to represent for and Only one Huffman code is used to represent For 9 different LR k They are represented by 9 Huffman codes respectively; The Huffman coding rules are H1, LR k The Huffman coding rule is H2.
[0032] Further, step S4 is specifically as follows:
[0033] S4-1. Traverse each block b e (k), calculate the t×t-1 prediction errors in e(k) The sum of the Huffman code lengths h1 is used to calculate LR k The corresponding Huffman code length h2;
[0034] S4-2. Get the LR of the block k , then traverse the e of the block l The remaining (8-LR k ) bit planes; if the number of bit values 0 or 1 in the current bit plane is much smaller than the other one (that is, the number of 0 is less than the number of 1 or the number of 1 is less than the number of 0), use F k To record the information with fewer bits (less than the set threshold) in the current bit plane to free up embedding space; at the same time, E k To record the block's e l The remaining (8-LR k ) bit planes can be used to embed data; if the current bit plane can embed data, then E k The corresponding value in is 1, otherwise it is 0. The E corresponding to each block k The length is (8-LR k ) bits;
[0035] S4-3, calculate the embeddable space size c1=8(t 2 -1)-h1-8n1, where n1 is the prediction error in the block and Then calculate the embeddable space size c2 = [LR k +len(E k =1)-1](t 2 -1)-len(F k +E k ), where len represents the bit length;
[0036] S4-4. Compare the sizes of c1 and c2. If c1≥c2, the block uses prediction error coding. If c1<c2, the block uses high-order zero-value bit plane coding. Use C(k) to record the selection of each block. The prediction error coding is represented by 1, otherwise it is 0.
[0037] Further, step S5 is specifically as follows:
[0038] S5-1, collect all auxiliary information Inf1 used for image restoration, which mainly includes C(k), Huffman coding rules H1 and H2 in order, and and LR k , E in some blocks k and F k ;
[0039] S5-2, collect part (the ratio can be set) of the bit information Inf2 of the non-embeddable bit plane in the block encoded with the high-order zero-value bit plane, and each non-embeddable bit plane needs to be recorded with the remaining t×t-1 bits except the first bit;
[0040] S5-3, merge Inf1 and Inf2, traverse each block, and embed the merged information into the remaining pixels of each block except the first pixel in order from top to bottom and from left to right;
[0041] S5-4. When all the merged information is embedded, the remaining blocks will be embedded with the secret information in the same way. The secret information needs to be hidden with the hidden key K before embedding. d After the embedding is completed, the image formed is x m , and is sent by the information hider to the receiver.
[0042] Further, step S6 is specifically as follows:
[0043] S6-1. Receive the encrypted image x containing auxiliary information and secret data m After that, it can perform data extraction or image recovery operations through different secret keys it possesses;
[0044] S6-2. If there is only hidden key K d Without the encryption key K e, then the secret information hidden in the image can be extracted;
[0045] S6-3. If the receiver only has the encryption key K e Without the hidden key K d , then the original image x can be restored losslessly;
[0046] S6-4. If the receiver has a hidden key K d There is also an encryption key K e , then not only can the correct secret information be extracted, but also the original image x can be restored losslessly.
[0047] In step S6-3, the process of restoring the original image is as follows:
[0048] S6-3-1, obtain all auxiliary information through the extraction operation (same as in step S6-2), where C(k) is used to confirm the coding type of each block;
[0049] S6-3-2, use Huffman coding rules H1 and H2 to encode and LR k Perform recovery;
[0050] S6-3-3, traverse each block, for the prediction error coded block, use the first pixel in the block and the prediction error Restore the remaining pixels; for blocks with high-order zero-value bit plane coding, use LR k Determine the front LR of the prediction error block e(k) k The continuous high-bit planes are all 0, and E k Determine the remaining 8-LR k Whether the current bit plane can embed information, if the current bit plane cannot embed information, replace it with the information in Inf2; if the current bit plane can embed information, use F k Confirm the value, number and position of the fewer bits (less than the set threshold) in the bit plane, so as to restore the bit plane; the restored e(k) can restore the remaining pixel values in the block;
[0051] S6-3-4. When all blocks are traversed, the generated image is the original encrypted image x e , and then according to the encryption key K e The encrypted image x e The order of each block in is restored, and the pixels in the block are decrypted using XOR decryption (XOR decryption is similar to step S1). Only when the prediction error in the decrypted block is the same as that in the original block, the decryption is completed and the original image x is obtained.
[0052] The present invention also discloses a reversible information hiding system for encrypted images based on adaptive block coding, based on the above method, comprising the following modules:
[0053] Encryption module: Use the encryption key to perform block-by-block XOR encryption and block rearrangement on the image, and then send the encrypted image to the cloud server;
[0054] Block division and calculation module: divide the encrypted image into blocks and calculate the prediction error set and the number of high-order continuous zero-value bit planes of each block;
[0055] Statistics module: counts the prediction errors and the number of high-order continuous zero-value bit planes of all blocks and performs Huffman coding respectively;
[0056] Compression module: traverses each block of the image and performs prediction error coding compression or high-order zero-value bit plane compression according to the size of the embeddable space vacated;
[0057] Embedding module: embeds all auxiliary information, part of the image information and the secret data encrypted with the hidden key into a specific position of each block to form a new ciphertext image;
[0058] Extraction and recovery module: Perform data extraction and image recovery operations on the received image according to the hidden key and encryption key.
[0059] Compared with the prior art, the present invention has the following beneficial effects:
[0060] 1. The present invention designs an adaptive block coding method, which selects whether to perform prediction error coding or high-order zero-value bit plane coding on the current block by comparing the embeddable space size vacated by different coding of each block, thereby achieving higher embedding capacity.
[0061] 2. The present invention performs a redundant space freeing operation on the encrypted image (VRAE architecture), which not only increases the image payload but also ensures reversibility.
[0062] In summary, the present invention compresses each partition block as much as possible, increases the effective load size of the image on the basis of ensuring reversibility, and is more efficient in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 The present invention is a flowchart of a method for reversible information hiding in encrypted images based on adaptive block coding according to a preferred embodiment of the present invention.
[0064] Figure 2 These are the effects of Lena images at different stages.
[0065] Figure 3This is a comparison chart of the embedding capacity of the present invention and the existing algorithm on the test image.
[0066] Figure 4 The block diagram of a reversible information hiding system for encrypted images based on adaptive block coding is a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0067] In order to better understand the technical solution of the present invention, the specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings, so that those skilled in the art can understand the present invention. It should be clear that the described implementations and all other implementations obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention.
[0068] like Figure 1 As shown, the present embodiment provides a method for reversible information hiding of encrypted images based on adaptive block coding, which specifically includes the following steps:
[0069] S1. The image owner uses the encryption key to perform block-by-block XOR encryption and block rearrangement on the image, and then sends the encrypted image to the cloud server;
[0070] S2, the information hider divides the received encrypted image into blocks, and calculates the prediction error set and the number of high-order continuous zero-value bit planes of each block;
[0071] S3, counting the prediction errors and the number of high-order continuous zero-value bit planes of all blocks and performing Huffman coding respectively;
[0072] S4, traversing each block of the image, and determining whether the block is to be subjected to prediction error coding compression or high-order zero-value bit plane compression according to the size of the vacated embeddable space;
[0073] S5, embed all auxiliary information, part of the image information and the secret data encrypted with the hidden key into a specific position of each block to form a new ciphertext image, and send it to the receiver;
[0074] S6. The receiver performs data extraction and image recovery operations on the received image according to the hidden key and the encryption key.
[0075] The following is a detailed description of each step of this embodiment.
[0076] In this embodiment, step S1 is specifically as follows:
[0077] S1-1. Assume that the size of the transmitted image x is m×n, and the pixel value is x(i,j), where 1≤i≤m, 1≤j≤n. Divide the image into a block b(k) of size t×t,
[0078]
[0079] S1-2, traverse each block in the same order, for the first row and first column of the block, the value remains unchanged; for the other pixels in the first row or first column of the block, the predicted value p(i, j) is the pixel value of the previous row or previous column; for the remaining pixels, the predicted value p(i, j) is obtained according to the median edge prediction; finally, collect the remaining t×t-1 prediction errors of each block except the first pixel from top to bottom and from left to right, and the prediction error sequence of each block is expressed as e(k),
[0080] S1-3, traverse each block again, for a single block b(k), use the encryption key K e Generate a random integer r k ,
[0081] Then, block b(k) is XOR-encrypted according to the following formula to obtain b e (k):
[0082] b e (k) = [b(k) + r k ]%256
[0083] Replace block b(k) with b e (k), calculate b according to S1-2 e If the prediction error of block b(k) is different from the prediction error of the original block b(k), a random integer is generated again using the encryption key to calculate the prediction error of block b. e (k) performing XOR encryption until the generated encrypted block has the same prediction error value as the replaced block;
[0084] S1-4, each block in the image x is encrypted through one or more rounds of XOR encryption, and then encrypted according to the encryption key K e The order of all blocks in the image is scrambled, and finally the encrypted image x is generated. e And sent to the server by the image owner.
[0085] Step S2 is specifically as follows:
[0086] S2-1. The information hider receives image x e Then, the prediction error of each block is obtained according to the steps S1-1 and S1-2;
[0087] S2-2, according to the formula:
[0088]
[0089] The absolute value of the prediction error of each block is converted from decimal to 8 bits of binary, and s(k) is used to represent the sign of the prediction error of the block, and the length of s(k) is t×t-1;
[0090] S2-3. For a single block e l (k), start from the most significant bit (MSB) bit plane and count the t×t-1 bits of the bit plane. If all values in the current bit plane are 0, continue to compare the next layer of bit planes; if the values in the current bit plane are not all 0, stop comparing; use the symbol LR k To express e l (k) Center front LR k -The values in the MSB layer plane are all 0, LR k There are 9 values, ranging from 0 to 8;
[0091] Step S3 is as follows:
[0092] S3-1. Count e(k) and LR of all blocks k , where -255≤e(k)≤255, 0≤LR k ≤8;
[0093] S3-2, according to e(k) and LR k The frequency of each value is Huffman coded separately, assuming that the single prediction error value in e(k) is Among them for 2T+1 different codes are generated to represent for and Only one Huffman code is used to represent For 9 different LR k They are represented by 9 Huffman codes respectively; The Huffman coding rules are H1, LR k The Huffman coding rule is H2.
[0094] Step S4 is specifically as follows:
[0095] S4-1. Traverse each block b e (k), calculate the t×t-1 prediction errors in e(k) The sum of the Huffman code lengths h1 is used to calculate LR k The corresponding Huffman code length h2;
[0096] S4-2. Get the LR of the block k , then traverse the e of the block l The remaining (8-LR k) bit planes; if the number of bit values 0 or 1 in the current bit plane is much smaller than the other one (1 or 0), use F k To record the information of fewer bits in the current bit plane to free up embeddable space, F k It should include the value of the smaller bits in the bit plane, the number of the smaller bits and the position information of these smaller bits in the bit plane; it is also necessary to use E k To record the block's e l The remaining (8-LR k ) Which of the bit planes can be used to embed data? If the current bit plane can embed data, then E k The corresponding value in is 1, otherwise it is 0. The E corresponding to each block k The length is (8-LR k ) bits;
[0097] S4-3, calculate the embeddable space size c1=8(t 2 -1)-h1-8n1, where n1 is the prediction error in the block and Then calculate the embeddable space size c2 = [LR k +len(E k =1)-1](t 2 -1)-len(F k +E k ), where len represents the bit length;
[0098] S4-4. Compare the sizes of c1 and c2. If c1≥c2, the block uses prediction error coding. If c1<c2, the block uses high-order zero-value bit plane coding. Use C(k) to record the selection of each block. The prediction error coding is represented by 1, otherwise it is 0.
[0099] Step S5 is specifically as follows:
[0100] S5-1, collect all auxiliary information Inf1 used for image restoration, which mainly includes C(k), Huffman coding rules H1 and H2 in order, and and LR k , E in some blocks k and F k ;
[0101] S5-2, collecting bit information Inf2 of the non-embeddable bit planes in the block encoded with the high-order zero-value bit plane, and each non-embeddable bit plane needs to record the remaining t×t-1 bits except the first bit;
[0102] S5-3, merge Inf1 and Inf2, traverse each block, and embed the merged information into the remaining pixels of each block except the first pixel in order from top to bottom and from left to right;
[0103] S5-4. When all the merged information is embedded, the remaining blocks will be embedded with the secret information in the same way. The secret information needs to be hidden with the hidden key K before embedding. d After the embedding is completed, the image formed is x m , and is sent by the information hider to the receiver.
[0104] Step S6 is specifically as follows:
[0105] S6-1. The receiver receives the encrypted image x containing auxiliary information and secret data. m After that, it can perform data extraction or image recovery operations through different secret keys it possesses;
[0106] S6-2. If the receiver only has the hidden key K d Without the encryption key K e , traverse the image x m For each block in the block, extract the information of the remaining pixels except the first pixel in each block. The information consists of all auxiliary information Inf1, original block data Inf2 and encrypted secret information. Finally, the original secret information is obtained by hiding the secret key K d Decrypted and obtained;
[0107] S6-3. If the receiver only has the encryption key K e Without the hidden key K d , then the original image x can be restored losslessly;
[0108] S6-4. If the receiver has a hidden key K d There is also an encryption key K e , then not only can the correct secret information be extracted, but also the original image x can be restored losslessly.
[0109] The specific steps of restoring the original image in step S6-3 are as follows:
[0110] S6-3-1. Obtain all auxiliary information through the same extraction operation as in S6-2, where C(k) is used to confirm the coding type of each block;
[0111] S6-3-2, use Huffman coding rules H1 and H2 to encode and LR k Perform recovery;
[0112] S6-3-3, traverse each block, for the prediction error coded block, use the first pixel in the block and the prediction error Restore the remaining pixels; for blocks with high-order zero-value bit plane coding, use LR k Determine the front LR of the prediction error block e(k) k The continuous high-bit planes are all 0, E k Used to determine the remaining 8-LR k Whether the current bit plane can embed information, if the current bit plane cannot embed information, replace it with the information in Inf2; if the current bit plane can embed information, use F k Confirm the value, number and position of the fewer bits in the bit plane, so as to restore the bit plane; the restored e(k) can easily restore the remaining pixel values in the block;
[0113] S6-3-4. When all blocks are traversed, the generated image is the original encrypted image x e , and then according to the encryption key K e The encrypted image x e The order of each block in is restored, and the pixels in the block are decrypted using XOR decryption; XOR decryption is similar to step S1. Only when the prediction error in the decrypted block is the same as that in the original block, the decryption is finally completed, and the original image x is finally obtained.
[0114] like Figure 2 As shown in the figure, taking the Lena image as an example, Figure (a), Figure (b), Figure (c) and Figure (d) represent the original image x, the encrypted image x respectively. e , the encrypted image x after embedding the auxiliary information and secret information m and the final restored image.
[0115] Compared with the technical solution disclosed in Chinese patent document CN116582344A, the technical solution of the present invention has the following substantial differences:
[0116] (1) The technical solution disclosed in CN116582344A is to directly perform a free space operation on the original image and then encrypt the image, which belongs to the RRBE architecture; while the method of the present invention is to perform a free space operation on the encrypted image, which needs to overcome the difficulty of weakening the correlation between pixels, and belongs to the VRAE architecture;
[0117] (2) The technical solution disclosed in CN116582344A and the technical solution adopted by the present invention use different image encryption methods based on different architectures;
[0118] (3) Each block of the encrypted image in the present invention adaptively chooses to use entropy coding or high-order zero-value bit plane coding proposed in CN116582344A according to its own characteristics, which helps to give full play to the advantages of coding and compress each block in the image to the greatest extent, thereby freeing up more embeddable space.
[0119] In order to evaluate the embedding capacity of the proposed method, the data embedding rate of the proposed method was compared with other related methods based on the VRAE architecture (references [1-6]) on five typical test images. Figure 3 It can be seen that the method proposed in the present invention is superior to all the comparative methods, demonstrating the performance advantages of the method of the present invention.
[0120] For the specific methods of the above comparison, please refer to the following references:
[0121] [1]S.Yi,Y.Zhou,Separable and reversibledata hiding in encryptedimages using parametric binary tree labeling,IEEE Transactions on Multimedia21(2019)51–64.
[0122] [2]
[0123] [3]Y.Fu,P.Kong,H.Yao,Z.Tang,C.Qin,Effective reversibledata hiding inencrypted image with adaptive encoding strategy,Information Sciences 494(2019)21–36.
[0124] [4] C.Qin, X.Qian, W.Hong,
[0125] [5] Yu, Chunqiang, et al. "Reversibledata hiding with adaptive difference recovery for encrypted images." Information Sciences 584(2022):89-110.
[0126] The present invention proposes an adaptive block coding method, which selects whether to perform prediction error coding or high-order zero-value bit plane coding on the current block by comparing the embeddable space size vacated by different coding of each block, thereby achieving higher embedding capacity.
[0127] The method proposed by the present invention is to free up redundant space on the encrypted image, which not only increases the effective load of the image but also ensures reversibility.
[0128] In summary, the present invention compresses each divided block as much as possible based on the adaptive block coding method, increases the effective load size of the image on the basis of ensuring reversibility, and is more efficient in practical applications.
[0129] like Figure 4 As shown, this embodiment discloses a reversible information hiding system for encrypted images based on adaptive block coding, based on the above method embodiment, including the following modules:
[0130] Encryption module: Use the encryption key to perform block-by-block XOR encryption and block rearrangement on the image, and then send the encrypted image to the cloud server;
[0131] Block division and calculation module: divide the encrypted image into blocks and calculate the prediction error set and the number of high-order continuous zero-value bit planes of each block;
[0132] Statistics module: counts the prediction errors and the number of high-order continuous zero-value bit planes of all blocks and performs Huffman coding respectively;
[0133] Compression module: traverses each block of the image and performs prediction error coding compression or high-order zero-value bit plane compression according to the size of the embeddable space vacated;
[0134] Embedding module: embeds all auxiliary information, part of the image information and the secret data encrypted with the hidden key into a specific position of each block to form a new ciphertext image;
[0135] Extraction and recovery module: Perform data extraction and image recovery operations on the received image according to the hidden key and encryption key.
[0136] For other contents of this embodiment, please refer to the above method embodiment.
[0137] In summary, the present invention discloses a reversible information hiding method and system for encrypted images based on adaptive block coding, which includes the following steps: the image owner uses an encryption key to perform block XOR encryption and block rearrangement on the image, and then sends the encrypted image to a cloud server; the information hider divides the received encrypted image into blocks, and calculates the prediction error set and the number of high-order continuous zero-value bit planes of each block; the prediction errors and the number of high-order continuous zero-value bit planes of all blocks are counted and Huffman coding is performed respectively; each block of the image is traversed, and the block is determined to be subjected to prediction error coding compression or high-order zero-value bit plane compression according to the size of the embeddable space vacated; all auxiliary information, part of the image information and the secret data encrypted with the hidden key are embedded into a specific position of each block to form a new ciphertext image, and sent to the receiver; the receiver performs data extraction and image recovery operations on the received image according to the hidden key and the encryption key. The present invention compresses each block in the image to the maximum extent, thereby greatly increasing the data embedding capacity. Compared with the existing related technologies, the present invention is more superior in performance and more efficient in practical applications.
[0138] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.
Claims
1. A reversible information hiding method for encrypted images based on adaptive block coding. It is characterized in that The steps include: S1, use the encryption key to perform block-by-block XOR encryption and block rearrangement on the image, and then send the encrypted image to the cloud server; S2, dividing the encrypted image into blocks, and calculating the prediction error set and the number of high-order continuous zero-valued bit planes of each block; S3, counting the prediction errors and the number of high-order continuous zero-value bit planes of all blocks and performing Huffman coding respectively; S4, traversing each block of the image, and performing prediction error coding compression or high-order zero-value bit plane compression according to the size of the vacated embeddable space; S5, embedding all auxiliary information, part of the image information and the secret data encrypted with the hidden key into a specific position of each block to form a new ciphertext image; S6. Perform data extraction and image recovery operations on the received image according to the hidden key and the encryption key.
2. The method for reversible information hiding of encrypted images according to claim 1, It is characterized in that Step S1 is specifically as follows: S1-1, suppose the size of the transmitted image x is m×n, and the pixel value is x(i,j), where 1≤i≤m, 1≤j≤n; divide the image into There are blocks b(k) of size t×t, S1-2, traverse each block from top to bottom and from left to right. For the pixels in the first row and first column of the block, their values remain unchanged; for other pixels in the first row or first column of the block, their predicted values p(i, j) are the pixel values in the previous row or previous column; for the remaining pixels, their predicted values p(i, j) are obtained based on the median edge prediction; finally, collect the remaining t×t-1 prediction errors in each block except the first pixel in the order from top to bottom and from left to right. The prediction error sequence of each block is expressed as e(k). S1-3, traverse each block again, for a single block b(k), use the encryption key K e Generate a random integer r k , Then, block b(k) is XOR-encrypted according to the following formula to obtain block b: e (k): b e (k)=[b(k)+r k ]%256 Replace block b(k) with block b e (k), calculate b e If the prediction error of block b(k) is different from the prediction error of the original block b(k), a random integer is generated again using the encryption key to calculate the prediction error of block b. e (k) performing XOR encryption until the generated encrypted block has the same prediction error value as the replaced block; S1-4, each block in the image x is encrypted through one or more rounds of XOR encryption, and then encrypted according to the encryption key K e Scramble the order of all blocks in the image to generate the encrypted image x e And send it to the cloud server.
3. The method for reversible information hiding of encrypted images according to claim 2, It is characterized in that Step S2 is specifically as follows: S2-1, receive image x e After that, obtain the prediction error of each block; S2-2, according to the following formula: The absolute value of the prediction error of each block is converted from decimal to 8 bits of binary, and s(k) is used to represent the sign of the prediction error of the block, and the length of s(k) is t×t-1; S2-3. For a single block e l (k) First, count the t×t-1 bits of the most significant bit MSB bit plane. If all values in the current bit plane are 0, continue to compare the next layer of bit planes; if the values in the current bit plane are not all 0, stop comparing; use the symbol LR k Indicates e l (k) Center front LR k -The state where all values in the MSB layer plane are 0, LR k There are 9 possible values, ranging from 0 to 8.
4. The method for reversible information hiding of encrypted images according to claim 3, It is characterized in that Step S3 is as follows: S3-1. Count e(k) and LR of all blocks k , where -255≤e(k)≤255, 0≤LR k ≤8; S3-2, according to e(k) and LR k The frequency of each value is Huffman coded separately, and the single prediction error value in e(k) is Among them for 2T+1 different codes are generated to represent for and Only one Huffman code is used to represent For 9 different LR k They are represented by 9 Huffman codes respectively; among them, The Huffman coding rule is H 1 , L.R. k The Huffman coding rule is H 2 .
5. The method for reversible information hiding of encrypted images according to claim 4, It is characterized in that Step S4 is specifically as follows: S4-1. Traverse each block b e (k), calculate the t×t-1 prediction errors in e(k) The sum of the Huffman code lengths h 1 , calculate LR k The corresponding Huffman code length h 2 ; S4-2. Get the traversed block b e (k) LR k , traverse the e of the block l The remaining (8-LR k ) bit planes; if the number of bit values 0 in the current bit plane is less than the number of 1s or the number of 1s is less than the number of 0s, use F k To record the information of fewer bits in the current bit plane to free up embeddable space, F k The value of the smaller bits in the bit plane, the number of the smaller bits and the position information of the smaller bits in the bit plane are included; and at the same time, E k To record the e of this block l The remaining (8-LR k ) bit planes that can be used to embed data. If the current bit plane can embed data, then E k The corresponding value in is 1, otherwise it is 0. The E corresponding to each block k The length is (8-LR k ) bits; S4-3. Calculate the embeddable space size c freed up by directly using prediction error coding for a single block 1 =8(t 2 -1)-h 1 -8n 1 , where n 1 is the prediction error in this block and Then calculate the embeddable space size c that is freed up by directly using high-order zero-value bit plane coding for a single block 2 =[LR k +len(E k =1)-1](t 2 -1)-len(F k +E k ), where len represents the bit length; S4-4. Comparison c 1 With c 2 The size of c 1 ≥c 2 , this block uses prediction error coding, if c 1 <c 2 , the block uses high-order zero-value bit plane coding, uses C(k) to record the selection of each block, and uses prediction error coding to represent 1, otherwise it is 0.
6. The method for reversible information hiding of encrypted images according to claim 5, It is characterized in that Step S5 is specifically as follows: S5-1. Collect all auxiliary information Inf for image restoration 1 , in order including C(k), Huffman coding rule H 1 and H 2 , after Huffman coding and LR k , E in some blocks k and F k ; S5-2, collect part of the image information, including the bit information Inf that cannot be embedded in the bit plane in the block encoded with the high-bit zero value bit plane 2 , each bit plane that cannot be embedded is recorded with the remaining t×t-1 bits except the first bit; S5-3, Inf 1 and Inf 2 Merge, traverse each block, and embed the merged information into the remaining pixels of each block except the first pixel in order from top to bottom and from left to right; S5-4, when all the merged information is embedded, and the secret information is hidden with the secret key K d The remaining blocks are encrypted, and the image formed after embedding is x m .
7. The method for reversible information hiding of encrypted images according to claim 6, It is characterized in that Step S6 is specifically as follows: S6-1. Receive the encrypted image x containing auxiliary information and secret data m Afterwards, data extraction or image recovery operations are performed using different secret keys owned; S6-2. If there is only hidden key K d Without the encryption key K e , traverse the image x m For each block in the , extract the information of the remaining pixels in each block except the first pixel, the information contains all the auxiliary information Inf 1 , original block data Inf 2 and encrypt the secret information. Finally, the original secret information is obtained by hiding the secret key K d Decrypted and obtained; S6-3. If only the encryption key K e Without the hidden key K d , then the original image x can be restored losslessly; S6-4. If there is a hidden key K d There is also an encryption key K e , then not only can the correct secret information be extracted, but also the original image x can be restored losslessly.
8. The method for reversible information hiding of encrypted images according to claim 7, It is characterized in that In step S6-3, the process of restoring the original image is as follows: S6-3-1. Obtain all auxiliary information through extraction operation, where C(k) is used to confirm the coding type of each block; S6-3-2, using Huffman coding rule H 1 and H 2 The encoded and LR k Perform recovery; S6-3-3, traverse each block, for the prediction error coded block, use the first pixel in the block and the prediction error Restore the remaining pixels; for blocks with high-order zero-value bit plane coding, use LR k Determine the front LR of the prediction error block e(k) k The continuous high-bit planes are all 0, and E k Determine the remaining 8-LR k Whether the bit plane can embed information. If the current bit plane cannot embed information, use Inf 2 Replace the information in; if the current bit plane can embed information, use F k Confirm the value, number and position of the fewer bits in the bit plane, so as to restore the bit plane; the restored e(k) can restore the remaining pixel values in the block; S6-3-4. When all blocks are traversed, the generated image is the original encrypted image x e , and then according to the encryption key K e The encrypted image x e The order of each block in is restored, and the pixels in the block are decrypted using XOR decryption. When the prediction error in the decrypted block is the same as that in the original block, the decryption is completed and the original image x is obtained.
9. A reversible information hiding system for encrypted images based on adaptive block coding, based on the method described in any one of claims 1 to 8, It is characterized in that Includes the following modules: Encryption module: Use the encryption key to perform block-by-block XOR encryption and block rearrangement on the image, and then send the encrypted image to the cloud server; Block division and calculation module: divide the encrypted image into blocks and calculate the prediction error set and the number of high-order continuous zero-value bit planes of each block; Statistics module: counts the prediction errors and the number of high-order continuous zero-value bit planes of all blocks and performs Huffman coding respectively; Compression module: traverses each block of the image and performs prediction error coding compression or high-order zero-value bit plane compression according to the size of the embeddable space vacated; Embedding module: embeds all auxiliary information, part of the image information and the secret data encrypted with the hidden key into a specific position of each block to form a new ciphertext image; Extraction and recovery module: Perform data extraction and image recovery operations on the received image according to the hidden key and encryption key.
