Robust Visual Secret Sharing Scheme Applying to QR Code

Differentcolor patterns of quickresponse (QR) codes, suchas 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.


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 [5][6][7], 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.

Security and Communication Networks
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 RGbased 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.

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 21 * 21 modules. From version 1, each version has 4 modules per side more than the previous version. For example, version 7 is made up of 45 * 45 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: ∼ 7%, ∼ 15%, ∼ 25%, and ∼ 30%. 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 (39, 13,13) where the value for the last one is (40, 14,13).
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.

( , )
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.

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 (2, 2) threshold scheme as an example, Figure 3 illustrates the grayscale QR code shares generation of the proposed scheme.

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.
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.

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.
(3) Serial v of the codeword in the secret image S is denoted as V , and the serial v of the codeword in the is denoted as V . (4) for = 1 to do (5) for each codeword v in do (6) if Modify the codeword of binary QR code image as V =∼ V ; (8) end if (9) end for (10) end for (11) for = 1 to do (12) 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 . (13) end for (14) Output grayscale shares 1 , 2 , ⋅ ⋅ ⋅ , .
Algorithm 1: Proposed robust VSS applying to QR codes.
(1) for = 1 to do (2) Read the secondary plane of share to create binary QR image as (3) end for (4) Read the version as v and level of error correction noted as l of image 1 with QR code decoder. (5) Based on v and l, we can get the total number of the codewords in 1 as according to the standard [16]. For each codeword in note as .

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 ( , )( ≥ 2).
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 000000 to 111111, the value in the secondary bit will not be changed. So when the last 6 bits are kept in the range from 000000 to 111111 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 ( ≥ 2) sets averagely and randomly. Modifying the codewords of temporary QR codes according to steps (4)- (10) 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 ( , ).

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

Image Illustration.
In our experiments, the simulation environment of the proposed scheme is python language. Figure 4 is the (2, 2) 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 1 and 2 are grayscale QR code cover Parsed information 1: Version: 17

Color Normal, Direct
Error level:H, Mask:0 Content: life is like a sea, only the strong will of people, to reach the other shore. -Marx.
(k) The decoding information 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.  Figure 7 shows the VSS in [10]. The secret image in Figure 7 is encrypted from the coordinate of (7, 7) 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]. 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.

Comparisons with Related Works.
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.

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 (2, 2) 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.
Parsed information 1:  from Figures 9(f) and 9(g), 2 . Figure 9(i) is the decoding result of 1 and 2 . Figure 9(j) displays the differences between in Figure 4(a) and 1 , and the differences between in Figure 4(a) and 2 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 1 and 2 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.

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 ( , )( ≥ 2). 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.