Security Text Hiding and Extraction Method Compatible with Multiple Types of Image Carriers

Through the secure text hiding method for multi-type image carriers, the compatibility and security issues of JPEG and bitmap image carriers in the prior art are solved, and resistance to JPEG compression and multi-level security protection are achieved, which is suitable for watermark embedding and secret message delivery.

CN116405191BActive Publication Date: 2025-07-29Chinese People's Liberation Army Cyberspace Force Information Engineering University
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310324874.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2025-07-29
Estimated Expiration
2043-03-29

AI Technical Summary

Technical Problem

The existing information hiding technology mainly targets a single type of image carrier, and lacks compatibility with multiple type of image carriers such as JPEG and bitmap, cannot effectively resist JPEG compression and heavy compression, and is insufficient in security and capacity.

Method used

The secure text hiding method is adopted that is compatible with multi-type image carriers. Through image chunking, encoding type and embedding mode identification, stream symmetric encryption algorithm and pseudo-random number generator, hidden data is generated and pixel values of image blocks are modified, multiple character encoding methods are supported, and data fault tolerance recovery solutions are provided.

Benefits of technology

It realizes compatibility with multiple types of image carriers such as JPEG and bitmap, improves the security and capacity of information hiding, can resist JPEG compression and heavy compression, supports multi-level security protection, and is suitable for watermark embedding, copyright authentication and secret message delivery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116405191B_ABST
    Figure CN116405191B_ABST
Patent Text Reader

Abstract

The present invention provides a method for hiding and extracting secure text compatible with multiple types of image carriers. The hiding method includes: obtaining a digital image to get its corresponding pixel value matrix I; performing image block division on I; determining the encoding type and embedding mode of the text to be embedded, and generating an encoding type identification field and an embedding mode identification field; calculating the embedding capacity under this encoding type and this embedding mode; encoding the text to be embedded, calculating the length of the encoded text and generating a text length identification field; generating hidden data; allocating the hidden data to the corresponding image blocks; for the image blocks that need to embed the hidden data, modifying the image blocks according to the original pixel mean of the image blocks and the hidden data to be embedded therein to obtain new image blocks; repeating the above until all the image blocks that need to embed the hidden data are modified, and at this time storing all the image blocks in the original image format to obtain an image containing hidden data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of multimedia information security, and particularly to a method for hiding and extracting secure text compatible with multiple types of image carriers. Background Art

[0002] Traditional information hiding technology solutions mainly focus on elements such as the visual concealment of hidden information, statistical undetectability, robustness, and capacity, and are usually only suitable for a certain type of image carrier. Summary of the Invention

[0003] The present invention aims at a method for hiding and extracting secure text compatible with multiple types of image carriers such as JPEG and bitmap. It conceals text - type data, covers four mainstream character encoding methods at home and abroad, provides a custom encoding interface for users, and at the same time provides a data fault - tolerance and recovery scheme, as well as multi - level security protection measures. It can resist JPEG compression and recompression, and can be used for watermark embedding and copyright authentication, annotation and dissemination of public information, and transmission of secret messages between trusted users.

[0004] On the one hand, the present invention provides a method for hiding secure text compatible with multiple types of image carriers, including:

[0005] Step 1: Obtain a digital image and convert it to the pixel domain to obtain its corresponding pixel value matrix I;

[0006] Step 2: Divide the pixel value matrix I into image blocks to obtain a number of image blocks;

[0007] Step 3: Determine the encoding type and embedding mode of the text to be embedded, and generate an encoding type identification field and an embedding mode identification field;

[0008] Step 4: Calculate the embedding capacity under this encoding type and this embedding mode; the embedding capacity refers to the maximum number of bytes occupied by the text that the pixel value matrix I can carry;

[0009] Step 5: Encode the text to be embedded under this encoding type and this embedding mode, calculate the length of the encoded text, and generate a text length identification field;

[0010] Step 6: Generate concealed data according to the encoding type identification field, the embedding mode identification field, the encoded text, and the text length identification field;

[0011] Step 7: Allocate the concealed data to the corresponding image blocks;

[0012] Step 8: For the image blocks that need to embed the concealed data, modify the image blocks according to the original pixel mean of the image blocks and the concealed data to be embedded therein to obtain new image blocks;

[0013] Step 9: Repeat Step 8 until all the image blocks that need to embed the steganographic data are modified. At this time, store all the image blocks in the original image format to obtain an image containing steganographic data.

[0014] Further, the encoding type refers to any one of ASCII code, GBK code, GB18030 code, UTF-8 code, and user-defined encoding;

[0015] The embedding mode refers to any one of the large-capacity mode, fault-tolerant mode, large-capacity encryption mode, and fault-tolerant encryption mode; among them, the large-capacity mode means that when the text to be embedded is not encrypted, each image block carries 3 bits of steganographic data; the fault-tolerant mode means that when the text to be embedded is not encrypted, each image block carries 1 bit of steganographic data and 2 bits of parity; the large-capacity encryption mode means that when the text to be embedded is encrypted, each image block carries 3 bits of steganographic data; the fault-tolerant encryption mode means that when the text to be embedded is encrypted, each image block carries 1 bit of steganographic data and 2 bits of parity.

[0016] Further, Step 4 specifically includes:

[0017] In the large-capacity mode or large-capacity encryption mode, if the encoding type is ASCII code, the embedding capacity If the encoding type is other types, the embedding capacity

[0018] In the fault-tolerant mode or fault-tolerant encryption mode, if the encoding type is ASCII code, the embedding capacity If the encoding type is other types, the embedding capacity

[0019] Among them, L represents the total number of image blocks, f represents the number of image blocks occupied by the two fields of the encoding type identification field and the embedding mode identification field, and k represents the number of image blocks occupied by the text length identification field.

[0020] Further, Step 5 also includes:

[0021] Obtain the user password and encrypt the text to be embedded; correspondingly, encode the encrypted text to be embedded under this encoding type and this embedding mode; the user password uses the characters covered by the GBK code.

[0022] Further, a stream symmetric encryption algorithm is used to encrypt the text to be embedded.

[0023] Further, Step 7 specifically includes:

[0024] Step 7.1: Sort all image blocks in column-by-column scanning order;

[0025] Step 7.2: Use the first f + k image blocks to store the first 3×(f + k) bits of the covert data;

[0026] Step 7.3: Set the seed of the pseudo-random number generator and generate pseudo-random numbers. The pseudo-random number generator is constructed by the Mersenne Twister algorithm;

[0027] Step 7.3: Reorder the remaining L - f - k image blocks according to the generated pseudo-random numbers;

[0028] Step 7.4: Store the encoded text sequentially using the previous image blocks in the way that each image block stores 3 bits of data.

[0029] Further, in Step 7.3, the seed of the pseudo-random number generator is set as follows:

[0030] If the text to be embedded is not encrypted before encoding, or although the text to be embedded is encrypted before encoding but the length of the user password used does not exceed the set byte threshold, then use the integer corresponding to the binary number composed of the encoding type field and the text length field as the seed;

[0031] If the text to be embedded is encrypted before encoding and the length of the user password used exceeds the set byte threshold, then use the integer corresponding to the part of the user password after exceeding the set byte threshold as the seed.

[0032] Further, Step 8 specifically includes:

[0033] Step 8.1: Calculate the original pixel average value of the image block B(i, j) according to formula (1):

[0034]

[0035] where round represents rounding operation, |B(i, j)| represents the number of pixel values in the image block B(i, j), i and j respectively represent the row and column where the image block is located, i1, j1, t1 respectively represent the row, column and channel where the pixel in the image block B(i, j) is located, and I(i1, j1, t1) represents the pixel value of the t1-th channel at the position of the i1-th row and j1-th column in the image block B(i, j);

[0036] Step 8.2: Convert the covert data to be embedded in the image block B(i, j) into an integer d with a value range of 0 to 7;

[0037] Step 8.3: Compare d and (I mean)Whether 8 is equal. If they are equal, the image block B(i,j) is not modified. If they are not equal, the original pixel value I(i1,j1,t1) is modified to a new pixel value I(i1,j1,t1)′, that is: I(i1,j1,t1)′ = I(i1,j1,t1) - (I mean )8 + d; where, (I mean )8 represents the remainder obtained by dividing I mean by 8.

[0038] Furthermore, it also includes: Step 8.4: If the new pixel value I(i1,j1,t1)′ is greater than 255, then let I(i1,j1,t1)′ = 255; if the new I(i1,j1,t1)′ is less than 0, then let I(i1,j1,t1)′ = 0;

[0039] Step 8.5: Return to execute Step 8.1 to recalculate I mean , and execute Step 8.3 again. If they are equal, the modification of the image block B(i,j) is completed.

[0040] On the other hand, a secure text extraction method compatible with multiple types of image carriers is characterized by including:

[0041] Step 1: Read the image containing the hidden data; the hidden data is generated according to the coding type identification field, the embedding mode identification field, the encoded text, and the text length identification field;

[0042] Step 2: Divide the image into blocks, and determine the image blocks where the coding type identification field and the embedding mode identification field are located from all the image blocks; and read the coding type and the embedding mode of the embedded text from the image blocks;

[0043] Step 3: Calculate the embedding capacity under this coding type and this embedding mode; the embedding capacity refers to the maximum number of bytes occupied by the text that the pixel value matrix I can carry;

[0044] Step 4: Calculate the image block where the text length identification field is located according to the embedding capacity, and read the length of the embedded text from the image block;

[0045] Step 5: Calculate the image block where the embedded text is located according to the length of the embedded text, and read the encoded embedded text from the image block;

[0046] Step 6: Decode the encoded embedded text according to the coding type to obtain the embedded text.

[0047] Advantages of the present invention:

[0048] (1) The present invention has good compatibility with image carrier formats: The present invention is applicable to carriers of JPEG images and bitmaps. Common bitmap formats such as BMP, PNG, TIFF, GIF, etc. Images can be three-channel color images or single-channel grayscale images. These images have a large number of applications in the Internet and computer fields. Since the image uses the average pixel brightness of 8×8 blocks as the load of information, it can better resist JPEG compression and recompression. Especially in the error-tolerant mode, when the average pixel brightness of the image block fluctuates by ±1, due to the existence of error correction coding, the data can still be correctly restored.

[0049] (2) The universality, efficiency, and reliability of the text encoding adopted by the present invention are good: The present invention adopts four optional text character encoding modes, covering equal-length and variable-length encoding standards widely used in China and even internationally. In addition, the encoding mode of the ASCII code standard is optimized, and 7 bits are used to represent a symbol. These settings not only meet the needs of users of various different languages at home and abroad but also improve the encoding efficiency and the capacity of hidden data. When embedding data, according to the importance of the hidden data, users can adopt the error-tolerant mode and use error correction coding to enhance reliability, ensuring that the image data can still be correctly extracted under the influence of noise or JPEG compression quantization. In the non-error-tolerant large-capacity mode, users can obtain a larger embedding capacity. In this selection mode, even without the help of error correction codes, as long as the changes experienced by the image data during transmission do not affect the average pixel brightness of each block, the text data will not be damaged.

[0050] (3) The security of user data after adopting the present invention is high: The protection of user data in the present invention mainly relies on two main technologies and one auxiliary technology. Two main technologies: One is the stream symmetric encryption algorithm "TRIVIUM", and the other is the scrambling and rearrangement of the block embedding order. Users can choose high-level encryption, medium-level encryption, low-level encryption, or no encryption according to the importance of the hidden data (wherein, the large-capacity mode and the error-tolerant mode correspond to no encryption; the large-capacity encryption mode and the error-tolerant encryption mode can correspond to high-level encryption, medium-level encryption, and low-level encryption according to the security level of the rearrangement key). One auxiliary technology: The text encoding can be customized, and a custom code table is input to achieve the protection of data. For attackers, the absence of the code table will prevent them from restoring the correct text content.

[0051] Regardless of which of the four selection modes, the embedding selection order of the blocks will be rearranged, rather than being embedded in the original column scanning order. The difference between the four selections is that the rearrangement key in the high-level encryption mode is only known to the user, while the rearrangement key in the latter three selections is the length value of the hidden data. Any attacker who masters the details of this scheme can obtain the key in the images corresponding to these selections.

[0052] The significance of rearrangement is to evenly embed user data in the entire image. This means that modifying the content of a local part of the image or maliciously tampering with it (such as replacing the people in the image) will only affect several non - consecutive characters. In this way, when the user extracts the data and restores the text, they can discover the errors in the text according to the context of natural language, and in most cases, can correct the errors by themselves during the reading process according to the combination characteristics of natural language.

[0053] Under low - level and medium - level encryption conditions, although the attacker can know the embedding order, to obtain the text information, they must also obtain the key. At this time, the security of user data is determined by the security of the international standard stream symmetric encryption algorithm "TRIVIUM". To conduct an exhaustive attack on the key, the size of the key space must be considered. In the low - level encryption mode, only single - byte passwords such as English or only double - byte passwords such as Chinese characters are used, and the key space is small, the difficulty of exhaustive attack is low, and the security performance is relatively low. In medium - level encryption, a mixture of both is used, the key space is large, the difficulty of exhaustive attack is high, and the security performance is high. Therefore, as long as the user reasonably sets the key according to the importance of the data, the corresponding protection level can be achieved.

[0054] "High - level encryption" provides the highest level of protection for user data among the three encryption levels. It is reflected in that it not only encrypts user data, but also encrypts the embedding position and order of the data. This makes the attacker face not just a simple sequence encryption problem, but a problem where the position, order, and value are all unknown. The price of doing this is that the user needs to use a longer password. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a schematic flowchart of a secure text hiding method compatible with multiple types of image carriers provided by an embodiment of the present invention;

[0056] Figure 2 It is a schematic diagram of three channels of an image provided by an embodiment of the present invention;

[0057] Figure 3 It is a schematic diagram of image segmentation provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0058] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0059] Embodiment 1

[0060] As Figure 1 shown, an embodiment of the present invention provides a secure text hiding method compatible with multiple types of image carriers, including the following steps:

[0061] S101: Obtain a digital image and convert it to the pixel domain to obtain its corresponding pixel value matrix I;

[0062] Specifically, the pixel value at the i-th row and j-th column, and the t-th channel is represented by I(i,j,t), where i = 1, 2,..., M, j = 1, 2,..., N, and t = 1, 2, 3. Here, the image file format type can be JPEG and bitmap (such as BMP, PNG, TIFF, GIF); the image can be a color image, such as having a pixel value matrix with three RGB channels, represented by t = 1, 2, 3; or it can be a grayscale image, having a single-channel pixel value matrix, represented only by t = 1 or omitting t and using I(i,j). The schematic diagram of the three channels of the image is as Figure 2 shown.

[0063] S102: Perform image block division on the pixel value matrix I to obtain a number of image blocks (also called divided blocks);

[0064] Specifically, in practical applications, generally, the image is divided into a number of 8×8-sized, adjacent and non-overlapping image blocks in the top-down (the direction in which the coordinate i increases) and left-to-right (the direction in which the coordinate j increases) manner. It should be noted that if the length M or width N of the image I cannot be divisible by 8, the size of the bottommost or rightmost image block will not reach 8×8, but it is still regarded as an image block (as Figure 3 shown).

[0065] For the convenience of describing the image blocks, the divided block in the i-th row and j-th column is represented by B(i,j), where i = 1, 2,..., m, j = 1, 2,..., n; here, the total number of divided blocks is L = mn. When the image is a color image, the divided block B(i,j) contains the corresponding divided blocks B(i,j,k) of the three channels.

[0066] S103: Determine the encoding type and embedding mode of the text to be embedded, and generate an encoding type identification field and an embedding mode identification field;

[0067] (1) ASCII code: An international standard. If the text to be embedded only contains numbers, 26 English letters in uppercase and lowercase, and punctuation marks, spaces, line breaks, etc., it can be encoded using the American Standard Code for Information Interchange (ASCII code), removing the highest bit 0, and each symbol is encoded with 7-bit binary.

[0068] (1) ASCII code: An international standard. If the text to be embedded only contains numbers, 26 English letters in uppercase and lowercase, and punctuation marks, spaces, line breaks, etc., it can be encoded using the American Standard Code for Information Interchange (ASCII code), removing the highest bit 0, and each symbol is encoded with 7-bit binary.

[0069] (2) GBK Code: A national standard. Each character is encoded with at most two bytes (16 bits).

[0070] (3) GB18030 Code: A national standard. Each character is encoded with at most four bytes (32 bits).

[0071] (4) UTF-8 Code: An international standard. Each character is represented with at most 6 bytes.

[0072] (5) User-Defined Encoding: Note that GB18030 is compatible with GBK code. All text characters that can be encoded by GBK code exist in the GB18030 code set. Therefore, option (2) also exists as a custom option. According to the user's needs, it can be changed to a custom encoding. The two parties of the covert communication can share and load the custom code table to use this function, which can further enhance the security of communication. When the user selects the encoding type (2) and provides a custom code table at the same time, it means that the user uses the custom code table for encoding and decoding of text data. The structure of the custom code table is a correspondence table between Unicode and the custom encoding. Unicode is a character encoding scheme developed by an international organization that can accommodate all the characters and symbols in the world. The custom encoding is generated from the Unicode code of the text input by the user indexed to the user-defined encoding, that is, the custom encoding is completed. Conversely, during decoding, the data text can be restored by reverse indexing the Unicode encoding from the covert data encoding. The custom encoding uses a fixed-length code, and the length is an integer multiple of bytes.

[0073] After selecting the encoding type, it is necessary to generate an encoding type identification field (referred to as the CodeFlag field) for indication. Different encoding types are indicated by defining different values for the CodeFlag field. For example:

[0074] (1) If it is ASCII code, then CodeFlag = '00';

[0075] (2) If it is GBK code or user-defined encoding, then CodeFlag = '01';

[0076] (3) If it is GB18030 code, then CodeFlag = '10';

[0077] (4) If it is UTF-8 code, then CodeFlag = '11'.

[0078] In this way, the CodeFlag field is generated according to the encoding type selected by the user.

[0079] Further, to ensure that the information in this CodeFlag field can be extracted without error, it is generally necessary to encode each of their information bits to obtain an error-correcting codeword: the error-correcting codeword corresponding to encoding information 0 is 001, and the error-correcting codeword corresponding to encoding information 1 is 110. Thus, the encoded CodeFlag occupies 6 bits. For example: if the original CodeFlag = '11', then the encoded CodeFlag = '110110'.

[0080] (2) There are the following four optional embedding modes

[0081] (1) High-capacity mode: When the text to be embedded is not encrypted, each 8×8 block carries 3 bits of hidden data.

[0082] (2) Fault-tolerant mode: When the text to be embedded is not encrypted, each 8×8 block carries 1 bit of hidden data and 2 bits of parity.

[0083] (3) High-capacity encryption mode: When the text to be embedded is encrypted, each 8×8 block carries 3 bits of hidden data; the user password requirement is that, under GB18030 encoding, it reaches the text character length range of 6 to 14 bytes.

[0084] (4) Fault-tolerant encryption mode: When the text to be embedded is encrypted, each 8×8 block carries 1 bit of hidden data and 2 bits of parity; the user password requirement is that, under GB18030 encoding, it reaches the text character length range of 6 to 14 bytes.

[0085] After selecting the embedding mode, it is necessary to generate an embedding mode identification field (referred to as the ModeFlag field) to indicate. Different embedding modes are indicated by defining different values for the ModeFlag field. For example:

[0086] (1) If it is the high-capacity mode, then ModeFlag = '00';

[0087] (2) If it is the fault-tolerant mode, then ModeFlag = '01';

[0088] (3) If it is the high-capacity encryption mode, then ModeFlag = '10';

[0089] (4) If it is the fault-tolerant encryption mode, then ModeFlag = '11'.

[0090] Thus, the ModeFlag field is generated according to the embedding mode selected by the user.

[0091] Further, to ensure that the ModeFlag field information can be extracted without error, each of their information bits needs to be encoded to obtain an error-correcting codeword: the error-correcting codeword corresponding to the encoding of information 0 is 001, and the error-correcting codeword corresponding to the encoding of information 1 is 110. The encoded ModeFlag occupies 6 bits. For example: if the original ModeFlag = '01', then the encoded ModeFlag = '001110'.

[0092] S104: Calculate the embedding capacity under this encoding type and this embedding mode; the embedding capacity refers to the maximum number of bytes occupied by the text that the pixel value matrix I can carry;

[0093] Specifically, to correctly recover the hidden data, the information to be embedded should include: CodeFlag and ModeFlag. Let f represent the number of image blocks occupied by the two fields of the encoding type identification field and the embedding mode identification field. In the above encoding method, it can be known that the fields CodeFlag and ModeFlag total 12 bits, and each 3 bits are carried by 1 8×8 block, for a total of 4 blocks, so f = 4.

[0094] Similarly, to correctly recover the hidden data, the information to be embedded should also include: the text length identification field (also called the TextLength field), which identifies the byte length of the user input text, and it is set that this field occupies k bits, and k is used to represent the number of image blocks occupied by the text length identification field; finally, the information to be embedded also includes the text to be embedded itself, represented by TextData.

[0095] Based on the above content, if the total number of blocks is L, f blocks are used to embed CodeFlag and ModeFlag, and k blocks are used to embed k bits of TextLength, then the calculation process of the embedding capacity (denoted as c) is as follows:

[0096] (1) If the user selects the large-capacity (or large-capacity encryption) mode, then each block can embed 3 bits of information, and these L - f - k blocks can store 3×(L - f - k) / 7 bits of information. The corresponding text byte storage capacity is divided into two cases:

[0097] One is when the text encoding type is selected as ASCII code, it can store bytes of text, that is The other is when the text encoding type is selected as other types, it can store bytes of text, that is

[0098] (2) If the user selects the error-tolerant (or error-tolerant encryption) mode, 1 bit of information and 2 bits of parity can be embedded in each block. These L - f - k blocks can only store (L - f - k) bits of information. The corresponding text byte storage capacity still has two cases:

[0099] One is when the text encoding type is selected as ASCII code, it can store bytes of text, that is The other is when the text encoding type is selected as other types, it can store bytes of text, that is

[0100] In either of the above cases, only the minimum k value that satisfies 2 k ≥ c needs to be obtained to get the embedding capacity c of text bytes.

[0101] S105: Encode the text to be embedded under this encoding type and this embedding mode, calculate the length of the encoded text, and generate a text length identification field;

[0102] Specifically, in practical applications, before executing this step, assume that the byte length occupied by the text characters input by the user is l, and the corresponding embedding capacity c is given according to the selected covert data embedding mode. Compare the sizes of l and c. If l > c is taken, an alarm is issued, indicating that the length of the text to be embedded exceeds the embedding capacity. Otherwise, start to execute this step.

[0103] The value of the field TextLength is the binary representation of l. Further, to ensure that this TextLength field can be extracted without error, each information bit of it is encoded to obtain an error-correcting codeword: the error-correcting codeword corresponding to encoding information 0 is 001, and the error-correcting codeword corresponding to encoding information 1 is 110. Thus, the encoded TextLength needs to occupy 3k bits.

[0104] The actually embedded text data is identified by TextData.

[0105] (1) If the user selects the large-capacity mode, when the text encoding type is selected as ASCII code, TextData occupies 7l bits, and when the text encoding type is selected as other types, TextData occupies 8l bits.

[0106] (2) If the user selects the error-tolerant mode, each information bit of the text characters is encoded to obtain an error-correcting codeword: the error-correcting codeword corresponding to encoding information 0 is 001, and the error-correcting codeword corresponding to encoding information 1 is 110. Therefore, when the text encoding type is selected as ASCII code, TextData occupies 21l bits, and when the text encoding type is selected as other types, TextData occupies 24l bits.

[0107] S106: Generate steganographic data based on the coding type identification field, embedding mode identification field, coded text, and text length identification field;

[0108] Specifically, the embedding situation of the finally formed steganographic data is shown in Table 1.

[0109] Table 1 Embedding Situation of Steganographic Data

[0110]

[0111]

[0112] As can be seen from Table 1: In the large-capacity mode, the total length of the steganographic data is 12 + 3k + 7l or 12 + 3k + 8l bits; in the error-tolerant mode, the total length is 12 + 3k + 21l or 12 + 3k + 24l bits. In the large-capacity mode, the parameter l satisfies or In the error-tolerant mode, the parameter l satisfies 4 + k + 7l ≤ L, or 4 + k + 8l ≤ L. In the large-capacity mode, the upper limit of the value of the parameter l is about 3 times that in the error-tolerant mode.

[0113] S107: Allocate the steganographic data to the corresponding image blocks;

[0114] Specifically, the user can customize the steganographic data allocation strategy as needed. In this embodiment, the adopted steganographic data allocation strategy is as follows:

[0115] S1071: Sort all image blocks in the column-by-column scanning order; for example: B(1,1), B(1,2), …, B(1,n), B(2,1), B(2,2), …, B(2,n), …, B(m,1), B(m,2), …, B(m,n);

[0116] S1072: Use the first f + k image blocks to store the first 3×(f + k) bits of the steganographic data;

[0117] S1073: Use the integer corresponding to the binary number composed of the coding type field and the text length field as the seed of the pseudo-random number generator and generate pseudo-random numbers. The pseudo-random number generator is constructed by the Mersenne Twister algorithm;

[0118] S1073: Re-sort the remaining L - f - k image blocks according to the generated pseudo-random numbers;

[0119] S1074: Store the coded text sequentially using the previous image blocks in the way that each image block stores 3 bits of data.

[0120] S108: For the image block that needs to embed the stego data, modify the image block according to the original pixel mean value of the image block and the stego data to be embedded therein to obtain a new image block;

[0121] Specifically, this step specifically includes the following sub-steps:

[0122] S1081: Calculate the original pixel average value of the image block B(i,j) according to formula (1):

[0123]

[0124] where round represents the rounding operation, |B(i,j)| represents the number of pixel values in the image block B(i,j), i and j respectively represent the row and column where the image block is located, i1, j1, and t1 respectively represent the row, column, and channel where the pixel in the image block B(i,j) is located, and I(i1,j1,t1) represents the pixel value of the t1-th channel at the position of the i1-th row and j1-th column in the image block B(i,j);

[0125] S1082: Convert the stego data to be embedded in the image block B(i,j) into an integer d with a value range of 0 to 7.

[0126] S1083: Compare whether d is equal to (I mean )8. If they are equal, do not modify the image block B(i,j). If they are not equal, modify the original pixel value I(i1,j1,t1) to the new pixel value I(i1,j1,t1)′, that is: I(i1,j1,t1)′ = j(i1,j1,t1) - (I mean )8 + d; where (I mean )8 represents the remainder obtained by dividing I mean by 8.

[0127] It should be noted that the new pixel value I(i1,j1,t1)′ may exceed the normal brightness level range required by the image. When the value of the new pixel exceeds the normal brightness level range required by the image, truncation must be performed. Therefore, on the basis of the above content, the following steps are also included:

[0128] S1084: The value range of the pixel value is [0, 255]. If the new pixel value I(i1,j1,t1)′ is greater than 255, then let I(i1,j1,t1)′ = 255; if the new I(i1,j1,t1)′ is less than 0, then let I(i1,j1,t1)′ = 0.

[0129] S1085: Return to execute step S1081 to recalculate to obtain I mean, and step S1083 is executed again. If they are equal, the image block B(i,j) is successfully modified.

[0130] S109: Repeat S108 until all the image blocks that need to embed the hidden data are successfully modified. At this time, all the image blocks are stored in the original image format to obtain an image containing hidden data.

[0131] Embodiment 2

[0132] In the above embodiment, the text to be embedded is encoded in plaintext; correspondingly, the subsequently formed hidden data is naturally in plaintext form. To further improve the security performance of the method, on the basis of the above embodiment, the difference between the secure text hiding method compatible with multiple types of image carriers provided by the embodiment of the present invention and the above embodiment is that this embodiment modifies step S105 to:

[0133] S105: Obtain the user password and encrypt the text to be embedded. Encode the encrypted text to be embedded under this encoding type and this embedding mode, calculate the length of the encoded text, and generate a text length identification field; the user password uses the characters covered by the GBK code;

[0134] Correspondingly, in step S107, there are the following two cases for setting the seed of the pseudo-random number generator:

[0135] If the length of the user password used does not exceed the set byte threshold, the integer corresponding to the binary number composed of the encoding type field and the text length field is used as the seed; if the length of the user password used exceeds the set byte threshold, the integer corresponding to the part of the user password after exceeding the set byte threshold is used as the seed.

[0136] The other steps of this embodiment are the same as those of Embodiment 1 and will not be elaborated here.

[0137] Specifically, this embodiment uses the stream symmetric encryption algorithm "TRIVIUM" to encrypt the text to be embedded. According to the requirements of this encryption algorithm, the set byte threshold is 10 bytes. The user password is limited to an input character sequence with a coding length not exceeding 14 bytes (i.e., 112 bits). If the content is all single-byte English, numbers and other characters, at most 14 characters can be input; if the content is all double-byte Chinese characters and the like, at most 7 characters can be input; if it is a mixture of the two, t Chinese characters and 14 - 2t English / digital combinations can be used (1 ≤ t ≤ 4).

[0138] It is divided into three different encryption protection levels ("weak", "medium", and "strong") according to its specific length and character type. When the length of the bit sequence does not exceed 80 bits, it corresponds to the "weak" level and the "medium" level. When the input characters are all single-byte encoded symbols such as English letters and numbers, or all double-byte represented characters such as Chinese characters, it is the "weak" level; when the input characters contain both single-byte encoded symbols such as English letters and numbers and double-byte represented characters such as Chinese characters, it is the "medium" level. These 80 bits (padding with zeros at the end if less than 80 bits to reach 80 bits) are used as the key, and the "TRIVIUM" algorithm is used to encrypt the text data. The 80-bit initialization vector IV in the "TRIVIUM" algorithm is set to all 1s. When the length of the bit sequence exceeds 80 bits, it corresponds to the "strong" level. The first 80 bits of the bit sequence are used as the key, and the "TRIVIUM" algorithm is used to encrypt the text data. The 80-bit initialization vector IV in the "TRIVIUM" algorithm is set to all 1s.

[0139] Embodiment 3

[0140] Corresponding to the above hiding method, this embodiment provides a secure text extraction method compatible with multiple types of image carriers, including the following steps:

[0141] S301: Read the image containing the hidden data; the hidden data is generated according to the coding type identification field, the embedding mode identification field, the encoded text, and the text length identification field;

[0142] S302: Divide the image into blocks, and determine the image blocks where the coding type identification field and the embedding mode identification field are located from all the image blocks; and read the coding type and the embedding mode of the embedded text from the image blocks.

[0143] Specifically, the image containing the hidden data is read into the pixel domain, and the image blocks are sorted in the column-by-column scanning order to obtain the original arrangement order: B(1,1), B(1,2), …, B(1,n), B(2,1), B(2,2), …, B(2,n), …, B(m,1), B(m,2), …, B(m,n).

[0144] Read the fields ModeFlag and CodeFlag of the hidden data from the first f blocks. The specific process is as follows: Calculate the average pixel value of each block B(i,j) according to formula (1):

[0145] Convert (I mean )8 to obtain 3-bit binary data d. If the d value of a certain block is neither equal to (001) nor equal to (110), it is considered that the image does not contain hidden data or the hidden data is damaged and cannot be correctly extracted. Otherwise, complete the decoding:

[0146] If d = (001), then take bit 0 as the decoding result.

[0147] If d = (110), then take bit 1 as the decoding result.

[0148] Thus, 2-bit information of the original fields ModeFlag and CodeFlag is obtained:

[0149] Obtain the information on whether the covert data is encrypted from the first bit of ModeFlag: If the first bit of ModeFlag is 0, it is considered that the covert data is in an unencrypted state. If the first bit of ModeFlag is 1, it is considered that the covert data is in an encrypted state. Obtain the embedding mode of the covert data from the second bit of ModeFlag: If the second bit of ModeFlag is 0, it is considered that the covert data is in the large-capacity embedding mode. If the second bit of ModeFlag is 1, it is considered that the covert data is in the fault-tolerant embedding mode.

[0150] Obtain the information on the text encoding type from CodeFlag: If CodeFlag = '00', it is considered that the text encoding type used for the covert data is ASCII code. If CodeFlag = '01', it is considered that the text encoding type used for the covert data is GBK code. If CodeFlag = '10', it is considered that the text encoding type used for the covert data is GB18030 code. If CodeFlag = '11', it is considered that the text encoding type used for the covert data is UTF-8 code.

[0151] S303: Calculate the embedding capacity in this encoding type and this embedding mode; the embedding capacity refers to the maximum number of bytes occupied by the text that the pixel value matrix I can carry;

[0152] Specifically, according to the text encoding type used for the covert data, calculate the capacity and the number of divided blocks k occupied by the field TextLength, specifically: According to the inequality 2 k ≥ c to solve for the maximum solution of k as the value of k. When the text encoding type is selected as ASCII code, the embedding capacity When the text encoding type is selected as other types, the embedding capacity

[0153] S304: Calculate the image block where the text length identification field is located according to the embedding capacity, and read the length of the embedded text from the image block;

[0154] Specifically, obtain the field TextLength from the (f + 1)-th to the f + k-th divided blocks. The specific process is as follows: Calculate the average pixel value of each divided block according to formula (1)

[0155] Convert (I mean )8 to obtain 3-bit binary data d. If d = (100) or (011), it is considered that the image does not contain hidden data, or the hidden data is damaged and cannot be correctly extracted.

[0156] If d = (001) or (000) or (010), then take bit 0 as the decoding result.

[0157] If d = (110) or (101) or (111), then take bit 1 as the decoding result.

[0158] Subsequently, obtain the original k-bit TextLength data. Convert these k bits into an integer, which is the actual embedded data byte length l.

[0159] S305: Calculate the image block where the embedded text is located according to the length of the embedded text, and read the encoded embedded text from the image block;

[0160] (1) When the first bit of ModeFlag takes the value of 0, it can be known that the user uses the non-encryption mode. The following is the process of reading non-encrypted hidden data.

[0161] When the first bit of ModeFlag takes the value of 0, it can be known that the user uses the non-encryption mode. The following is the process of reading non-encrypted hidden data.

[0162] (1) Determine the bit length of the hidden data text content:

[0163] If the hidden data belongs to the large-capacity embedding mode, it is described in two cases: one is when the text encoding type is selected as ASCII code, the actual embedded bit length is 7l; the other is when the text encoding type is selected as other types, the actual embedded bit length is 8l. If the actual embedded bit length is not divisible by 3, supplement 1 or 2 zeros to make the total length divisible by 3.

[0164] If the hidden data belongs to the fault-tolerant embedding mode, it is described in two cases: one is when the text encoding type is selected as ASCII code, the actual embedded bit length is 21l; the other is when the text encoding type is selected as other types, the actual embedded bit length is 24l.

[0165] (2) Identify the blocks that are the TextData payload and the embedding order. A pseudo-random number generator constructed by the Mersenne Twister algorithm obtains a sorting of the remaining L - 4 - k blocks (recall: in the original sorting of column scanning, the first 4 + k blocks are used for the payload fields ModeFlag, CodeFlag, and TextLength). The seed is the integer corresponding to the binary number composed of the original CodeFlag and TextLength. The blocks ranked ahead are used as the payload of the covert data TextData.

[0166] (3) Extract the covert data from each payload block and complete the splicing of the covert data according to the sorting (obtained by the Mersenne Twister algorithm). The process of extracting the covert data from each payload block is as follows: Calculate the average pixel value of each sub-block B(i,j) according to formula (1)

[0167] Convert (I mean )8 to obtain 3-bit binary data d. In the large-capacity mode, when there is a zero-padding operation for the data, when extracting the last bit, the padded zeros need to be removed; otherwise, the binary data d is the covert data. In the fault-tolerant mode, decoding needs to be completed:

[0168] If d = (001) or (000) or (010), then take bit 0 as the decoding result.

[0169] If d = (110) or (101) or (111), then take bit 1 as the decoding result.

[0170] (4) Splice the covert data extracted from each block in order to obtain the original TextData data.

[0171] (2) When the first bit of ModeFlag takes the value of 0, it can be known that the user uses the encryption mode. The following is the process of reading the encrypted covert data.

[0172] Reading the encrypted covert data still requires 4 steps. Among them, steps (1) and (3) are the same as steps (1) and (3) for reading the non-encrypted covert data, but there will be a difference in the selection of the seed in step (2), and step (4) requires an additional decryption process.

[0173] In step (2), according to the user password, calculate whether the key length exceeds 10 bytes. If it does not exceed, the selection of the seed in step (2) is the same as the method for reading the non-encrypted covert data. If it exceeds, the seed in step (2) should be replaced with "the integer corresponding to the bits after the 10-byte length in the password", and other contents remain unchanged.

[0174] In step (4), the concealed data extracted from each block are concatenated in sequence to obtain the original TextData. Then, based on the user password, an 80-bit key is obtained. If the password length exceeds 80 bits, the first 80 bits are intercepted as the key. If the password length is less than 80 bits, zeros are padded at the end to reach 80 bits. This key and the "TRIVIUM" algorithm are used to decrypt the TextData.

[0175] S306: Decode the encoded embedded text according to the encoding type to obtain the embedded text.

[0176] Specifically, when the text encoding type is selected as ASCII code, 0 is padded in front of every 7 bits of the TextData as a byte, and according to the character encoding rules, the text content is obtained.

[0177] When the text encoding type is selected as other types (GBK code, GB18030 code, UTF-8 code), every 8 bits of the TextData are grouped as a byte, and according to the character encoding rules, the text content is obtained.

[0178] When there is an encoding that does not exist in the character encoding set, mark the position of the character and prompt the user that there is an error in the concealed data.

[0179] Embodiment 4

[0180] In the above embodiment, it is mentioned that: when reading the field ModeFlag and the field CodeFlag of the concealed data from the first 4 blocks, if the d value of a certain block is neither equal to (001) nor equal to (110), it is considered that the image does not contain concealed data, or the concealed data is damaged and cannot be correctly extracted. When encountering the above situation, this embodiment provides a way to restore the text information. Specifically as follows:

[0181] Extract and restore the text information using the keyword field correction mode or the user's self-selected mode.

[0182] (1) Keyword field correction mode

[0183] Through decoding, forcefully restore the information of the field ModeFlag and the field CodeFlag:

[0184] If d = (001) or (000) or (010), then take bit 0 as the decoding result.

[0185] If d = (110) or (101) or (111), then take bit 1 as the decoding result.

[0186] However, if d = (100) or (011), then in this mode, extraction is still impossible, and the user will be prompted with "The image does not contain hidden data, or the hidden data is damaged and cannot be correctly extracted."

[0187] Furthermore, the "user self - selected mode" can be adopted to attempt to recover the data.

[0188] (2) User self - selected mode

[0189] The user sets the text encoding type and embedding mode of the hidden data by themselves, so as to obtain the field ModeFlag and the field CodeFlag according to the hidden data embedding rules, and then attempts to extract the hidden data.

[0190] This mode is mainly used when the keyword - field correction extraction method fails (when d = (100) or (011) for a certain block).

[0191] Embodiment 5

[0192] In the application scenarios of digital watermarking and copyright protection, watermark data is used as the text to be embedded for embedding, hiding, and extraction. The specific process is as follows: (1) - (12) are the embedding processes, and the process of extracting the watermark is after (13).

[0193] (1) Assume the user selects the image carrier as the standard image 'lena.bmp'

[0194] Read the image to obtain the pixel matrix, with the number of rows M = 1080, the number of columns N = 1080, divided into 8×8 sub - blocks, and a total of L = 18225 blocks are generated. The number of rows is The number of columns is

[0195] (2) Assume the user selects the error - tolerant encryption mode, then ModeFlag = '11'.

[0196] (3) Assume the user selects ASCII code, then CodeFlag = '00'. Calculate that the embedding capacity of ASCII code is 2601 bytes, and 12 bits are required to store the data byte length TextLength.

[0197] (4) Assume the user inputs text characters as watermark data: Copyright

[0198] Convert it to a bit sequence according to the character encoding (ASCII code): 01000011 01101111 01110000 01111001 01110010 01101001 01100111 01101000 01110100

[0200] Remove the highest - order 0 from the 8 - bit per character and represent it with 7 bits 1000011 1101111 1110000 1111001 1110010 1101001 110011111010001110100

[0202] The text data field is obtained as 63 bits:

[0203] TextData = [1000011 1101111 1110000 1111001 1110010 110100111001111101000 1110100]

[0204] It contains a total of 9 bytes, and the text data length field is obtained as 12 bits:

[0205] TextLength = [0 0 0 0 0 0 0 0 1 0 0 1]

[0206] (5) Suppose the user password is 1234567890ab, convert it to the binary form of GBK18030 character encoding: 001100000011000100110010001100110011010000110101001101100011011100111000001110010110000101100010

[0208] The password length exceeds 80 bits, the key level is strong, take the first 80 bits as the encryption key:

[0209] Key = [00110000001100010011001000110011001101000011010100110110001101110011100000111001]

[0210] The seed of the block scrambling and sorting algorithm is the integer value 24930 corresponding to the binary vector from the 81st bit of the password to the last 0110000101100010

[0211] (6) Encrypted data:

[0212] TextData = [001010111100010100010100110000011010010010000000100010001010011]

[0213] (7) After adding the error - correcting code, 0 corresponds to 001, 1 corresponds to 110, and the data length is 189 bits

[0214] TextData = [001001110001110001110110110110001001001110001110001001001110001110001001110110001001001001001110110001110001001110001001110001001001001001001001110001001001110001001001110001110001001110110]

[0215] (8) Embed ModeFlag

[0216] In the first two blocks obtained by column scanning, embed ModeFlag = [110, 110] after adding error correction code

[0217] The average pixel value of the first block is 163, with a remainder of 3 when divided by 8. What needs to be embedded is 6. Therefore, add 3 to the grayscale value of the entire block, and the average pixel value of the new block reaches 166, reaching a state of having a remainder of 3 when divided by 8.

[0218] The average pixel value of the second block is 160, with a remainder of 0 when divided by 8. What needs to be embedded is 6. Therefore, add 6 to the grayscale value of the entire block, and the average pixel value of the new block reaches 166, reaching a state of having a remainder of 6 when divided by 8.

[0219] (9) Embed CodeFlag

[0220] In the third and fourth blocks obtained by column scanning, embed CodeFlag = [001, 001] after adding error correction code

[0221] The average pixel value of the third block is 157, with a remainder of 5 when divided by 8. What needs to be embedded is 1. Therefore, subtract 4 from the grayscale value of the entire block, and the average pixel value of the new block reaches 153, reaching a state of having a remainder of 1 when divided by 8.

[0222] The average pixel value of the fourth block is 155, with a remainder of 3 when divided by 8. What needs to be embedded is 1. Therefore, subtract 2 from the grayscale value of the entire block, and the average pixel value of the new block reaches 153, reaching a state of having a remainder of 1 when divided by 8.

[0223] (10) Embed TextLength

[0224] In the 12 blocks from the fifth to the sixteenth obtained by column scanning, embed TextLegnth = [001001 001 001 001 001 001 001 110 001 001 110] after adding error correction code

[0225] The remainders obtained by taking the modulo 8 of the average values of these block pixels are successively: 4, 2, 2, 3, 5, 5, 0, 6, 1, 7, 7, 0. Operations of -3, -1, -1, -2, -4, -4, +1, -5, +5, -6, -6, +6 are performed on the pixel values of each block in turn.

[0226] (11) Embed TextData

[0227] Rearrange the remaining L - 4 - k = 18209 blocks according to the permutation reordering seed 24930. The sequence numbers of the top 63 blocks in the original column scan are [6611 11187 1872 15207 16863 14587 8568 13262 16586 7260 2610 14165 3524 12415 7685 17248 12097 16960 7359 13135 3686 9309 13190 481 14422 7235 5563 13276 6058 11725 7088 13037 11015 5786 17379 14009 7303 16607 10552 14518 11420 2044 8659 644 9755 583 12792 10915 16309 3556 11326 12777 4367 15098 8700 15715 8203 3070 4971 5506 3368 6215 6029]

[0228] According to such a rearrangement order, 3 bits of information are embedded in each block, totaling 189 bits. The modification of each block is carried out according to the image block modification strategy, and the process is the same as the embedding of ModeFlag, CodeFlag, and TextLength. As shown in the figure, the small blocks serving as the data payload positions of ModeFlag, CodeFlag, TextLength, and TextData are marked in black. Except for the 16 small blocks at the beginning of the column scan that are concentrated in the upper left corner, the other small blocks are evenly distributed in other positions of the image.

[0229] (12) Still store the modified image in the bitmap bmp format.

[0230] (13) Assume that a user obtains a JPG compressed image with a quality factor of 75 corresponding to the watermarked image 'lena.bmp'. Read the image to obtain the pixel matrix, with the number of rows M = 1080 and the number of columns N = 1080. Divide it into 8×8 blocks, and a total of L = 18225 blocks are generated. The number of rows is The number of columns is

[0231] (14)Under normal circumstances, the conventional extraction method is selected by default, that is: the blocks are scanned in column order, and the pixel means obtained from the first two blocks are 166 and 167 respectively, the remainders modulo 8 are 6 and 7 respectively, and when decomposed into bits, it is [110 111]. Since there is no 111 in the error correction codeword, in the conventional extraction method, a valid ModeFlag cannot be extracted from the second block. At this time, the user is prompted:

[0232] "This image does not contain hidden data, or the hidden data is damaged and cannot be extracted correctly."

[0233] (15)Select the keyword field correction extraction method, that is: the blocks are scanned in column order, and the pixel means obtained from the first two blocks are 166 and 167 respectively, the remainders modulo 8 are 6 and 7 respectively, and when decomposed into bits, it is [110 111]. Decoding operations are performed according to the error correction code decoding rules: for the cases of (001) or (000) or (010), the bit 0 is taken as the decoding result; for the cases of (110) or (101) or (111), the bit 1 is taken as the decoding result. The obtained ModeFlag =

[11] . That is, it is known that the hidden data uses the fault-tolerant encryption mode.

[0234] (16)Obtain the pixel means from the third and fourth blocks, which are 153 and 153 respectively, the remainders modulo 8 are 1 and 1 respectively, and when decomposed into bits, it is [001 001]. Decoding operations are performed according to the error correction code decoding rules: the obtained CodeFlag =

[00] . That is, it is known that the text encoding of the hidden data's ASCII code. Calculate that the embedding capacity of the ASCII code is 2601 bytes, and 12 bits are required to store the data byte length TextLength.

[0235] (17)Obtain the pixel means from the 12 blocks from the fifth to the sixteenth, which are

[0236] 153, 153, 154, 154, 153, 153, 160, 154, 166, 153, 153, 166

[0237] The 3-bit codewords obtained by taking the remainder modulo 8 are: [001 001 010 010 001 001 000 010 110 001 001 110]

[0238] The decoded result is: TextLength = [0 0 0 0 0 0 0 0 1 0 0 1]

[0239] Converting TextLength to an integer value equals 9, which indicates that there are 9 bytes of hidden data. In the ASCII code encoding and fault-tolerant mode, these 9 bytes of data are stored using 63 blocks.

[0240] (18) Since the data adopts a fault-tolerant encryption mode, the user is required to enter a password. After the user enters the correct password "1234567890ab", the key and the scrambling sorting seed are calculated. Under the GB18030 text encoding, the key length exceeds 10 bytes. The bit sequence [00110000001100010011001000110011001101000011010100110110001101110011100000111001] corresponding to the first 10 bytes "1234567890" is used as the decryption key. The integer value 24930 corresponding to the bit sequence [0110000101100010] of the subsequent byte "ab" is used as the scrambling sorting seed.

[0241] (19) Sort the other L - 16 = 18209 blocks except the first 16 blocks obtained by column scanning according to the scrambling sorting seed 24930 to obtain the numbers of the top 63 sorted blocks: [6611 11187 1872 15207 16863 14587 8568 13262 16586 7260 2610 14165 3524 12415 7685 17248 12097 16960 7359 13135 3686 9309 13190 481 14422 7235 5563 13276 6058 11725 7088 13037 11015 5786 17379 14009 7303 16607 10552 14518 11420 2044 8659 644 9755 583 12792 10915 16309 3556 11326 12777 4367 15098 8700 15715 8203 3070 4971 5506 3368 6215 6029]. Calculate the pixel means of these blocks and take the modulus 8 to obtain: [11 51 6 1 6 6 6 6 1 0 1 6 1 6 1 1 17 2 6 1 0 6 7 2 1 2 1 0 6 6 0 6 11 51 1 7 1 1 0 0 1 1 1 61 1 1 6 1 1 1 61 6 0 2 6 6]

[0243] Then perform binary decomposition to obtain the bit sequence. [001 001 101 001 110001 110110 110 110 001 000001 110001 110001 001001 111010110001 000 110111010 001 010001 000 110110000 110001 001 101 001001 111001 001 000 000 001 001 001 110 001 001 001 110001 001 001 110 001 110000010110110]

[0245] Decoding is completed to obtain: [0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 01 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 1 1]

[0247] (20) Use the Trivium algorithm and the key to decrypt the data to obtain: [1000011 1101111 1110000 1111001 1110010 1101001 1100111 11010001110100]

[0249] Then group every 7 bits, add 0 in front, and use ASCII code encoding to obtain the text: Copyright.

[0250] It can be seen from the above that the text hiding and extraction method provided by the present invention can achieve copyright protection, and the encryption algorithm can ensure that only the watermark embedder (usually the copyright owner) can verify the text information. From the perspective of watermark classification, this belongs to an invisible watermark.

[0251] Example 6

[0252] In the application scenario of annotating and disseminating public information, the public information is used as the text to be embedded for embedding, hiding, and extraction. The specific process is as follows: (1) to (10) are the embedding processes, and after (11) are the extraction processes.

[0253] (1) Suppose the user selects the image carrier as the standard image 'lena.bmp';

[0254] Read the image to obtain a pixel matrix, with the number of rows M = 1080 and the number of columns N = 1080, divided into 8×8 blocks, and a total of L = 18225 blocks are generated, and the number of rows is The number of columns is

[0255] (2) Suppose the user selects the large-capacity mode, then ModeFlag = '00'.

[0256] (3) Suppose the user selects the GB18030 encoding, then CodeFlag = '10'. Calculate that the embedding capacity of the GB18030 code is 6828 bytes, and 13 bits are required to store the data byte length TextLength.

[0257] (4) Suppose the user inputs text characters as the steganographic data: Playboy magazine in November 1972

[0258] Convert it to a bit sequence TextData according to the character encoding (GB18030 code): 00110001001110010011011100110010110001001110101000110001001100011101010011000010101110111010100010111011101010001011100110101011110101111101001111010100110100111101011010111110

[0260] The length is 176 bits, a total of 22 bytes, and the text data length field is 13 bits:

[0261] TextLength = [0 0 0 0 0 0 0 0 1 0 1 1 0]

[0262] Since it is the large-capacity mode, the length of TextData must be divisible by 3. Therefore, add 1 '0' at the end, and the final length of TextData is 177 bits

[0263] TextData = [001100010011100100110111001100101100010011101010001100010011000111010100110000101011101110101000101110111010100010111001101010111101011111010011110101001101001111010110101111100]

[0264] Use one image block payload for every 3 bits. A total of 177 / 3 = 59 blocks are required to embed the 177-bit data.

[0265] (5) Since the non-encrypted mode is adopted, the integer value 16406 corresponding to the binary vector [1 00 0 0 0 0 0 0 0 1 0 1 1 0] connected by CodeFlag and TextLength is used as the seed for scrambling and re-arrangement.

[0266] (6) Embed ModeFlag

[0267] In the first two sub-blocks obtained by column scanning, embed ModeFlag = [001, 001] after adding error correction code.

[0268] The average pixel value of the first sub-block is 163, with a remainder of 3 when divided by 8. What needs to be embedded is 1. Therefore, subtract 2 from the grayscale value of the entire sub-block, and the average pixel value of the new sub-block reaches 161, reaching a state of having a remainder of 1 when divided by 8.

[0269] The average pixel value of the second sub-block is 160, with a remainder of 0 when divided by 8. What needs to be embedded is 1. Therefore, add 1 to the grayscale value of the entire sub-block, and the average pixel value of the new sub-block reaches 161, reaching a state of having a remainder of 1 when divided by 8.

[0270] (7) Embed CodeFlag

[0271] In the third and fourth sub-blocks obtained by column scanning, embed CodeFlag = [110, 001] after adding error correction code.

[0272] The average pixel value of the third sub-block is 157, with a remainder of 5 when divided by 8. What needs to be embedded is 6. Therefore, add 1 to the grayscale value of the entire sub-block, and the average pixel value of the new sub-block reaches 158, reaching a state of having a remainder of 6 when divided by 8.

[0273] The average pixel value of the fourth sub-block is 155, with a remainder of 3 when divided by 8. What needs to be embedded is 1. Therefore, subtract 2 from the grayscale value of the entire sub-block, and the average pixel value of the new sub-block reaches 153, reaching a state of having a remainder of 1 when divided by 8.

[0274] (8) Embed TextLength

[0275] In the 13 sub-blocks from the fifth to the seventeenth obtained by column scanning, embed TextLegnth = [001001 001 001 001 001 001 001 110 001110 110 001] after adding error correction code.

[0276] The remainders of the average pixel values of these sub-blocks when divided by 8 are successively: 4, 2, 2, 3, 5, 5, 0, 6, 1, 7, 7, 0, 2. Perform operations of -3, -1, -1, -2, -4, -4, +1, -5, +5, -6, -1, +6, -1 on the pixel values of each sub-block in turn.

[0277] (9) Embed TextData

[0278] Rearrange the remaining L - 4 - k = 18208 blocks according to the permuted re - ordering seed 16406. The sequence numbers of the top 59 blocks in the original column scan are [165209337164861063581541215015110423077594945 19917105 16864 16409 14802626 23867645147907034 127102891 48769929469 1599 15348775 5166 6302 15574 11556 2530 11348 1853 158363596571416560 621614318 13502 3147 13539 1321513549 1079811000 14684 38762907984916148 432313758 15213 16987 11295 4275]

[0279] According to such a rearrangement order, 3 - bit information is embedded in each block, with a total of 177 bits. The modification of each block is carried out according to the image block modification strategy, and the process is the same as the embedding of ModeFlag, CodeFlag, and TextLength. As shown in the figure, the small blocks serving as the data payload positions of ModeFlag, CodeFlag, TextLength, and TextData are marked in black. Except for the 17 small blocks at the beginning of the column scan that are concentrated in the upper left corner, the other small blocks are evenly distributed in other positions of the image.

[0280] (10) Still store the modified image in the bitmap bmp format.

[0281] (11) Read the image 'lena.bmp' containing the hidden data.

[0282] Read the image to obtain the pixel matrix. The number of rows M = 1080, the number of columns N = 1080, divided into 8×8 blocks, and a total of L = 18225 blocks are generated. The number of rows is The number of columns is

[0283] (12) Generally, the conventional extraction method is selected by default. According to the column scan order, the pixel means obtained from the first two blocks are 161 and 161 respectively, and the remainders modulo 8 are 1 and 1 respectively. Decomposed into bit representations as [001 001], ModeFlag =

[00] is obtained. That is, it is known that the hidden data uses the large - capacity mode.

[0284] (13) The pixel means obtained from the 3rd and 4th sub - blocks are 158 and 153 respectively. The remainders when divided by 8 are 6 and 1 respectively, which are decomposed into bit representations as [110 001]. Decoding operations are performed according to the error - correcting code decoding rules: CodeFlag =

[10] is obtained. That is, the text encoding of the hidden data in GB18030 code is known. The embedding capacity of the GB18030 code is calculated to be 6828, and 13 bits are required to store the data byte length TextLength.

[0285] (14) The pixel means obtained from 13 sub - blocks from the 5th to the 17th are 153 153 153 153 153 153 161 153 166 153 158 166 161

[0287] The 3 - bit codewords obtained by taking the remainder when divided by 8 are: [001 001 001 001 001 001 001 001 110 001 110 110 001]

[0288] After decoding, we get: TextLength = [0 0 0 0 0 0 0 0 1 0 1 1 0]

[0289] Converting TextLength to an integer value equals 22, which indicates that there are 22 bytes of hidden data. In the GB18030 code encoding and large - capacity mode, these 22 bytes of data, a total of 176 bits, are stored using sub - blocks.

[0290] (15) Since it is a non - encrypted mode, the integer value 16406 corresponding to the binary vector [1 00 0 00 0 0 0 0 1 0 1 1 0] formed by connecting CodeFlag and TextLength is used as the seed for scrambling and permutation.

[0291] (16) Rearrange the remaining L - 4 - k = 18208 blocks according to the seed 16406 reordered by permutation. The sequence numbers of the top 59 blocks in the original column scan are [165209337164861063581541215015110423077594945 19917105 16864 16409 14802626 23867645147907034 127102891 48769929469 1599 15348775 5166 6302 15574 11556 2530 11348 1853 158363596571416560 621614318 13502 3147 13539 1321513549 1079811000 14684 38762907984916148 432313758 15213 16987 11295 4275].

[0292] (17) According to such a rearrangement order, extract 3 - bit information by taking the modulus 8 of the pixel mean of each block, for a total of 177 bits. 177 divided by 8 has a remainder of 1, indicating that the number of filled 0s is 1. Remove this extra bit 0, leaving 176 bits. Group them into bytes of 8 bits each and decode according to the GB180303 encoding to obtain the text: Playboy magazine, November 1972.

[0293] In this embodiment, the publicly available information is embedded in the image carrier. For example, the embedded information is the source of this image - "Playboy magazine, November 1972", which serves as a note for the content of this image for users who share this image to view. In addition, the embedded hidden data can also be other publicly available messages that need to be passed to users who may obtain this image.

[0294] Embodiment 7

[0295] In the application scenarios of covert communication and secure communication, the secret information is used as the text to be embedded for embedding and extraction. The specific process is as follows: (1) - (12) are the embedding processes, and after (13) is the process of extracting the hidden data.

[0296] (1) Assume that the user selects the image carrier as the standard image 'lena.jpg' in JPG format

[0297] Read the image to obtain the pixel matrix. The number of rows M = 1080, the number of columns N = 1080, and it is divided into 8×8 blocks, resulting in a total number of blocks L = 18225. The number of rows is The number of columns is

[0298] (2) If the user selects the fault-tolerant encryption mode, then ModeFlag = '11'.

[0299] (3) If the user selects a custom encoding and inputs a code table, then CodeFlag = '01'. Here, it is assumed that the code table is a variation of the ASCII code: the highest bit 0 of each symbol in the original code table is modified to 1 for encoding. Some character examples:

[0300] Text unicode (ASCII code range) Custom encoding a 01100001 11100001 B 01000010 11000010 : 00111010 10111010

[0301] It is calculated that the embedding capacity of the custom encoding is 2276 bytes, and 12 bits are required to store the data byte length TextLength.

[0302] (4) If the user inputs the secret message text characters: "I arrive in Beijing at 10:00 on January 1."

[0303] Convert it to a bit sequence according to the character encoding (unicode (ASCII code range)): 010010010010000001100001011100100111001001101001011101100110010100100000011010010110111000100000010000100110010101101001011010100110100101101110011001110010000001100001011101000010000000110001001100000011101000110000001100000010000001101111011011100010000001001010011000010110111001110101011000010111001001111001001000000011000100101110

[0305] Convert it to the user-defined encoding, where the highest bit 0 of each 8-bit character becomes 1, to obtain the text data: 11001001 10100000 11100001 11110010 11110010 1110100101 1111011011100101 10100000 11101001 11101110 10100000 11000010 11100101 111010101010 1110101001 11101110 11100111 10100000 111000001 111101010 10100000 10110000 10100000 11101111 1110111010100000 11001010 11100001 11101110 11110101 11100001 11110010 1111100110100000 10110001 10101110

[0307] The length is 336 bits, containing a total of 42 bytes, resulting in a 12-bit text data length field:

[0308] TextLength=[0 0 0 0 0 0 1 0 1 0 1 0]

[0309] (5) Assume the user password is "一二三abc", and convert it into binary form of GBK18030 character encoding: 110100101011101110110110111111101100100011111101011000010110001001100011

[0311] The password contains less than 10 bytes of both letters and Chinese characters. The user is informed that the key strength level is medium and the password length is less than 80 bits. Therefore, zeros are added to the end to obtain the 80-bit encryption key:

[0312] Key=[11010010101110111011011011111110110010001111110101100001011000100110001100000000]

[0313] The seed of the block scrambling sorting algorithm is the integer value 4138 corresponding to the binary vector [0 1 0 00 0 0 0 1 0 1 0 1 0] concatenated by CodeFlag and TextLength.

[0314] (6) Encrypted data:

[0315] TextData = [001011101100110010100100011110000111111110100101101010110100000110100110100011101000010100010110010011111011110100001100011011000110100101101011000011110001110101011000001111010110011110011011100111001000010100001110011010111101101101100011100011011110000010011110000101000100101111101100101101110010101111111011111000010010000101100110]

[0316] After adding the error correction code, 0 corresponds to 001, 1 corresponds to 110, and the data length is 1008 bits

[0317]

[0318] (8) Embed ModeFlag

[0319] In the first two blocks obtained by column scanning, embed ModeFlag = [110, 110] after adding error correction code

[0320] The average pixel value of the first block is 163, with a remainder of 3 when divided by 8. What needs to be embedded is 6. Therefore, add 3 to the grayscale value of the entire block, and the average pixel value of the new block reaches 166, reaching the state of having a remainder of 3 when divided by 8.

[0321] The average pixel value of the second block is 160, with a remainder of 0 when divided by 8. What needs to be embedded is 6. Therefore, add 6 to the grayscale value of the entire block, and the average pixel value of the new block reaches 166, reaching the state of having a remainder of 6 when divided by 8.

[0322] (9) Embed CodeFlag

[0323] In the third and fourth blocks obtained by column scanning, embed CodeFlag = [001, 001] after adding error correction code

[0324] The average pixel value of the third block is 157, with a remainder of 5 when divided by 8. What needs to be embedded is 1. Therefore, subtract 4 from the grayscale value of the entire block, and the average pixel value of the new block reaches 153, reaching the state of having a remainder of 1 when divided by 8.

[0325] The average pixel value of the fourth block is 155, with a remainder of 3 when divided by 8. What needs to be embedded is 1. Therefore, subtract 2 from the grayscale value of the entire block, and the average pixel value of the new block reaches 153, reaching the state of having a remainder of 1 when divided by 8.

[0326] (10) Embed TextLength

[0327] In the 12 blocks from the fifth to the sixteenth obtained by column scanning, embed TextLegnth = [001001 001 001 001 001110 001 110 001 110 001] after adding error correction code

[0328] The remainders of the average pixel values of these blocks when divided by 8 are: 4, 2, 2, 3, 5, 5, 0, 6, 1, 7, 7, 0. Perform operations of -3, -1, -1, -2, -4, -4, +6, -5, +5, -6, -1, +1 on the pixel values of each block in turn.

[0329] (11) Embed TextData

[0330] The remaining L - 4 - k = 18209 blocks are rearranged according to the seed 4138 reordered by permutation. The top 336 blocks in the sorting are used as the payload. In this rearrangement order, 3 bits of information are embedded in each block, totaling 1008 bits. The modification of each block is carried out according to the image block modification strategy, and the process is the same as the embedding of ModeFlag, CodeFlag, and TextLength. As shown in the figure, the small blocks that are the payload positions of ModeFlag, CodeFlag, TextLength, and TextData are marked in black. Except for the 16 small blocks at the start of column scanning that are concentrated in the upper left corner, the other small blocks are evenly distributed at other positions in the image.

[0331] (12) The modified image is still stored in JPG format.

[0332] (13) When a user obtains an image containing hidden data, generally, the conventional extraction method is selected by default. The blocks are in column scanning order, and the pixel means obtained from the first and second blocks are 166 and 167 respectively, and the remainders modulo 8 are 6 and 7 respectively, which are decomposed into bit representations as [110 111]. Since there is no 111 in the error - correcting codeword, in the conventional extraction method, a valid ModeFlag cannot be extracted from the second block. At this time, the user is prompted: "This image does not contain hidden data, or the hidden data is damaged and cannot be correctly extracted."

[0333] (14) Select the keyword - field correction extraction method. The blocks are in column scanning order, and the pixel means obtained from the first and second blocks are 166 and 167 respectively, and the remainders modulo 8 are 6 and 7 respectively, which are decomposed into bit representations as [110 111]. Decoding operations are carried out according to the error - correcting code decoding rules: for the cases of (001) or (000) or (010), the bit 0 is taken as the decoding result; for the cases of (110) or (101) or (111), the bit 1 is taken as the decoding result. We get ModeFlag =

[11] . That is, it is known that the hidden data uses the fault - tolerant encryption mode.

[0334] (15) The pixel means obtained from the third and fourth blocks are 153 and 158 respectively, and the remainders modulo 8 are 1 and 6 respectively, which are decomposed into bit representations as [001 110]. Decoding operations are carried out according to the error - correcting code decoding rules: we get CodeFlag =

[01] . That is, it is known that the hidden data is in GBK code or a custom text encoding method. The embedded capacity is calculated to be 2276 bytes, and 12 bits are required to store the data byte length TextLength.

[0335] (16) The pixel means obtained from 12 blocks such as the fifth to the sixteenth are 153153 154 154 153 153 165 154 166 153 158 161

[0337] Modulo 8, we get the 3-bit codeword: [001 001 010 010 001 001 101 010 110 001 110 001]

[0338] Decoding: TextLength = [0 0 0 0 0 0 1 0 1 0 1 0]

[0339] Converting TextLength to an integer value equals 42, which indicates that there are 42 bytes of hidden data. In GBK code (or custom) encoding and fault tolerance mode, these 42 bytes of data are stored in 42×8=336 blocks.

[0340] (17) Since the data uses a fault-tolerant encryption mode, the user is required to enter a password. After the user enters the correct password "一二三abc", the key and scrambling seed are calculated. Under the GB18030 text encoding, the key length is less than 10 bytes, so the bit sequence corresponding to these 9 bytes is padded with 8 zeros to obtain an 80-bit key:

[0341] [110100101011101110110110111111101100100011111101011000010110001001100000000].

[0342] Take the integer value 4138 corresponding to the binary vector [0 1 0 0 0 0 0 0 1 0 1 0 1 0] concatenated by CodeFlag and TextLength as the scrambled sort seed.

[0343] (18) Sort the remaining L-16=18209 blocks obtained by column scanning, excluding the first 16 blocks, according to the scrambled sorting seed 4138, to obtain the sequence numbers of the top 336 blocks. Calculate the pixel mean of these blocks, and perform binary decomposition modulo 8 to obtain the bit sequence. Complete the decoding and obtain: [0010111011001100101001000111100001111111101001011010101010101000001101001101000111010000101000101100100111110111101000011000110110001101001011010101000011110001110101010100001110101010100001111000111010101010000111010101000 001111010110011110011011100111001000010100001110010101111011011011000111000110111100000100111100001010001001010111110110010101111110111110000100100001011001100110]

[0345] (19) Use the trivium algorithm and key to decrypt the data and get: [11001001101000001110000111110010111100101110100111110110110010110100000111010011110111010100000110000101110010111101010101110100111101110100111101001111010000011100000111000001 111101001010000010110001101100001011101010110000101100001010000011101111111011101010000011001010111000011110111011110101111000011111001011110010111100101000001011000110101110]

[0347] If the user does not input a custom encoding table, the incorrect text will be obtained by encoding with GBK code: 蔂狎绉粥犻顮洛殛押琮猿牨昂鞍狅确整理铛狎鶢碑.

[0348] If the user uses a custom code table, the correct text is obtained: I arrived in Beijing at 10:00 on January 1.

[0349] This embodiment uses pictures as carriers to transmit users' privacy information. The encryption algorithm and the custom coding table can ensure that only the data embedder and other trusted users who can share the secret key and the coding table can obtain the text information. Here, a JPG image is read, information is embedded, and then it is stored as a JPG image again. Such a process involves JPG recompression operations, but due to the use of error correction codes, the correct recovery of data can be guaranteed.

[0350] 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 foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A secure text hiding method compatible with multiple types of image carriers, characterized in that, Including: Step 1: Obtain a digital image and convert it to the pixel domain to obtain its corresponding pixel value matrix I; Step 2: Perform image block division on the pixel value matrix I to obtain a number of image blocks; Step 3: Determine the encoding type and embedding mode of the text to be embedded, and generate an encoding type identification field and an embedding mode identification field; the encoding type refers to any one of ASCII code, GBK code, GB18030 code, UTF-8 code, and user-defined encoding; The embedding mode refers to any one of the large-capacity mode, fault-tolerant mode, large-capacity encryption mode, and fault-tolerant encryption mode; among them, the large-capacity mode means that when the text to be embedded is not encrypted, each image block carries 3 bits of hidden data; the fault-tolerant mode means that when the text to be embedded is not encrypted, each image block carries 1 bit of hidden data and 2 bits of parity; the large-capacity encryption mode means that when the text to be embedded is encrypted, each image block carries 3 bits of hidden data; the fault-tolerant encryption mode means that when the text to be embedded is encrypted, each image block carries 1 bit of hidden data and 2 bits of parity; Step 4: Calculate the embedding capacity under this encoding type and this embedding mode; the embedding capacity refers to the maximum number of bytes occupied by the text that the pixel value matrix I can carry; specifically, in the large-capacity mode or the large-capacity encryption mode, if the encoding type is ASCII code, the embedding capacity if the encoding type is other types, the embedding capacity In the fault-tolerant mode or the fault-tolerant encryption mode, if the encoding type is ASCII code, the embedding capacity If the encoding type is other types, the embedding capacity Wherein, L represents the total number of image blocks, f represents the number of image blocks occupied by the two fields of the encoding type identification field and the embedding mode identification field, and k represents the number of image blocks occupied by the text length identification field; Step 5: Encode the text to be embedded under this encoding type and this embedding mode, calculate the length of the encoded text, and generate a text length identification field; Step 6: Generate hidden data according to the encoding type identification field, the embedding mode identification field, the encoded text, and the text length identification field; Step 7: Allocate the hidden data to the corresponding image blocks; Step 8: For the image blocks that need to embed hidden data, modify the image blocks according to the original pixel mean value of the image block and the hidden data to be embedded therein to obtain new image blocks; Step 9: Repeat Step 8 until all the image blocks that need to embed hidden data are modified. At this time, store all the image blocks in the original image format to obtain an image containing hidden data.

2. The secure text hiding method for compatible multi-type image carriers according to claim 1, characterized in that Step 5 also includes: Obtain the user password and encrypt the text to be embedded; correspondingly, encode the encrypted text to be embedded under this encoding type and this embedding mode; the user password uses the characters covered by the GBK code.

3. The security text hiding method for compatible multi-type image carriers according to claim 2, characterized in that, Use a stream symmetric encryption algorithm to encrypt the text to be embedded.

4. The secure text hiding method for compatible multi-type image carriers according to claim 2, characterized in that Step 7 specifically includes: Step 7.1: Sort all the image blocks in the order of column-by-column scanning; Step 7.2: Use the first f + k image blocks to store the first 3×(f + k) bits of the hidden data; Step 7.3: Set the seed of the pseudo-random number generator and generate pseudo-random numbers. The pseudo-random number generator is constructed by the Mersenne Twister algorithm; Step 7.3: Re-sort the remaining L - f - k image blocks according to the generated pseudo-random numbers; Step 7.4: In the way that each image block stores 3 bits of data, use the previous image blocks in turn to store the encoded text.

5. The security text hiding method compatible with multiple types of image carriers according to claim 4, characterized in that, In Step 7.3, the setting method of the seed of the pseudo-random number generator is: If the text to be embedded is not encrypted before encoding, or if the text to be embedded is encrypted before encoding but the length of the user password used does not exceed the set byte threshold, then use the integer corresponding to the binary number composed of the encoding type field and the text length field as the seed; If the text to be embedded is encrypted before encoding and the length of the user password used exceeds the set byte threshold, then use the integer corresponding to the part of the user password that exceeds the set byte threshold as the seed.

6. The security text hiding method compatible with multiple types of image carriers according to claim 1, characterized in that, Step 8 specifically includes: Step 8.1: Calculate the original pixel average value of the image block B(i,j) according to formula (1): Where, round represents the rounding operation, |B(i,j)| represents the number of pixel values in the image block B(i,j), i and j respectively represent the row and column where the image block is located, i1, j1, and t1 respectively represent the row, column, and channel where the pixel in the image block B(i,j) is located, and I(i1,j1,t1) represents the pixel value of the t1-th channel at the position of the i1-th row and j1-th column in the image block B(i,j); Step 8.2: Convert the steganographic data to be embedded in the image block B(i,j) into an integer d with a value range of 0 to 7; Step 8.3: Compare whether d and (I mean )8 are equal. If they are equal, no modification is made to the image block B(i, j). If they are not equal, the original pixel value I(i1, j1, t1) is modified to the new pixel value I(i1, j1, t1)′, that is: I(i1, j1, t1) ′ = I(i1, j1, t1) - (I mean )8 + d; where, (I mean )8 represents the remainder obtained by dividing I mean by 8.

7. The secure text hiding method for compatible multi-type image carriers according to claim 6, characterized in that, It also includes: Step 8.4: If the new pixel value I(i1, j1, t1) ′ is greater than 255, then set I(i1, j1, t1) ′ = 255; if the new I(i1, j1, t1) ′ is less than 0, then set I(i1, j1, t1) ′ = 0; Step 8.5: Return to Step 8.1 to recalculate I mean , and execute Step 8.3 again. If they are equal, then the image block B(i,j) has completed the modification.

8. A secure text extraction method compatible with multiple types of image carriers, applied to the secure text hiding method according to any one of claims 1 to 7, characterized in that, Including: Step 1: Read the image containing steganographic data; the steganographic data is generated according to the encoding type identification field, the embedding mode identification field, the encoded text, and the text length identification field; Step 2: Divide the image into blocks, and determine the image blocks where the encoding type identification field and the embedding mode identification field are located from all the image blocks; And read the encoding type and embedding mode of the embedded text from the image blocks; Step 3: Calculate the embedding capacity under this encoding type and this embedding mode; the embedding capacity refers to the maximum number of bytes occupied by the text that the pixel value matrix I can carry; Step 4: Calculate the image block where the text length identification field is located according to the embedding capacity, and read the length of the embedded text from the image block; Step 5: Calculate the image block where the embedded text is located according to the length of the embedded text, and read the encoded embedded text from the image block; Step 6: Decode the encoded embedded text according to the encoding type to obtain the embedded text.

Citation Information

Patent Citations

  • Improvements in boilers and the like water heating apparatus

    GB180303A

  • JPEG image information hiding based private information communication method and system

    CN105426709A

  • Separable encryption domain reversible information hiding method based on nearest neighbor pixel prediction

    CN114374774A