Keywords

1 Introduction

Steganography is the art and science of hidden data communication. Many data hiding schemes [110] are developed in last few decades. Some of them [6, 9, 10] are better in terms of security and imperceptibility. The data hiding schemes are useful in many application areas to solve the problem of ownership identification, copyright protection, authentication, verification, and more. The main aims of data hiding schemes are to ensure extraction of secret data and recovery of original object from stego media. On the other hand, data should stay hidden in stego image even if the eavesdropper tampered the stego or degrading through natural phenomenon like transmission resampling, compression or filtering, etc. The main drawbacks of data hiding schemes are not to provide a good solution in such cases. The degree of distortion will be high due to increase of data embedding capacity that should be balanced mathematically using spread spectrum. The data embedding in color image is considered to be more unsuspicious and secured, and less exploration has been done till today in this research area using hamming code.

Data hiding through matrix coding has been introduced by Crandall [2], and Westfield [7] implemented F5 algorithm based on matrix encoding using hamming code. Kim and Shin [8] suggested a data embedding procedure for halftone image. The scheme provides good capacity but poor visual quality. Based on matrix encoding, ‘Hamming +1’ method has been developed by Zhang et al. [3]. The embedding capacity is increased in ‘Hamming +1’ scheme by \( \frac{{{\text{k}} + 1}}{{2^{\text{k}} }} \) bpp. Chang [5] suggested an improved data embedding procedure using Hamming code which can hide (k + 1) bits of message in \( 2^{\text{k}} \) pixels with at most one change. Kim and Yang [9] developed ‘Hamming + 3’ data hiding scheme which can embed k + 3 bits within \( 2^{\text{k}} - 1 \) pixels by at most two change. In 2016, Cao et al. [10] proposed their algorithm which can preserve stego image quality under high embedding capacity. The visual quality and data embedding capacity of Cao et al. are 37.90 dB PSNR and payload 3 bpp, respectively. Also Jana et al. [11] proposed reversible data hiding scheme through dual image with 53 dB PSNR and payload 0.14 bpp. After studying this literature, we have found that there is a chance to improve data embedding capacity and visual quality through Hamming code for color images. Here, we have proposed an improved information hiding scheme using (7, 4) Hamming code for color images. We have divided R, G, and B color pixels in bit-plane [12] starting from LSB to LSB-3 (up to four bit-plane) into (3 × 3) blocks and then applied hamming code-based data hiding scheme. In this scheme, 36 bits are embedded within 9 pixels which are more higher than other existing hamming code-based scheme, and in parallel, it maintains high visual quality.

2 Motivation and Objectives

  1. 1.

    Till date, data embedding algorithms are implemented and tested using grayscale images. But, we have implemented hamming code-based data hiding scheme for color images using basic color channel (that is R, G, and B) and their bit-plane.

  2. 2.

    We have introduced the concept of bit-plane. That means each R, G, and B color pixels are divided into four bit-plane starting from LSB to LSB-3.

  3. 3.

    Using Hamming code, Cao et al. [10] achieved data hiding scheme up to 3 bpp payload. But we have implemented our proposed algorithm for 4 bpp where the value of PSNR is always greater than 39 dB.

3 Proposed Method

I is considered as the cover image of size (M × N), and I′ is the marked image with data D = {d1, …, dX} are embedded, where di ∈ {0, 1}, 1 ≤ i ≤ X. Here, H is a parity check matrix of the Hamming code. Let H is

$$ H = \left| {\begin{array}{*{20}c} 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 \\ \end{array} } \right|, $$

Embedding capacity is an important metric for data embedding. It is measured by how many secret bits can be embedded into a cover image. The embedding capacity is calculated as [10] \( ER = L/M\, \times \,N\,bpp \), where L is the length of the secret message.

Before embedding the secret data, we take 36-bit secret key k1 which is known to both the sender and the receiver, to encrypt the secret data bit using symmetric key encryption. We have taken each pixel block of size (3 × 3), and four bit-plane of each pixel is used to embed the data, which result in (3 × 3) × 4 = 36 bits of data (D1) in one iteration. As an additional security measure, instead of choosing the cover image pixel block serially, we will use pseudo random number generator (PRNG) function with a secret predefined seed k2 (which is only known to the sender and the receiver) to determine the next available block for embedding. Since this seed will be known to the sender and receiver only, the generated unique pattern of pixel block selection can be used in embedding and extraction process securely. The data embedding procedure is enlisted in Algorithm 1, and the data extraction procedure is depicted in Algorithm 2.

Algorithm 1: Data embedding process

Input: Color cover image I (M × N), secret data bits D, Hamming matrix H, secret key k1, and seed value k2

Output: A stego image I′ (M × N).

  • Step 1: Collect random sequence of pixel blocks of size 3 × 3 from IM × N using PRNG (k2). Say the pixel blocks are X1, X2, …, XMN.

  • Step 2: Convert Xi into three separate RGB color blocks XiR, XiG, XiB.

  • Step 3: Convert each Xi ‘s into binary form.

  • Step 4: Perform bit-plane slicing of each Xi ‘s up to four bit-plane starting from LSB that is XiR(LSB), XiR(LSB-1), XiR(LSB-2), XiR(LSB-3).

  • Step 5: Take c = XiR(LSB) and calculate the syndrome S1 = (H × (c)T)T.

  • Step 6: Perform D1′ = (D1 ⊕ k1); k1 = 36 bit length and D1 is also same length

  • Step 7: Take three bits secret data di = {d1, d2, d3} from D1′ where di ∈ {0, 1}.

  • Step 8: Calculate S2 = (di ⊕ S1); if S2 = 0, no change, otherwise flip a bit at the positional value of S2 and generate H′.

  • Step 9: Compute S3 = (H′ ⊕ c) and store the data.

  • Step 10: Replace the matrix(c) with S3 and update XiR(LSB).

  • Step 11: Repeat Step 4–10 using XiR(LSB-1), XiR(LSB-2), and XiR(LSB-3).

  • Step 12: Repeat Step 5–11 to embed secret data on XiG and XiB color blocks.

  • Step 13: Repeat Step 2–12 to embed secret data on each and every random sequence of (Xi′s) of pixel blocks.

  • Step 14: Finally, after combining each stego block, we get stego image (I′) of size (M × N).

  • Step 15: End.

Algorithm 2: Data extraction process

Input: Stego image I′(M × N), Hamming matrix H, secret key k1, and seed value k2

Output: Original secret message D.

  • Step 1: Use PRNG with predetermined seed k2 to determine the stego pixel of random sequence X′i of size [3 × 3] from stego image I′.

  • Step 2: Separate RGB components into X′iR, X′iG, X′iB.

  • Step 3: Convert into binary form of each X′iR, X′iG, X′iB.

  • Step 4: Perform four bit-plane slicing of each X′i ‘s starting from LSB, that is, X′iR(LSB), X′iR(LSB-1), X′iR(LSB-2), X′iR(LSB-3).

  • Step 5: Take c′ = X′iR(LSB) and calculate the syndrome S′ = (H × (c′)T)T.

  • Step 6: Concatenate syndrome S′ with data unit of D′, that is, D′ = D′ || (S′).

  • Step 7: Repeat Step 4–6 using X′iG and X′iB.

  • Step 8: Compute Di = D′ ⊕ k1.

  • Step 9: Repeat Step 2–8 using next random sequence of Xi block.

  • Step 10: Concatenate Di ‘s, we get original secret message D.

  • Step 11: End.

The original color image is divided into R, G, and B color image as shown in Fig. 1. Then every color image is divided into (3 × 3) RGB color pixels. Then the secret bits are embedded within the image pixels. The stego (3 × 3) RGB color pixels are generated. After that, the color pixels are combined and formed the stego image of Lenna which is also (512 × 512) pixels.

Fig. 1.
figure 1

Pictorial diagram of the proposed data hiding scheme

3.1 Numerical Illustration

Example 3.1.1: Data embedding

  1. 1.

    Let I be a color image block with (3 × 3) pixel. D = {d1, d2, …, d36} = {0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0}. k1 = {0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1,0, 1, 0, 1, 0, 1, 0} and ER = 36/(3 × 3) = 4 bpp and the cover image pixels are as follows:

$$ I_{3 \times 3} = \left| {\begin{array}{*{20}c} {9277330} & {9276816} & {9277072} \\ {9276816} & {9343124} & {9343381} \\ {9211793} & {9409173} & {9409173} \\ \end{array} } \right| $$

and D′ = D ⊕ k1 = {0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}

  1. 2.

    Divide into three RGB image pixel blocks as shown below.

$$ R = \left| {\begin{array}{*{20}c} {141} & {141} & {141} \\ {141} & {142} & {142} \\ {140} & {143} & {143} \\ \end{array} } \right|\quad \text{G} = \left| {\begin{array}{*{20}c} {143} & {141} & {142} \\ {141} & {144} & {145} \\ {143} & {146} & {147} \\ \end{array} } \right|\quad \text{B = }\left| {\begin{array}{*{20}c} {147} & {145} & {145} \\ {145} & {149} & {150} \\ {146} & {150} & {151} \\ \end{array} } \right| $$
  1. 3.

    Take red image pixel block and transform into binary number matrix.

$$ \text{R} = \left| {\begin{array}{*{20}c} {10001101} & {10001101} & {10001101} \\ {10001101} & {10001110} & {10001110} \\ {10001100} & {10001111} & {10001111} \\ \end{array} } \right| $$
  1. 4.

    Divide it into four bit-plane matrices starting from LSB.

$$ \begin{array}{*{20}c} {R_{LSB} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 1 \\ \end{array} } \right|} & {R_{LSB - 1} = \left| {\begin{array}{*{20}c} 0 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 1 & 1 \\ \end{array} } \right|} \\ {R_{LSB - 2} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \\ \end{array} } \right|} & {R_{LSB - 3} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \\ \end{array} } \right|} \\ \end{array} $$
  1. 5.

    Read the LSB matrix and form a 1D matrix. c = [1 1 1 1 0 0 0 1 1]

  2. 6.

    Calculate the syndrome \( S_{1} = H\, \times \,\left( c \right)^{T} = \left| {\begin{array}{*{20}c} 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 \\ \end{array} } \right|\, \times \,\left| {\begin{array}{*{20}c} 1 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 1 \\ \end{array} } \right|^{T} = \left| {\begin{array}{*{20}c} 1 \\ 0 \\ 1 \\ \end{array} } \right| \)

  3. 7.

    Transpose the syndrome and XOR with the secret data bit, i.e., [1 0 1] ⊕ [0 1 1] = [1 1 0] which match with the fifth column of Hamming matrix.

  4. 8.

    Generate the code H′ = [0 0 0 0 1 0 0 0 0] and XOR with the original code c.

S3 = [1 1 1 1 0 0 0 1 1] ⊕ [0 0 0 0 1 0 0 0 0] = [1 1 1 1 1 0 0 1 1].

  1. 9.

    Transform into a new LSB matrix.

$$ R^{{\prime }}_{LSB} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1 \\ \end{array} } \right| $$
  1. 10.

    Similarly, compute the LSB-1, LSB-2, and LSB-3 matrices as follows:

$$ R^{{\prime }}_{LSB - 1} = \left| {\begin{array}{*{20}c} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \\ \end{array} } \right|\quad R^{{\prime }}_{LSB - 2} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 0 \\ \end{array} } \right|\quad R^{{\prime }}_{LSB - 3} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 1 & 1 & 1 \\ \end{array} } \right| $$
  1. 11.

    Update all four modified binary matrices to their corresponding position in original red pixel matrix.

$$ R^{{\prime }}_{3 \times 3} = \left| {\begin{array}{*{20}c} {10001101} & {10001101} & {10001101} \\ {10000101} & {10001111} & {10001100} \\ {10001100} & {10001111} & {10001011} \\ \end{array} } \right| = \left| {\begin{array}{*{20}c} {141} & {141} & {141} \\ {133} & {143} & {140} \\ {140} & {143} & {139} \\ \end{array} } \right| $$
  1. 12.

    Similarly, get updated green and blue pixel matrices.

$$ G^{{\prime }}_{3 \times 3} = \left| {\begin{array}{*{20}c} {143} & {141} & {134} \\ {143} & {144} & {149} \\ {143} & {146} & {146} \\ \end{array} } \right|\quad B^{{\prime }}_{3 \times 3} = \left| {\begin{array}{*{20}c} {147} & {145} & {149} \\ {145} & {149} & {150} \\ {147} & {156} & {151} \\ \end{array} } \right| $$
  1. 13.

    Finally, the stego image block will be \( I^{{\prime }}_{3 \times 3} = \left| {\begin{array}{*{20}c} {9277330} & {9276816} & {9275028} \\ {8753040} & {9408660} & {9213333} \\ {9211794} & {9409179} & {9409179} \\ \end{array} } \right| \)

Example 3.1.2: Data extraction

  1. 1.

    The marked image sized I′ of size 3 × 3 is shown below

$$ I^{{\prime }} = \left| {\begin{array}{*{20}c} {9277330} & {9276816} & {9275028} \\ {8753040} & {9408660} & {9213333} \\ {9211794} & {9409179} & {9409179} \\ \end{array} } \right| $$
  1. 2.

    Divide into three RGB image pixel blocks.

$$ R = \left| {\begin{array}{*{20}c} {141} & {141} & {141} \\ {133} & {143} & {140} \\ {140} & {143} & {139} \\ \end{array} } \right|\quad G = \left| {\begin{array}{*{20}c} {143} & {141} & {134} \\ {143} & {144} & {149} \\ {143} & {146} & {146} \\ \end{array} } \right|\quad \text{B} = \left| {\begin{array}{*{20}c} {147} & {145} & {149} \\ {145} & {149} & {150} \\ {147} & {156} & {151} \\ \end{array} } \right| $$
  1. 3.

    Take red image pixel block and transform into binary numbers.

$$ \left| {\begin{array}{*{20}c} {10001101} & {10001101} & {10001101} \\ {10000101} & {10001111} & {10001100} \\ {10001100} & {10001111} & {10001011} \\ \end{array} } \right| $$
  1. 4.

    Divide it into four bit-plane matrices starting from LSB.

$$ \begin{array}{*{20}c} {R_{LSB} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1 \\ \end{array} } \right|} & {R_{LSB - 1} = \left| {\begin{array}{*{20}c} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \\ \end{array} } \right|} \\ {R_{LSB - 2} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 0 \\ \end{array} } \right|} & {R_{LSB - 3} = \left| {\begin{array}{*{20}c} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 1 & 1 & 1 \\ \end{array} } \right|} \\ \end{array} $$
  1. 5.

    Read LSB matrix and form a 1D matrix. c = [1 1 1 1 1 0 0 1 1]

  2. 6.

    Calculate the syndrome S1 = H × (c)T =

$$ \left| {\begin{array}{*{20}c} 0 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 \\ \end{array} } \right|\, \times \,\left| {\begin{array}{*{20}c} 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 \\ \end{array} } \right|^{T} = \left[ {\begin{array}{*{20}c} 0 \\ 1 \\ 1 \\ \end{array} } \right] $$
  1. 7.

    Transpose the syndrome to get secret data bits d = [0 1 1]

  2. 8.

    Repeat the above steps until we do not get the secret data bits. Concatenate all the data bits to get the data, that is, D′ = {0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0}.

  3. 9.

    XOR the modified secret data with secret key k1 to get the original secret data bits, that is, D = {0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0}

4 Experimental Result and Comparison

The scheme is implemented using NetBeans IDE 8.0 on standard color images to measure the performance. The standard cover images are collected from image database of SIPI [13].

The quality of the stego images is measured using mean square error (MSE) and peak signal to noise ratio (PSNR) [14, 15]. Figure 2 shows the stego image when ER = 4 bpp.

Fig. 2.
figure 2

Stego images of size (512 × 512)

$$ MSE = \frac{1}{M\; \times \; N}\mathop \sum \limits_{i = 1}^{M} \mathop \sum \limits_{j = 1}^{N} [I\left( {i,\,j} \right) - I^{{\prime }} \left( {i,\,j} \right)]^{2} $$
(1)
$$ PSNR = 10\log_{10} \frac{{255^{2} }}{MSE}\left( {\text{dB}} \right) $$
(2)

The following tables represent the comparison of PSNR values of stego images generated by different methods with varying payload, and we achieve better PSNR value every time compared to existing methods (Tables 1, 2 and 3).

Table 1. Comparison of PSNR-ER with existing methods for ER = 1 bpp
Table 2. Comparison of PSNR-ER with existing methods for ER = 2 bpp
Table 3. Comparison of PSNR-ER with existing methods for ER = 3 bpp

5 Security Analysis

Security analysis is an important factor of data hiding process. In this paper, we have used two levels of security to enhance our proposition from security perspective. First, we take a 36 bits secret key and encrypt the secret data bits using symmetric key encryption. As it is only known to the sender and receiver, the third party will not be able to decrypt it without knowing the secret key. In second level of security, we have taken a secret seed which is also known to the receiver and sender only. Using this seed, we generate a sequence of unique numbers with the help of PRNG function. We have taken the cover image pixel blocks according to the generated numbers. So without knowing this seed, no one will be able to predict the number sequence.

We also verified our algorithm against some standard measurement like SSIM, standard deviation, RS analysis, histogram analysis. The structural similarity (SSIM) index is a method for measuring the similarity between two images. The SSIM index can be viewed as a quality measure of one of the images being compared, provided the other image is regarded as of perfect quality. From Table 4, it is observed that the SSIM values of all test images are nearer to 1. Standard deviation is used to measure the amount of variation between original and stego images. Here, we achieve SD neared to zero which means that the stego image and cover image are similar in nature. We also analyze our stego image through RS analysis [16]. In Table 5, it is shown that the values of Rm and Rm1, Sm and Sm1 are almost equal and the ratio of R and S lies around 0.05, which is very small, so that we can conclude that our proposed scheme is secure against RS attack. Figure 3 represents the histogram of the original cover image and the stego image. It is shown that the shape of the histogram almost remains same after embedding high-capacity secret data. So we can say that our proposed method is robust against histogram attack.

Table 4. Comparison of PSNR-ER, SSIM, and SD with existing methods for ER = 4 bpp
Table 5. RS analysis of stego image with ER = 4 bpp
Fig. 3.
figure 3

Histogram of original and stego image

6 Conclusion

In this paper, we introduced a novel secure data hiding scheme using Hamming code for RGB color image. Bit-plane slicing of the each RGB color cover image block is also introduced to increase data hiding capacity over grayscale image. So the data embedding rate is raised up to 4 bpp which is greater than other existing schemes. In our algorithm, PSNR is also high compared to existing schemes that mean we generate a better visual quality stego image. From security perspective, we introduced a shared secret key to find suitable bit pattern through XOR operation during data embedding as well as data extraction. The cover image block has been chosen in random location through PRNG of shared seed value which also enhances security in our proposed scheme. We have tested our stego image with RS analysis, histogram analysis, SSIM, SD method and observed that the proposed scheme is preferable for data embedding where visual quality and security constraint needs to be maintained for high payload. In future, the scheme has been extended to enhance security, capacity, and quality in different domain for video-based steganography.