Abstract

Different color patterns of quick response (QR) codes, such as RGB, grayscale, and binary QR codes, are widely used in applications. In this paper, we propose a novel XOR-based visual secret sharing (VSS) scheme using grayscale QR codes as cover images and binary QR code as secret image. First, all the codewords of the secret QR code image are encoded into temporary binary QR code images, which are substituted for the second significant bit planes of the grayscale QR code cover images to generate shares. Each share is a grayscale QR code image, which can be decoded by a standard QR code decoder, so that it may not attract the attention of potential attackers when distributed in the public channel. The secret image can be recovered by XORing the codewords regions of QR codes which are extracted from the second significant bit planes of the grayscale shares. More importantly, the proposed scheme is robust to JPEG compression, addition of different noises, rotation, resizing, and cropping, which is useful in practice. The effectiveness and robustness of our scheme are shown by the experimental results. The application of QR code is suitable for wireless multimedia data security.

1. Introduction

Quick response(QR) code is a kind of two-dimensional matrix codes used widely in all walks of life recently, for the advantages of its speed reading, error correction capability, multiple-format data representing, high capacity compared to one-dimensional codes, and so on. And the application of QR code is suitable for wireless multimedia data security.

QR code image is a binary image in general, each pixel in the image has only two possible values or gradation levels, which is represented by black and white or monochrome image. By graying binary QR code image, we can obtain grayscale QR code image. Each pixel of grayscale QR code image takes up 8 bits of storage space. Keeping the most significant bit plane of the grayscale QR code image unchanged and then replacing the other less significant ones with secret bits could implement information hiding in grayscale QR code image.

The main idea of visual cryptography (VC) [1], also known as visual secret sharing (VSS), is to split a secret image into numerous shares (also called share images or shadow images). Each share reveals no information on the original secret image separately, and only a specific amount of qualified shares could reconstruct the secret image. The secret image would be lost when storing and transmitting in a single image carrier which could be damaged easily, so that we may fail to extract the secret image. But, VSS can overcome the problem to a certain degree [2].

The threshold-based VSS was first proposed by Shamir [3] and Blakley [4]. Sharing one binary secret image into corresponding random shares and then distributing them to participants are the way to share. More than or equal to shares are superimposed to reveal the secret image visually. However, less than participants would reveal no information on the original secret image by stacking or inspecting their shares. The advantage of VSS in [1] is that it is easier to recover the secret image by stacking a specific amount of shares using HVS without any cryptographic knowledge and computations. However, the characteristics of pixel expansion and codebook (basic matrices) design may be be problematic in some situations.

Since Kafri and Keren proposed Random grid (RG)-based VSS [57], it has received much more attention, in which the pixel expansion problem is not exist and codebook design is not required. The secret image is shared into noise-like shares with the same size of the secret image. The decryption method is the same as traditional VSS, i.e., stacking. However, the background of the reconstructed image becomes darker and darker when more and more shares are stacked in OR-based VSS (OVSS) based on RG.

XOR-based VSS (XVSS) can solve the problem of RG-based OVSS [8], since the decryption method is to perform XOR operation on the shares with a light weight computational device to reconstruct the secret image. By applying the XVSS, better image contrast and quality can be obtained [6, 9].

Due to the advantage of VSS and QR code, some combinations of them have been proposed by many researchers recently. Jonathan and Yan [12] authenticated the shares using a QR code. Wang et al. [13] proposed a scheme through embedding QR codes into the best region of given shares to prevent cheating. Chow et al. [11] proposed a (n, n) threshold scheme for cases that n is no less than 3, in which the secret image and cover images are all binary QR codes with the same version and the same level of error correction. Wan et al. [10] proposed a scheme that deeply integrated the QR code error correction mechanism with the theory of VSS and the region shared with the secret image is continuous. Chen et al. [14] proposed a VSS scheme with high security and flexible access structures for QR code applications. Chow et al. [15] investigated a method to distribute shares through embedding them into QR codes cover by a secure way using cryptographic keys. However, robustness is not considered in the above mentioned schemes, which is important in practice. The threshold is greater than 2 in [11], and the problem of image quality uniformity is not taken into account in paper [10].

Nowadays, more and more QR codes are used on mobile phones. A possible scenario to convey secret information securely in the network is described below. It is unsafe to transmit secret information in the public channel without protection, and mobile devices are widely used nowadays. Thus we encode secret information in QR code, which is shared into different QR code cover images to generate corresponding shares. Then the shares are transmitted in different channels over a network from one mobile phone to anther mobile phone. When JPG compression and recoding, Gaussian noise and other image attacks occur during the transmission, if the shares are robust to the attacks, secret information would be recovered, while less than shares cannot reveal any information on the secret image. The decoding results of shares are identical with those of cover images, so they will not come into notice.

The schemes above are not suitable for the scenario. So, we propose a novel robust secret sharing scheme for threshold that is not less than 2. This scheme integrates the QR code error correction mechanism with the theory of XVSS, and all the QR codes are with the same version and level of error correction. First, all the codewords of a secret QR code image are encoded into temporary binary QR code images. Then the temporary binary QR code images are substituted for the second significant bit planes of the grayscale cover QR code images to output shares. The selection of codewords of secret QR code is random and each share can be decoded by a standard QR code reader, which can reduce the likelihood of suspicion and potential attacking. Since the modifications of grayscale QR codes are the second significant bit planes and the error correction mechanism of QR code, the scheme is robust to the conventional image attacks.

The rest of the paper is organized as follows. QR codes and XOR-based VSS are introduced in Section 2. The secret image sharing, recovering algorithm, and analyses are described in Section 3. Section 4 demonstrates the experimental results, comparisons and test. Finally, Section 5 is the conclusion of this paper.

2. Preliminaries

2.1. QR Codes

A QR code symbol [17] consists of a square array consisting of square modules, which is developed by Denso Corporation of Japan in September 1994. The standard [16] defines forty versions of QR code versions ranging from version one to version forty. Different versions of QR code are comprised of different quantities of modules. QR code version 1 is made up of 2121 modules. From version 1, each version has 4 modules per side more than the previous version. For example, version 7 is made up of 4545 modules.

A QR code [16] consists of functional patterns and encoding regions. The encoding region includes data and error correction codewords, format information and version information. The functional patterns consist of alignment, timing, finding patterns, and separation. The amounts of data and error correction codewords and error correction blocks are relying on the version and level of error correction of the QR code. The quiet zone is the blank region around QR code that is important for reading the QR code, encoding input data stream into an array of data codewords with 8-bits length. Error correction codewords also with 8-bits length are generated by using Reed-Solomon error control algorithm which is added to the back of the data codewords.

Depended on the QR version and the level of error correction, data codewords and error correction codes are arranged in different error correction blocks. The level of error correction is divided into four categories: , , , and . The higher the level of error correction is, the stronger the error correction ability will be. But, high level of error correction requires larger QR version to encode the same input data stream, since the proportion of error correction codewords is larger than lower level in the same version. For example, the error correction characteristics of version 7 and 8 are shown in Table 1.

In Table 1, the error correction blocks are given as , where c is the total amount of codewords, k is the amount of codewords and r is the error correction ability. Note that the values are different for certain level of error correction in some QR code versions. It can be found that there are 5 error correction blocks in version 7 with an level of error correction of H. The values for the first four blocks are where the value for the last one is .

The layout of the codewords for each error correction block is in an interleaving manner, and error correction codewords are appended to the end of corresponding data codewords. Since the characteristic of this layout, the QR code decoding ability can be improved for the case of the possibility of localized damages. Figure 1 shows the layout of QR code version 7 with the level of error correction of . After encoding all the codewords, a data mask is required to be applied to the encoding area. There are eight data mask patterns options for balancing the light and dark modules and avoiding the confusion encoding area with functional patterns.

The layout of the codewords and the error correction capability are important for us to share the secret QR code images in the proposed scheme.

2.2. Threshold XOR-Based VSS

The scheme of threshold XOR-based VSS is to share a secret image into corresponding noise-like shares in participants and each share in every participant is different from each other. Then, the secret image can recover losslessly only by XORing shares with a computational device with XOR ability. Less than participants cannot obtain any information about the original secret image by inspecting or stacking their shares.

Figure 2 shows (2,2) XOR-based VSS application example. The generation phase is the same as that of (2, 2) RG-based VSS, while the recover method is to XOR two shares instead of stacking the shares to reveal the original secret image. By XORing the shares, the secret image can be recovered losslessly.

3. Proposed Robust VSS Appling to QR Codes

3.1. The Main Idea

In this section, we propose an threshold XVSS scheme based on QR code. The secret image is a binary QR code, whose codewords are all shared into the codewords of different binary QR codes with the same version and level of error correction, where their functional patterns are the same. All codewords of the secret image are shared with the theory of XVSS. Then the binary QR codes are substituted for the second significant bit plane of grayscale QR code cover images with the same version and level of error correction to generate grayscale QR code shares. The messages in grayscale cover images are different from each other, the grayscale QR code shares can be decoded by a standard QR code decoder.

The secret QR code image can be recovered by extracting the secondary significant bit planes of gray QR code images to generate binary QR code images firstly and then XORing white and dark modules in the codewords region of the binary images, adding the functional patterns, version, and format information later. All the codewords can be recovered and the decoding result of the reconstructed secret image is identical with that of the secret image.

Since the version and level of error correction of all the QR codes are the same, codewords are at the same position and functional pattern are the same. Taking the threshold scheme as an example, Figure 3 illustrates the grayscale QR code shares generation of the proposed scheme.

3.2. The Sharing Phase

When sharing the secret QR code image into arbitrary binary QR code images, we only encrypt the codewords region while other parts are identical with the binary QR code images, then replace the second significant bit planes of the grayscale QR code cover images with the encrypted binary QR code images. All the QR code images have the same version and level of error correction. The corresponding algorithm steps are described in Algorithm 1.

Input: A binary secret QR code image ; different binary temporary QR code images ; different binary QR
code cover images ; the threshold parameters ; the error correction characteristics
Output:   grayscale shares
Generate grayscale shares by graying binary QR code images .
Averagely and randomly divide the serial of total codewords into subsets denoted as , and the number of
each set is , where .
Serial v of the codeword in the secret image S is denoted as , and the serial v of the codeword in the is denoted as .
  for   to   do
for each codeword v in   do
  if     then
Modify the codeword of binary QR code image as ;
  end if
(9)   end for
(10)   end for
  for   to   do
Replace the second significant bit plane of grayscale QR code image with the modified QR code image , and
replace the last six significant bit planes with random binary numbers to generate grayscale share .
  end for
Output grayscale shares .

In Algorithm 1, the codewords of the secret QR code are divided averagely and shared randomly into different temporary binary QR code images. The artificial modification of shares is not perceptible. The shares can be decoded by a standard QR code.

3.3. The Recovery Phase

Base on XORing operation, the data of the recovery QR code image could be lossless. Suppose that grayscale shares are provided, we can get the pixels in the second significant bit planes from shares to create binary QR code images. Then we read the version and level of error correction by a QR decoder. We perform XOR operation on the encoding regions of binary images, after that putting the bits in other regions based on the version and level of error correction. In this way, we can create a QR code image whose message is the same as that of the secret image. The recovery phase is described in Algorithm 2.

Input:   shares ; threshold parameters ;
Output: the reconstructed secret QR code image .
  for   to   do
Read the secondary plane of share to create binary QR image as
   end for
Read the version as v and level of error correction noted as l of image with QR code decoder.
Based on v and l, we can get the total number of the codewords in as according to the standard [16]. For each codeword in
note as .
  for   to   do
, is the result of XORing operation.
  end for
Create the bits in other regions based on the version and level of error correction, after that put them and the bits of codeword
together into a new image to reconstruct a QR code image .
Output the image .
3.4. Analyses

In this section, we present some theoretical analyses about the properties of our scheme. Firstly, the grayscale QR code shares generated by Algorithm 1 and the secret QR code image reconstructed by Algorithm 2 can be decoded by a QR decoder. Secondly, although the shares are damaged to some degree or have some noise, the secret QR image could be decoded. Thirdly, the threshold in our scheme threshold is .

The grayscale shares are generated by replacing the secondary planes with the binary QR codes in which shared the secret image by Algorithm 1, when a QR code decoder reading the grayscale QR code, thresholding the grayscale image in the first place. The thresholding way in different QR code decoder may be not the same, but the simplest and common one is to set the number of 128 as the threshold, so when remaining the most significant digits of the pixel values in grayscale QR code cover images unchanged, the grayscale shares could be decoded.

If the 6 bits behind the secondary bit of each pixel value are changed in the range from to , the value in the secondary bit will not be changed. So when the last 6 bits are kept in the range from to although some noise added, the second significant bit plane replaced with secret image will not be affected, and the secret image can still be rebuilt. Because QR codes have the ability to correct errors, even if the modules are damaged or dirty in the error correction capacity range, the secret QR image could be decoded.

The error correction characteristics are ; when we share the codewords of secret QR image, the number of codewords is divided into sets averagely and randomly. Modifying the codewords of temporary QR codes according to steps in Algorithm 1 to generate binary QR code images and then replace the second significant bit planes of the grayscale QR code cover images with the binary QR code images to generate shares. Each share can be scanned by QR code decoder. When recovering the secret QR code image, the second significant bit planes are extracted from shares to create binary QR code images, performing XOR operation on the codewords regions of binary QR code images, so that the codewords of the secret QR code image would be lossless. Put the bits in other regions to reconstruct the secret image. Since the codewords of the secret QR code image are lossless, the message of the reconstructed image decoded by a QR code decoder would be the same as that of secret image. So, we can achieve the threshold of .

4. Experiments and Comparisons

In this section, experiments and comparisons are taken into account to evaluate the effectiveness of the proposed scheme.

4.1. Image Illustration

In our experiments, the simulation environment of the proposed scheme is python language. Figure 4 is the threshold XOR-based VSS on grayscale QR code of version 7 with level of error correction H. Figure 4(a) is the original secret image S and Figures 4(g) and 4(h) and and are grayscale QR code cover images obtained by graying Figures 4(b) and 4(c) and and , respectively. Figures 4(d), 4(e), 4(f), 4(j), and 4(k) are responding decoding results of Figures 4(a), 4(b), 4(c), 4(g), 4(h). Figures 4(i) and 4(m) are the grayscale QR code shares, and . Figures 4(l) and 4(o) are the decoding results of them. Figure 4(n) is the reconstructed secret QR code image , and Figure 4(p) is the decoding result of .

Figure 5 is our threshold XOR-based VSS on grayscale QR code of version 17 with level of error correction H. Figures 5(b)5(e), , , , and are input binary QR code cover images. Figures 5(f)5(i), , , , and , are grayscale shares. Figure 5(j) is the reconstructed QR code image and Figure 5(k) is the decoding result of and .

The reconstructed secret QR code image in Figures 4 and 5 are recovered by performing XOR operation on the codewords region of QR code image in the second significant bit planes of shares, then adding the functional patterns, version and format information together. The shares and the reconstructed secret image could be decoded by a QR code decoder, and the decoding result of the reconstructed secret image is identical with that of the secret QR code image.

4.2. Comparisons with Related Works

Figure 6 is our threshold XOR-based VSS on QR code with version 4 and level of error correction H. Figure 6(a) is the secret image S. Figures 6(b)6(d) are input binary QR code cover images, , , and . Figures 6(e)6(g) are grayscale shares, , , and . Figure 6(h) is the reconstructed secret image . Figure 6(i) is the decoding result of Figures 6(a) and 6(h).

Figure 7 shows the VSS in [10]. Figure 7(a) is the secret image S. Figures 7(b)7(d) are binary QR code cover images, , , and . Figures 7(e)7(g) are the decoding results of Figures 7(b)7(d). Figures 7(h)7(j) are binary QR shares, , , and . Figure 7(k) is the reconstruct secret image in QR code, .

The secret image in Figure 7 is encrypted from the coordinate of to right down corner of QR code image. The size of secret image is smaller than the QR code, and the secret image is shared in a continuous region of the cover images, threshold value is no less than 2. The QR code images are all binary images. The secret image in our scheme is shared dispersive, high image quality and high imperceptibility can be achieved. The secret image has the same size with the cover images, and the shares are grayscale QR code images.

Figure 8 shows the VSS in [11]. Figure 8(a) is the secret image S. Figures 8(b)8(d) are binary QR code cover images, , , . Figures 8(e)8(g) are binary QR shares, , , . Figure 8(h) is the reconstruct secret image in QR code . Figure 8(i) is the decoding result of Figures 8(a) and 8(i).

The shares in Figure 8 are binary QR code images. The secret QR code image could be reconstructed through XORing the white and black modules contained in the encoding region of the QR code shares and then padding the bits in other regions. The threshold in paper [11] is not less than 3. In our scheme, the shares are grayscale QR code images and the secret image could be recovered by XORing the bits contained in the codewords regions of the second significant bit planes of shares and then adding the function patterns, version, and format information. The threshold in our scheme is not less than 2.

Compared to the schemes in [10, 11], our scheme takes into account the advantage of threshold value greater than 2, high image quality, and high imperceptibility.

4.3. Robust Test

In the proposed technique, all the images are QR codes, which have their own abilities to correct errors, and the plane modification is the second significant bit plane of the grayscale image, in this way, the algorithm is robust to conventional image attacks. Taking our threshold scheme to resist Gaussian noise as an example, addition of different noises to the two shares to test the robustness of the scheme is shown by Figure 9.

Figures 9(a) and 9(b) are shares in Figure 4, , and . Figures 9(c) and 9(d) are shares added with Gaussian noise, Figure 9(e) is the reconstructed secret image from Figures 9(c) and 9(d), . Figures 9(f) and 9(g) are shares added with Gaussian noise, Figure 9(h) is the reconstructed secret image from Figures 9(f) and 9(g), . Figure 9(i) is the decoding result of and . Figure 9(j) displays the differences between in Figure 4(a) and , and the differences between in Figure 4(a) and is showed in Figure 9(k). When the value of variance is in range from 0 to 8, the reconstructed QR code could be decoded, the greater the variance, the greater the difference. When the value of variance is larger than 9, the reconstructed QR code could not be decoded. The decoding result of and is the same as the decoding result of Figure 4(a), so that our scheme is robust to some noises.

Different attacks such as JPEG compression, rotation, resizing, and cropping are tested to further show the robustness. Whether the reconstructed secret QR code image can be decoded correctly when attacks are applied on shares is summarized in Table 2. We can see from Table 2 that we can resist some conventional attacks to certain degree, including JPEG compression, Gaussian noise, rotation, resizing, and cropping. These attacks may exist during shares transmission, so our scheme is very meaningful for practical application.

5. Conclusion

This paper proposed a novel robust VSS scheme applying to QR code. In this scheme, all the codewords of the secret QR code image are split into temporary binary QR codes randomly with the theory of XOR-based VSS, so shares with high image quality and high imperceptibility can be achieved in the end. Each share in our scheme can be decoded by a QR code decoder when distributing via public channels, which would avoid the attentions from potential attackers. Since all the images are QR codes, which have their own abilities to correct errors, and the plane modification is the second significant bit plane of the grayscale image, our scheme is robust to conventional image attacks, such as rotation, JPEG compression, Gaussian noise, resizing and cropping, when reconstructing the secret image, performing XOR operation on the bits of the codewords region in the second significant planes of the grayscale shares and adding the functional patterns, version, and format information together. There are no wrong codewords in the reconstructed secret QR code image, so the message of which is identical with that of the original secret image. The threshold of our scheme is . The reduction of the size of the shares will be the future work.

Data Availability

No data were used to support this study.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This work is supported by the National Natural Science Foundation of China (Grant no. 61602491) and the Key Program of the National University of Defense Technology (Grant no. ZK-17-02-07).