Information hiding method and system in information security

By selecting the carrier channel in the RGB channel and embedding information using kernel matrix adjustment, the problem of poor robustness of LSB image watermarking is solved, achieving rapid information hiding while improving robustness and attack resistance.

CN118643477BActive Publication Date: 2026-07-24SHANGHAI JINLIFENG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI JINLIFENG INFORMATION TECHNOLOGY CO LTD
Filing Date
2024-06-18
Publication Date
2026-07-24

Smart Images

  • Figure CN118643477B_ABST
    Figure CN118643477B_ABST
Patent Text Reader

Abstract

The application provides an information hiding method and system in information security, comprising: calculating mean square deviations of adjacent pixel value corresponding pixel points in three channel histograms respectively, taking a channel image with the minimum mean square deviation as a carrier channel image; encrypting information to be hidden to obtain an encrypted string, and converting the string into binary data; determining a size of a kernel matrix, the kernel matrix being used to traverse the carrier channel image according to a preset step length, and calculating a pixel point closest to a pixel value in an overlapping area of the kernel matrix and the carrier channel image; determining a moving number of the kernel matrix on the carrier channel image, and establishing a corresponding relationship between the moving number and the binary data; and adjusting the pixel point in the overlapping area according to the binary data. The application can effectively hide the hidden information in a digital image, and has high robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security, and in particular to a method and system for information hiding based on digital images. Background Technology

[0002] Information security encompasses encryption / decryption, intrusion detection, virus protection, and digital watermarking. Digital watermarking embeds important information into digital products, with its most widespread application being image watermarking. Digital watermarking can protect the copyright of digital products and also hide information. There are various existing methods for hiding information in images, such as LSB, DCT, and DWT. LSB was the earliest image watermarking method, offering fast and simple computation. It primarily hides information in the lowest-order bits, but LSB has relatively poor robustness and is easily compromised. The key to information hiding lies in improving robustness while quickly hiding information. Summary of the Invention

[0003] To address the technical problems raised in the background section, this invention first provides an information hiding method in information security, the method comprising the following steps:

[0004] S1, Obtain the carrier image, obtain the histogram of the three RGB channels of the carrier image, calculate the mean square error of the number of pixels corresponding to adjacent pixel values ​​in the histogram of the three channels respectively, and take the channel image with the smallest mean square error as the carrier channel image.

[0005] S2, encrypt the hidden information to obtain the encrypted string, convert the string into binary data; determine the size of the kernel matrix, the kernel matrix is ​​used to traverse the carrier channel image according to a preset step size, and calculate the pixel point with the closest pixel value in the overlapping area of ​​the kernel matrix and the carrier channel image;

[0006] S3, determine the number of times the kernel matrix moves on the carrier channel image, and establish the correspondence between the number of moves and the binary data; when the binary data is 1, if the difference between the closest pixels is greater than zero, the kernel matrix moves to the next position; otherwise, the values ​​of the pixels in the overlapping areas of the image are adjusted to be different, and then the kernel matrix moves to the next position; when the binary data is 0, if the difference between the closest pixels is equal to zero, the kernel matrix moves to the next position; otherwise, the values ​​of the closest pixels are adjusted to be the same, and then the kernel moves to the next position.

[0007] Preferably, the step of encrypting the information to be hidden to obtain the encrypted string specifically involves:

[0008] The difference between the average pixel values ​​of the non-carrier channel image is calculated, and the absolute value of the difference is used to perform MD5 calculation to obtain a 16-bit sequence. The 16-bit sequence is appended to the information to be hidden to obtain the information string to be hidden. The information string to be hidden is then encrypted to obtain the encrypted string.

[0009] Preferably, determining the size of the kernel matrix specifically involves:

[0010] Obtain the number of pixels M in the carrier channel image and the length L of the binary data, and calculate k such that 2k+1 is less than and closest to The size of the kernel is 2k+1, where M, L, and k are positive integers.

[0011] Preferably, adjusting the pixel values ​​of overlapping areas of the image to be different specifically involves:

[0012] Obtain the sequence of pixels with the same pixel value. If the sequence length N is even, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 1, -1, ..., -(N / 2-1), -N / 2]. If the sequence length N is odd, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 0, ..., -(N / 2-1), -N / 2].

[0013] Preferably, after step S3, the method further includes:

[0014] S4, merge the channel containing the information to be hidden with other non-carrier channels to obtain an RGB image containing the information to be hidden.

[0015] In addition, the present invention also provides an information hiding system in information security, the system comprising the following modules:

[0016] The carrier channel image acquisition module is used to acquire a carrier image, obtain the histograms of the three RGB channels of the carrier image, calculate the mean square error of the number of pixels corresponding to adjacent pixel values ​​in the histograms of the three channels respectively, and take the channel image with the smallest mean square error as the carrier channel image.

[0017] The kernel matrix module is used to encrypt the information to be hidden to obtain an encrypted string, convert the string into binary data, determine the size of the kernel matrix, which is used to traverse the carrier channel image according to a preset step size, and calculate the pixel with the closest pixel value in the overlapping area of ​​the kernel matrix and the carrier channel image.

[0018] The hidden module is used to determine the number of times the kernel matrix moves on the carrier channel image and establish a correspondence between the number of moves and the binary data. When the binary data is 1, if the difference between the closest pixels is greater than zero, the kernel matrix moves to the next position; otherwise, the values ​​of the pixels in the overlapping areas of the image are adjusted to be different, and then the kernel matrix moves to the next position. When the binary data is 0, if the difference between the closest pixels is equal to zero, the kernel matrix moves to the next position; otherwise, the values ​​of the closest pixels are adjusted to be the same, and then the kernel matrix moves to the next position.

[0019] Preferably, the step of encrypting the information to be hidden to obtain the encrypted string specifically involves:

[0020] The difference between the average pixel values ​​of the non-carrier channel image is calculated, and the absolute value of the difference is used to perform MD5 calculation to obtain a 16-bit sequence. The 16-bit sequence is appended to the information to be hidden to obtain the information string to be hidden. The information string to be hidden is then encrypted to obtain the encrypted string.

[0021] Preferably, determining the size of the kernel matrix specifically involves:

[0022] Obtain the number of pixels M in the carrier channel image and the length L of the binary data, and calculate k such that 2k+1 is less than and closest to The size of the kernel is 2k+1, where M, L, and k are positive integers.

[0023] Preferably, adjusting the pixel values ​​of overlapping areas of the image to be different specifically involves:

[0024] Obtain the sequence of pixels with the same pixel value. If the sequence length N is even, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 1, -1, ..., -(N / 2-1), -N / 2]. If the sequence length N is odd, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 0, ..., -(N / 2-1), -N / 2].

[0025] Finally, the present invention also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor to perform the method described above.

[0026] Furthermore, the present invention also provides a computer device including a readable storage medium on which a computer program is stored, the computer program being executed by a processor to perform the method described above.

[0027] This invention determines the information-hiding channel from the three RGB channels as the carrier channel. Then, it iterates through the carrier channel in units of kernels, integrating the information to be hidden into the carrier channel during this process. Specifically, the information to be loaded is determined based on the distribution of pixel values ​​of pixels in the overlapping portion of the kernel and the carrier channel. Since each overlapping portion includes multiple pixels from the carrier channel, the pixel values ​​in the overlapping portion are not entirely identical. Furthermore, to embed information, only a few pixel values ​​need to be changed, or none at all, resulting in minimal impact on image quality. Moreover, when attacked, for the hidden bit 0, the value of all pixels in the overlapping region must be changed to be different; for the hidden bit 1, the value of at least two pixels in the overlapping region must be changed to be the same. Attached Figure Description

[0028] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0029] Figure 1 This is a flowchart of one embodiment of the present invention;

[0030] Figure 2 This is a schematic diagram of the RGB three-channel histogram of an image;

[0031] Figure 3 This is a schematic diagram of the carrier channel image and the kernel;

[0032] Figure 4 Comparison images before and after adding hidden information. Detailed Implementation

[0033] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to explain the invention only, and should not be construed as limiting the invention. Rather, embodiments of the present invention include all variations, modifications, and equivalents falling within the spirit and scope of the appended claims.

[0034] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means "or more."

[0035] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including in a manner that is either simultaneous or in reverse order of the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.

[0036] Figure 1 A flowchart of an information hiding method in information security provided by the present invention includes the following:

[0037] S1, acquire a carrier image, obtain the histograms of the three RGB channels of the carrier image, calculate the mean square error of the histograms of the three channels respectively, and take the channel image with the smallest mean square error as the carrier channel image.

[0038] The image contains three channels: R, G, and B. The pixel values ​​in each channel are between 0 and 255. Calculate the histogram for each of the three channels. Figure 2 An example of a histogram is shown, with three histograms representing the R, G, and B channels, respectively. The horizontal axis of the histogram ranges from 0 to 255, representing the pixel value, while the vertical axis represents the number of corresponding pixels. The more pixels a pixel value corresponds to, the larger the vertical axis. For most images, a smaller mean square error in the histogram indicates a more uniform pixel distribution, which is beneficial for embedding hidden information. The mean square error is calculated as follows: Where p i This represents the number of pixels with pixel value i in the histogram. This represents the average number of pixels in the carrier image per pixel value. Where M represents the number of pixels in the carrier image.

[0039] In another embodiment, the mean square error of the three channel histograms is calculated separately, specifically by calculating the number of pixels corresponding to adjacent pixel values ​​in each of the three channel histograms. Where p i This represents the number of pixels with pixel value i in the histogram.

[0040] S2, encrypt the hidden information to obtain the encrypted string, convert the string into binary data; determine the size of the kernel matrix, the kernel is used to traverse the carrier channel image according to a preset step size, and calculate the pixel point with the closest pixel value in the overlapping area of ​​the kernel and the carrier channel image;

[0041] The information to be hidden, for example, is the string "abc". After AES encryption, the string becomes U2FsdGVkX1 / 1IT4VgWMyEPBhKILe2IxJ5FDNhmBcr5g=, which is converted to binary data as 1010101110010100011011100111100100… In another embodiment, a stop character, such as \0, is added to the end of the encrypted string.

[0042] The kernel described in this invention is similar to the convolution kernel, such as... Figure 3 As shown, however, the kernel in this invention is used to sort the regions that overlap with the kernel, and then the closest pixel in the overlapping region is obtained based on the sorting result. Specifically, if the values ​​of the closest pixels are different, only that pixel needs to be obtained; if multiple pixels have the same value, all pixels with the same value are obtained.

[0043] S3, determine the number of times the kernel moves on the carrier channel image, and establish the correspondence between the number of moves and the binary data; when the binary data is 1, if the difference between the closest pixels is greater than zero, the kernel moves to the next position; otherwise, adjust the values ​​of the pixels in the overlapping area of ​​the image to be different, and then the kernel moves to the next position; when the binary data is 0, if the difference between the closest pixels is equal to zero, the kernel moves to the next position; otherwise, adjust the values ​​of the closest pixels to be the same, and then the kernel moves to the next position.

[0044] The kernel is moved on the carrier channel image according to a preset step size to establish a correspondence between the number of moves and the binary data. Taking 1010101110010100011011100111100100… as an example, the 0th move corresponds to 1, the first move corresponds to 0, the second move corresponds to 1, and so on, until all 1010101110010100011011100111100100… are associated with the number of moves.

[0045] During encoding, if the value to be encoded is 1, then if there are identical pixels in the overlapping area, adjust them to make the pixels in the overlapping area different; otherwise, leave it unchanged and slide to the next area. If the value to be encoded is 0, then if there are no identical pixels in the overlapping area, adjust them so that the two closest pixels have the same value; otherwise, leave it unchanged and slide to the next area. Adjusting the values ​​of the two closest pixels to be the same minimizes the impact on the pixel and the color change. For example, if the values ​​are 73 and 75, then both will be adjusted to 74.

[0046] Since attackers may attack or tamper with images outside the carrier channel, in order to verify whether the image has been altered, in one embodiment, the process of encrypting the hidden information to obtain an encrypted string specifically involves:

[0047] The difference between the average pixel values ​​of the non-carrier channel image is calculated, and the absolute value of the difference is used to perform MD5 calculation to obtain a 16-bit sequence. The 16-bit sequence is appended to the information to be hidden to obtain the information string to be hidden. The information string to be hidden is then encrypted to obtain the encrypted string.

[0048] In one specific embodiment, the carrier channel image is the B channel, and the non-carrier channel images are the R and G channels. The average pixel values ​​of the two channels are calculated. If the average pixel value of the R channel is 78 and the average pixel value of the G channel is 98, then the absolute value of the difference between the two is 20. This 20 is then subjected to MD5 hashing to obtain a 16-bit sequence. This 16-bit sequence is appended to the information to be hidden, "abc," and then encrypted to obtain the encrypted string. Thus, if other users modify the non-carrier channel, the specific value of the 16-bit sequence will change.

[0049] The size of each kernel relates to the amount of information encoded into the carrier channel image. If the kernel is too large, less information is encoded, and multiple identical pixels appear, which is detrimental to subsequent encoding. If the kernel is too small, the carrier channel image is not fully utilized. In a specific embodiment, determining the kernel size specifically involves:

[0050] Obtain the number of pixels M of the carrier channel image and the length L of the binary data, and calculate k such that 2k+1 is less than and closest to The size of the kernel matrix is ​​2k+1, where M, L, and k are positive integers. If the number of pixels is 400×400 and the binary length is 1000, then the closest 2k+1 to 12.6 is k=5, and the size of the kernel matrix is ​​11×11. In a specific embodiment, the specified step size is 2K+1, and during decryption, the step size can be determined solely based on the kernel size.

[0051] Preferably, adjusting the pixel values ​​of overlapping areas of the image to be different specifically involves:

[0052] Obtain the sequence of pixels with the same pixel value. If the sequence length N is even, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 1, -1, ..., -(N / 2-1), -N / 2]. If the sequence length N is odd, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 0, ..., -(N / 2-1), -N / 2].

[0053] Preferably, after step S3, the method further includes:

[0054] S4, merge the channel containing the information to be hidden with other non-carrier channels to obtain an RGB image containing the information to be hidden.

[0055] During decoding, since the changes to the carrier channel images are minimal, the mean square error of the histograms of the three channels is first calculated. The channel image with the smallest mean square error is selected as the channel image to be decrypted. Multiple kernels are set up. For each kernel, the binary representation of the overlapping portion between the kernel and the channel image to be decrypted is determined (whether it is 0 or 1). The resulting binary string is converted into a string, and then decryption is performed on the string. Because the kernel size is unknown during decryption, multiple kernels are set up for trial and error, which also increases information security.

[0056] Example 2: The present invention also provides an information hiding system for information security, the system comprising the following modules:

[0057] The carrier channel image acquisition module is used to acquire a carrier image, obtain the histograms of the three RGB channels of the carrier image, calculate the mean square error of the number of pixels corresponding to adjacent pixel values ​​in the histograms of the three channels respectively, and take the channel image with the smallest mean square error as the carrier channel image.

[0058] The kernel matrix module is used to encrypt the information to be hidden to obtain an encrypted string, convert the string into binary data, determine the size of the kernel matrix, the kernel is used to traverse the carrier channel image according to a preset step size, and calculate the pixel point with the closest pixel value in the overlapping area of ​​the kernel and the carrier channel image;

[0059] A hidden module is used to determine the number of times the kernel matrix moves on the image channel to be processed, and to establish a correspondence between the number of moves and the binary data. When the binary data is 1, if the difference between the closest pixels is greater than zero, the kernel moves to the next position; otherwise, the values ​​of the pixels in the overlapping areas of the image are adjusted to be different, and then the kernel matrix moves to the next position. When the binary data is 0, if the difference between the closest pixels is equal to zero, the kernel matrix moves to the next position; otherwise, the values ​​of the closest pixels are adjusted to be the same, and then the kernel matrix moves to the next position.

[0060] Preferably, the step of encrypting the information to be hidden to obtain the encrypted string specifically involves:

[0061] The difference between the average pixel values ​​of the non-carrier channel image is calculated, and the absolute value of the difference is used to perform MD5 calculation to obtain a 16-bit sequence. The 16-bit sequence is appended to the information to be hidden to obtain the information string to be hidden. The information string to be hidden is then encrypted to obtain the encrypted string.

[0062] Preferably, determining the size of the kernel matrix specifically involves:

[0063] Obtain the number of pixels M of the carrier channel image and the length L of the binary data, and calculate k such that 2k+1 is less than and closest to The size of the kernel matrix is ​​2k+1, where M, L, and k are positive integers.

[0064] Preferably, adjusting the pixel values ​​of overlapping areas of the image to be different specifically involves:

[0065] Obtain the sequence of pixels with the same pixel value. If the sequence length N is even, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 1, -1, ..., -(N / 2-1), -N / 2]. If the sequence length N is odd, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 0, ..., -(N / 2-1), -N / 2].

[0066] Finally, the present invention also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor as described in Embodiment 1.

[0067] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example encompasses at least one embodiment or example of the invention. In this specification, illustrative expressions of the terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0068] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for information hiding in information security, characterized in that, The method includes the following steps: S1, Obtain the carrier image, obtain the histogram of the three RGB channels of the carrier image, calculate the mean square error of the number of pixels corresponding to adjacent pixel values ​​in the histogram of the three channels respectively, and take the channel image with the smallest mean square error as the carrier channel image. S2, encrypt the hidden information to obtain the encrypted string, convert the string into binary data; determine the size of the kernel matrix, the kernel matrix is ​​used to traverse the carrier channel image according to a preset step size, and calculate the pixel point with the closest pixel value in the overlapping area of ​​the kernel matrix and the carrier channel image; S3, determine the number of times the kernel matrix moves on the carrier channel image, and establish the correspondence between the number of moves and the binary data; when the binary data is 1, if the difference between the closest pixels is greater than zero, the kernel matrix moves to the next position; otherwise, the values ​​of the pixels in the overlapping areas of the image are adjusted to be different, and then the kernel matrix moves to the next position; when the binary data is 0, if the difference between the closest pixels is equal to zero, the kernel moves to the next position; otherwise, the values ​​of the closest pixels are adjusted to be the same, and then the kernel matrix moves to the next position. The process of encrypting the information to be hidden to obtain an encrypted string specifically involves: calculating the difference between the average pixel values ​​of the non-carrier channel images, performing MD5 calculation on the absolute value of the difference to obtain a 16-bit sequence, appending the 16-bit sequence to the information to be hidden to obtain a string of information to be hidden, and then encrypting the string of information to be hidden to obtain an encrypted string.

2. The method as described in claim 1, characterized in that, The determination of the size of the kernel matrix is ​​specifically as follows: Obtain the number of pixels M of the carrier channel image and the length L of the binary data, and calculate k such that 2k+1 is less than and closest to The size of the kernel matrix is ​​2k+1, where M, L, and k are positive integers.

3. The method as described in claim 1, characterized in that, The step of adjusting the pixel values ​​of overlapping regions of the image to be different is specifically as follows: Obtain the sequence of pixels with the same pixel value. If the sequence length N is even, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 1, -1, ..., -(N / 2-1), -N / 2]. If the sequence length N is odd, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 0, ..., -(N / 2-1), -N / 2].

4. The method according to any one of claims 1-3, characterized in that, Following S3, the following is also included: S4, merge the carrier channel image containing the information to be hidden with other non-carrier channels to obtain an RGB image containing the information to be hidden.

5. An information hiding system for information security, characterized in that, The system includes the following modules: The carrier channel image acquisition module is used to acquire a carrier image, obtain the histograms of the three RGB channels of the carrier image, calculate the mean square error of the number of pixels corresponding to adjacent pixel values ​​in the histograms of the three channels respectively, and take the channel image with the smallest mean square error as the carrier channel image. The kernel matrix module is used to encrypt the information to be hidden to obtain the encrypted string, and then convert the string into binary data. The kernel matrix size is determined, and the kernel matrix is ​​used to traverse the carrier channel image according to a preset step size, and to calculate the pixel point with the closest pixel value in the overlapping area of ​​the kernel matrix and the carrier channel image; A hidden module is used to determine the number of times the core moves on the carrier channel image and to establish a correspondence between the number of moves and the binary data; When the binary data is 1, if the difference between the nearest pixels is greater than zero, the kernel matrix moves to the next position; otherwise, the values ​​of the pixels in the overlapping areas of the image are adjusted to be different, and then the kernel matrix moves to the next position. When the binary data is 0, if the difference between the nearest pixel and the nearest pixel is zero, the kernel matrix moves to the next position; otherwise, the values ​​of the nearest pixels are adjusted to be the same, and then the kernel matrix moves to the next position. The process of encrypting the information to be hidden to obtain an encrypted string specifically involves: calculating the difference between the average pixel values ​​of the non-carrier channel images, performing MD5 calculation on the absolute value of the difference to obtain a 16-bit sequence, appending the 16-bit sequence to the information to be hidden to obtain a string of information to be hidden, and then encrypting the string of information to be hidden to obtain an encrypted string.

6. The system as described in claim 5, characterized in that, The determination of the size of the kernel matrix is ​​specifically as follows: Obtain the number of pixels M of the carrier channel image and the length L of the binary data, and calculate k such that 2k+1 is less than and closest to The size of the kernel is 2k+1, where M, L, and k are positive integers.

7. The system as described in claim 5, characterized in that, The step of adjusting the pixel values ​​of overlapping regions of the image to be different is specifically as follows: Obtain the sequence of pixels with the same pixel value. If the sequence length N is even, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 1, -1, ..., -(N / 2-1), -N / 2]. If the sequence length N is odd, add the pixel sequence to the sequence [N / 2, N / 2-1, ..., 0, ..., -(N / 2-1), -N / 2].