# A QR Code Secret Hiding Scheme against Contrast Analysis Attack for the Internet of Things

Authors: Qinglan Zhao; Shuntong Yang; Dong Zheng; Baodong Qin
Journal: Security and Communication Networks
 (2019)

---

## Abstract

Due to the advantages of larger content and error correction capability, quick response (QR) code is commonly used as a tagging technology for the Internet of Things (IoT) recently. However, the cover message of QR code can be easily decoded by a QR code reader, which causes the security and privacy of the cover message to raise the important issues. In this paper we present a new secret hiding scheme based on QR code. The proposed scheme has low computational complexity and is suitable for low-power devices in IoT systems because of utilizing the error correction property of QR code to hide secret information. The proposed scheme hides the secret information without changing the cover message of QR code and the user can get the cover message by using a general scanner, which contributes to reducing attacker’s curiosity. The hidden secret information can be read by a special scanner with the help of the user key. One thing which is better than other known schemes is that the proposed scheme can resist contrast analysis attack. In addition, experimental results show the proposed scheme has feasibility, low computational complexity, and high hiding payload.


---

## Body

## 1. Introduction

The Internet of Things (IoT) interconnects physical and digital objects that are identifiable and may interact with each other and with users. These objects, each with its own identity, are well beyond only computers and they are our cars, luggage, household applicants, humans, and so on. This was made possible by different tagging technologies like radio frequency identification (RFID) and two-dimensional (2D) barcode which allow physical objects to be identified and refer over the IoT. Due to the less complexity and a cheap solution of 2D barcodes, they have become popular for building an IoT system. Quick response (QR) code, as a 2D barcode with the advantages of larger QR content and error correction capability, is commonly used recently.QR code can store rich information including text, URL link, and other types of data. They can be used as a data carrier to allow users to access the system more conveniently in an IoT system. However, the cover message of the QR code can be easily read by a barcode reader [1], such as a mobile phone with a camera. This may lead to leaking of privacy. Another important issue is the security of QR code when we use a QR code to communicate secret information.The traditional method of encrypting secret information into cipher texts makes it impossible for an attacker to obtain secret information, thereby achieving confidentiality [2–4]. This method requires a lot of computation and is sometimes not suitable for the objects of IoT system. It also clearly points out what is important information and easily attracts the attention of the attacker to increase the possibility of being attacked [5]. Information hiding technologies based on QR code have emerged to solve these new problems. The image hiding schemes [6–8] are mainly to convert the secret into a QR code tag and then embed the secret QR code into the image. However, these schemes require complicated image processing operations to recover the hidden QR code. Most watermarking algorithms, which use Discrete Cosine Transform, Discrete Wavelet Transform, and Discrete Fourier Transform algorithms to hide the watermark in the QR code [9–12], have high computational complexity and limited hidden information caused by the length and width of QR code. Therefore, due to the high computational complexity of these methods, they are not suitable for low-power mobile devices.To meet the demands of applications of QR code to low-power mobile devices in IoT systems, some schemes have been presented which used the code characteristic of the QR code to hide secret [13–17]. Chiang et al. proposed a scheme [14] to hide the secret information being confused by the pseudo-random binary stream generated by the user key. To increase the hiding payload, [16] proposed a data hiding method which is an extended version of [13]. However, these methods can not resist the contrast analysis attack. Under such an attack scenario, the attacker can contrast the codewords of QR codes which have different cover message and hide the same secret information with the same user key. These methods insert some data related to the secret information into the original codewords and make positions of secret message unchanged when the secret and key do not change. The attacker can get the data which are the same part of these codewords. Even the attacker can not recover the secret from the data they got without the key, they can create a new QR code with embedding these data which hide secret information. When these secret schemes are used for copyright protection, by this method the attacker can forge copyright information containing the legal copyright information.In order to resist the contrast analysis attack, we design a new QR code secret hiding scheme. The proposed scheme makes the changed codewords of original QR code related to the cover message using the simple XOR operation. Compared with original QR code, QR codes have different changed codewords if they have the different cover message and hide the same secret information with the same key. So the attacker can not find the same data related to the secret information and key through the contrast analysis attack. In addition, the proposed scheme utilizes the biggest error correction ability of QR code to resist brute force attack. With higher security than the known schemes, the proposed scheme has the low computational complexity and high hiding payload.The paper is organized as follows. Section2 introduces QR code technique. The proposed secret hiding scheme is described in Section 3. The simulation, performance comparisons, and security analysis are discussed in Section 4. Finally, Section 5 concludes the paper.


## 2. The Technology of QR Code

QR code is one of the most popular 2D barcodes [18]. It consists of white and black square modules which are equal to the binary values 0 and 1. Figure 1 depicts an instance of QR code symbol. The number of modules increases with QR code version. There are 40 QR code standard versions among which Version 1 has the smallest 21×21 modules and Version 40 has the largest 177×177 modules. The data payload becomes larger as the version evolves. There is 208 data modules in Version 1 and 29648 data modules in Version 40. The message bit stream shall be divided into codewords. All codewords are 8 bits in length.Figure 1
Basic structure of a QR barcode.To achieve the recovery ability, the error correction algorithm has been used in QR code to generate a series of error correction codewords which are added to the data codeword sequence. The error up to 30% can be corrected. Each version has four error correction levels L, M, Q, and H as shown in Table1. Depending on the version and error correction level, the data codeword sequence is subdivided into one or more blocks, to each of which the error correction algorithm shall be applied separately to the data codeword. To show this, the error correction characteristics of QR code of Version 1, 20, and 40 are listed in Table 2, where c is the total number of codewords, k is the number of data codewords, and r is the number of error correction capacity. For Version 20 with error correction level L, as an example, 1085 codewords are divided into 8 blocks in which 3 blocks apply error correction codewords (135,107,14) and 5 blocks apply error correction codewords (136,108,14).Table 1
Error correction levels.
Error Correction Level Recovery Capacity %(approx.) L 7 M 15 Q 25 H 30Table 2
Error correction characteristics of Versions 1, 20, and 40.
Version Total number of codewords Error correction level Number of error correction codewords Number of error correction blocks Error correction code per block (c,k,r) 1 26 L 7 1 (26,19,2) M 10 1 (26,16,4) Q 13 1 (26,13,6) H 17 1 (26,9,8)  20 1085 L 224 3 (135,107,14) 5 (136,108,14) M 416 3 (67,41,13) 13 (68,42,13) Q 600 15 (54,24,15) 5 (55,25,15) H 700 15 (43,15,14) 10 (44,16,14)  40 3706 L 750 19 (148,118,15) 6 (149,119,15) M 1372 18 (75,47,14) 31 (76,48,14) Q 2040 34 (54,24,15) 34 (55,25,15) H 2430 20 (45,15,15) 61 (46,16,15)The process to construct a QR code is structured into seven steps.Step 1 (data analysis).
The input data stream is analyzed to identify the variety of different characters to be encoded and the version and error correction level are selected.Step 2 (data encodation).
Data characters are converted to a bit stream which is split into 8-bit codewords.Step 3 (error correction coding).
The codeword sequence is divided into the required number of blocks and the error correction codewords are calculated for each block with being appended to the end of the data codeword sequence.Step 4 (structure final messages).
The final sequence is assembled by taking data and error correction codewords from each block in turn.Step 5 (module placements in matrix).
The codeword modules are placed in the matrix together with other patterns.Step 6 (masking).
To optimize the dark/light module balance and minimize the occurrence of undesirable patterns, the masking pattern is applied.Step 7 (format and version information).
The format and version information are created.


## 3. The Proposed Scheme

The proposed scheme utilizes the code characteristic of QR code to hide secret information. It includes two procedures, secret hiding procedure and secret extraction procedure, whose flowcharts are shown in Figures2 and 3. Secret hiding procedure is integrated with the QR code generation for a cover message and secret extraction procedure is integrated with the QR code scanning, as we will describe in detail.Figure 2
Secret hiding procedure.Figure 3
Secret extraction procedure.


### 3.1. Secret Hiding Procedure

For the secret information to be hidden, its codeMC can be given according to the coding principle of the QR code. MC is expanded to a longest sequence S whose length is related to error correction of the QR code version. Suppose r be the number of error correction capacity. The length of S is 8r. In order to resist QR contrast attack, S will be confused by a sequence related to the cover message. The following are details of secret hiding procedure.Step 1.
Perform the normal QR code encoding procedure for the secrete information and cover message until their codewords are generated.Step 2.
Use user’s keyks as input to generate a location sequence Y=[Y0,Y1,…,Y8r-1], where Yi=(m,n), such that m∈C′ with C′ being a subset of {0,1,…,c-1} and |C′|=r, 0≤n≤7 for all 0≤i≤8r-1.Step 3.
Use user’s keyks as input to generate a sequence X=[X0,X1,…,X8r-1] with Xi=(t,s), 0≤t≤c-1,0≤s≤7 such that the tth codeword is one of data codewords for all 0≤i≤8r-1.Step 4.
Letl be the length of the secret codewords MC and the length of the code of l be q. Sequence 0…0 with length l=r∗8-q is added to code MC, and then the code of l is added at the end. The resulting sequence is S=[S0,S1,…,S8r-1].Step 5.
According toX, find the data Xi′ of the block on the position Xi=(t,s), that is, the sth data of the tth codeword, for all 0≤i<8r-1. Then get a sequence X′=[X0′,X1′,…,X8r-1′].Step 6.
Generate a sequenceS′=[S0′,S1′,…,S8r-1′] with Si′=Si⊕Xi′ for 0≤i≤8r-1.Step 7.
Embed the sequenceS′ into the cover message codewords according to the position sequence Y. For Yi=(m,n) with 0≤i≤8r-1, look for the nth bit of the mth block in the cover message codewords and replace it with Si′.Step 8.
Continue the process of encoding the QR code with hidden secret information.


### 3.2. Secret Extraction Procedure

To extract the secret information, we design the special scanner in which the secret extraction is integrated with scanning process. The common scanner only can read the cover message by scanning the QR code. Using the special scanner, the authorized user can get the cover message and the secret information with inputting the keyks. Secret extraction procedure includes the following steps.Step 1.
Scan QR code to get data block information before error correction.Step 2.
Use user’s keyks as input to generate a location sequence Y.Step 3.
According to the location sequenceY, for any Yi=(m,n) with 0≤i≤8r-1, find the nth bit data Si′ of the mth codeword in the QR code and get the sequence S′=[S0′,S1′,…,S8r-1′].Step 4.
Finish error correction and use user’s key as input to generate a sequenceX.Step 5.
According toX, find the data Xi′ on the position Xi=(t,s) of the block and get the sequence X′=[X0′,X1′,…,X8r-1′] corresponding with X=[X0,X1…,X8r-1], 0≤i≤8r-1.Step 6.
Generate sequenceS=[S0,S1,…,S8r-1] with Si=Si′⊕Xi′ for 0≤i≤8r-1.Step 7.
Calculate the lengthl of the secret according to the last qth bits and then get the secret codewords [S0,S1,…,Sl-1].


## 3.1. Secret Hiding Procedure

For the secret information to be hidden, its codeMC can be given according to the coding principle of the QR code. MC is expanded to a longest sequence S whose length is related to error correction of the QR code version. Suppose r be the number of error correction capacity. The length of S is 8r. In order to resist QR contrast attack, S will be confused by a sequence related to the cover message. The following are details of secret hiding procedure.Step 1.
Perform the normal QR code encoding procedure for the secrete information and cover message until their codewords are generated.Step 2.
Use user’s keyks as input to generate a location sequence Y=[Y0,Y1,…,Y8r-1], where Yi=(m,n), such that m∈C′ with C′ being a subset of {0,1,…,c-1} and |C′|=r, 0≤n≤7 for all 0≤i≤8r-1.Step 3.
Use user’s keyks as input to generate a sequence X=[X0,X1,…,X8r-1] with Xi=(t,s), 0≤t≤c-1,0≤s≤7 such that the tth codeword is one of data codewords for all 0≤i≤8r-1.Step 4.
Letl be the length of the secret codewords MC and the length of the code of l be q. Sequence 0…0 with length l=r∗8-q is added to code MC, and then the code of l is added at the end. The resulting sequence is S=[S0,S1,…,S8r-1].Step 5.
According toX, find the data Xi′ of the block on the position Xi=(t,s), that is, the sth data of the tth codeword, for all 0≤i<8r-1. Then get a sequence X′=[X0′,X1′,…,X8r-1′].Step 6.
Generate a sequenceS′=[S0′,S1′,…,S8r-1′] with Si′=Si⊕Xi′ for 0≤i≤8r-1.Step 7.
Embed the sequenceS′ into the cover message codewords according to the position sequence Y. For Yi=(m,n) with 0≤i≤8r-1, look for the nth bit of the mth block in the cover message codewords and replace it with Si′.Step 8.
Continue the process of encoding the QR code with hidden secret information.


## 3.2. Secret Extraction Procedure

To extract the secret information, we design the special scanner in which the secret extraction is integrated with scanning process. The common scanner only can read the cover message by scanning the QR code. Using the special scanner, the authorized user can get the cover message and the secret information with inputting the keyks. Secret extraction procedure includes the following steps.Step 1.
Scan QR code to get data block information before error correction.Step 2.
Use user’s keyks as input to generate a location sequence Y.Step 3.
According to the location sequenceY, for any Yi=(m,n) with 0≤i≤8r-1, find the nth bit data Si′ of the mth codeword in the QR code and get the sequence S′=[S0′,S1′,…,S8r-1′].Step 4.
Finish error correction and use user’s key as input to generate a sequenceX.Step 5.
According toX, find the data Xi′ on the position Xi=(t,s) of the block and get the sequence X′=[X0′,X1′,…,X8r-1′] corresponding with X=[X0,X1…,X8r-1], 0≤i≤8r-1.Step 6.
Generate sequenceS=[S0,S1,…,S8r-1] with Si=Si′⊕Xi′ for 0≤i≤8r-1.Step 7.
Calculate the lengthl of the secret according to the last qth bits and then get the secret codewords [S0,S1,…,Sl-1].


## 4. Simulation Results and Analysis

To assess the feasibility and suitability of the scheme, we implement the proposed secret hiding scheme using Python language which has a powerful operation library of QR code.


### 4.1. Experimental Results and Practicability

The results of the proposed scheme for the 1-H QR versions are shown in Figure4. Figure 4(a) is the original QR code image with the cover message “Data”. Figure 4(b) is the QR code image which has the same cover message with Figure 4(a) and hides the secret message “Secret” with the user key “google”. Figures 4(c) and 4(d) hide the same secret and use the same user key as Figure 4(b), but have the different cover message “Escher” and “Linux”.Figure 4
The results of 1-H QR code in different cases.
(a) (b) (c) (d)To show the hiding procedure, we introduceQRC which denote the coding function of QR code including step 1 and step 2 of constructing QR code and QRCS denote the coding function of QR code with secret hidden. For simplicity, we use a decimal number to represents an 8-bit binary sequence. In Figure 4(a), “Data” is the cover message of the QR code. With using the mask type 7, we get QRC( “Data”) as follows: QRC(Data) = [64, 68, 70, 23, 70, 16, 236, 17, 236, 97, 53, 255, 172, 71, 43, 105, 94, 82, 129, 51, 201, 118, 131, 139, 97, 120].In Figure4(b), the cover message of the QR code is “Data”, the user key is “google”, the secret message is “Secret”, and the mask type is 0. According to secret hiding procedure, we get S = [115,101,99,114,101,116,0,6]. S′ = [155,75,232,240,129,46,118,94]. Y = [(18,6), (18, 0), (6, 5), (18, 2), (23, 3), (15, 4), (18, 1), (6, 6), (4, 3), (15, 6), (7, 1), (7, 0), (25, 2), (23, 5), (6, 1), (25, 3), (23, 1), (18, 4), (4, 4), (12, 3), (18, 7), (4, 5), (7, 2), (25, 1), (6, 3), (23, 0), (15, 5), (12, 6), (4, 2), (15, 3), (23, 2), (25, 7), (25, 6), (23, 6), (6, 7), (7, 4), (12, 4), (4, 1), (12, 7), (7, 6), (18, 3), (18, 5), (4, 7), (25, 0), (4, 6), (7, 7), (7, 5), (25, 4), (12, 0), (15, 1), (15, 2), (6, 2), (7, 3), (23, 4), (15, 0), (23, 7), (12, 2), (12, 1), (6, 0), (12, 5), (4, 0), (6, 4), (25, 5), (15,7)]. QRCS(Data)= [64, 68, 70, 23, 139, 16, 122, 7, 236, 97, 53, 255, 70, 71, 43, 230, 94, 82, 107, 51, 201, 118, 131, 216, 97, 54].ComparingQRC(“Data”) and QRCS(“Data”), we get that the positions of changed codewords are [4,6,7,12,15,18,23,25], in which the numbers such as 4 are position numbers of the codewords with underline.Now we turn to Figure4(c). In Figure 4(c), the cover message of the QR code is “Escher”. The user key and the secret to be hidden are the same as in Figure 4(b) and the mask type is 0. QRC(Escher) = [64, 100, 87, 54, 54, 134, 87, 32, 236, 147, 246, 165, 169, 32, 81, 187, 30, 0, 51, 111, 72, 5, 181, 71, 33, 17]. S and Y are the same as in Figure 4(b). But S′=[121,113,225,22,236,220,0,10] is different from Figure 4(b). QRCS(“Escher”) = [64, 100, 87, 54, 202, 134, 7, 193, 236, 147, 246, 165, 10, 32, 81, 18, 30, 0, 188, 111, 72, 5, 181, 114, 33, 214]. Comparing QRC(“Escher”) and QRCS(“Escher”), the position number of the changed codewords also are [4,6,7,12,15,18,23,25].In Figure4(d), under inputting the same key with Figure 4(b), the same secret is hidden in the QR code with the cover message “Linux” and the mask type 0. QRC(“Linux”) = [64, 84, 198, 150, 231, 87, 128, 236, 17, 7, 55, 171, 236, 178, 92, 79, 9, 79, 217, 71, 42, 143, 106, 227, 208, 123]. As the cover message is changed, S′ is changed to be [132,176,181,199,24,59,171,189]. So the final QRCS(“Linux”) = [64, 84, 198, 150, 159, 87, 152, 220, 17, 7, 55, 171, 188, 178, 92, 185, 9, 79, 2, 71, 42, 143, 106, 225, 208, 201] which has different data on the same changed codewords with Figure 4(c).


### 4.2. Schemes Performance

Considering the noise, compression, damage, etc., caused by the propagation and printing methods in practical applications, we analyzed the performances in Gaussian noise, salt and pepper noise, JPG lossy compression, damage, and rotation of QR codes generated by the proposed scheme hidden secret. As shown in Table3, the QR code generated by the proposed scheme can be read correctly when being subjected to various distortions.Table 3
The revealed results of various situations.
Variance 0.1 0.3 0.5 0.7 Gaussian noise QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable Decodable  Noise ratio 10% 30% 50% 70% Salt&Pepper noise QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable Decodable  Compression ratio 15% 30% 40% 50% Jpg compression QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable Decodable  broken’s blocks 1 2 4 8 Image damage QR content Readable Readable Readable Readable  Rotation angle 4 5 ∘ 9 0 ∘ 18 0 ∘ 27 0 ∘ Rotation QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable DecodableTable4 shows a general comparison between the related schemes [6–12, 14, 16, 19] and the proposed scheme. Unlike the conventional hiding and watermarking schemes [6–12, 19], the proposed scheme utilizes the code character of the QR code and embeds the secret into the modules of the QR code directly. Hence, the QR code with the hidden secret information can be easily scanned by barcode readers, which make it suitable to the low-power mobile device applications.Table 4
Comparison of related QR code schemes.
Methods [6, 19] [7, 8] [9, 11, 12] [10] [14, 16] Proposed Applications Image hiding Image hiding Watermarking Watermarking Secret hiding Secret hiding  Embedding domain Frequency Spatial Frequency Spatial Spatial Spatial  Computational complexity High Low High Low Low Low  Module-based No No No No Yes Yes  Robustness of secret High Low High High High High  Against contrast analysis attack - - - - No TesTable5 shows the tolerant secret capacity of the proposed scheme with different QR versions and error correction levels. The proposed scheme can embed at most 2r secret bits into the QR tag. Here, the maximum secret capacity r is decided by the version and error correction level of the QR code. For example, in QR Version 1-H, the proposed scheme can embed at most 64 bits secret into the QR tag.Table 5
The QR data payload for different QR versions and error correction levels.
Version and Error Correction Level L M Q H 1 16 32 48 64 10 288 520 768 896 20 896 1664 2400 2800 30 1800 3248 4800 5760 40 3000 5488 8160 9720


### 4.3. Security Analysis

In what follows we discuss the resistance of the proposed scheme to two QR code attacks.Secret hiding payload in schemes [14–16] is not fixed; that is to say, the length of the secret to be embedded (which may be the original secret or the secret with confusion) is decided by the original secret, which result in their schemes being vulnerable to one kind of QR code attacks. Under this attack, when attackers have the information of the version of a QR code, they can generate a QR code in the same version with the same cover message and compare this QR code with the QR code embedding the secret and then get their different part including the secret information. If the payload of the hidden secret is not high, for example, in [15], secret could be leaked when being subjected to brute force attacks. The proposed scheme extends the length of the original secret to the maximum length by adding all 0 sequences to the code of the original secret. After confusion the extended secrets are embedded into the QR code. No matter how long the length of the secret is, the attacks get their different part with the longest length when they compare the original cover QR code with the new QR code embedding the secret. Hence, the scheme has the best resistance to brute force attack even if the original secret is short.The position and confusion of secret to be embedded are decided only by the user key in schemes [14–16]. Hence, QR codes hiding the same secret with the different cover message and the same key have some same data. These same data can be exploited by contrast analysis attack. The proposed scheme achieves confusing secret using the codewords of the cover message. So when the cover message changes, the data of the changed codewords will be different. For example, as shown in Section 4.1, compared with original QR code in Figure 4(b), QR codes in Figures 4(c) and 4(d) have changed codewords of cover messages on the same position [4,6,7,12,15,18,23,25] but have different data. Contrasting QRCS(“Escher”) and QRCS(“Linux”), there are not the same codewords which will leak the secret information. Hence the attacker can not find position where the secret information was embedded by contrasting the code of the QR codes hiding the same secret information with the different cover message and the same key.


## 4.1. Experimental Results and Practicability

The results of the proposed scheme for the 1-H QR versions are shown in Figure4. Figure 4(a) is the original QR code image with the cover message “Data”. Figure 4(b) is the QR code image which has the same cover message with Figure 4(a) and hides the secret message “Secret” with the user key “google”. Figures 4(c) and 4(d) hide the same secret and use the same user key as Figure 4(b), but have the different cover message “Escher” and “Linux”.Figure 4
The results of 1-H QR code in different cases.
(a) (b) (c) (d)To show the hiding procedure, we introduceQRC which denote the coding function of QR code including step 1 and step 2 of constructing QR code and QRCS denote the coding function of QR code with secret hidden. For simplicity, we use a decimal number to represents an 8-bit binary sequence. In Figure 4(a), “Data” is the cover message of the QR code. With using the mask type 7, we get QRC( “Data”) as follows: QRC(Data) = [64, 68, 70, 23, 70, 16, 236, 17, 236, 97, 53, 255, 172, 71, 43, 105, 94, 82, 129, 51, 201, 118, 131, 139, 97, 120].In Figure4(b), the cover message of the QR code is “Data”, the user key is “google”, the secret message is “Secret”, and the mask type is 0. According to secret hiding procedure, we get S = [115,101,99,114,101,116,0,6]. S′ = [155,75,232,240,129,46,118,94]. Y = [(18,6), (18, 0), (6, 5), (18, 2), (23, 3), (15, 4), (18, 1), (6, 6), (4, 3), (15, 6), (7, 1), (7, 0), (25, 2), (23, 5), (6, 1), (25, 3), (23, 1), (18, 4), (4, 4), (12, 3), (18, 7), (4, 5), (7, 2), (25, 1), (6, 3), (23, 0), (15, 5), (12, 6), (4, 2), (15, 3), (23, 2), (25, 7), (25, 6), (23, 6), (6, 7), (7, 4), (12, 4), (4, 1), (12, 7), (7, 6), (18, 3), (18, 5), (4, 7), (25, 0), (4, 6), (7, 7), (7, 5), (25, 4), (12, 0), (15, 1), (15, 2), (6, 2), (7, 3), (23, 4), (15, 0), (23, 7), (12, 2), (12, 1), (6, 0), (12, 5), (4, 0), (6, 4), (25, 5), (15,7)]. QRCS(Data)= [64, 68, 70, 23, 139, 16, 122, 7, 236, 97, 53, 255, 70, 71, 43, 230, 94, 82, 107, 51, 201, 118, 131, 216, 97, 54].ComparingQRC(“Data”) and QRCS(“Data”), we get that the positions of changed codewords are [4,6,7,12,15,18,23,25], in which the numbers such as 4 are position numbers of the codewords with underline.Now we turn to Figure4(c). In Figure 4(c), the cover message of the QR code is “Escher”. The user key and the secret to be hidden are the same as in Figure 4(b) and the mask type is 0. QRC(Escher) = [64, 100, 87, 54, 54, 134, 87, 32, 236, 147, 246, 165, 169, 32, 81, 187, 30, 0, 51, 111, 72, 5, 181, 71, 33, 17]. S and Y are the same as in Figure 4(b). But S′=[121,113,225,22,236,220,0,10] is different from Figure 4(b). QRCS(“Escher”) = [64, 100, 87, 54, 202, 134, 7, 193, 236, 147, 246, 165, 10, 32, 81, 18, 30, 0, 188, 111, 72, 5, 181, 114, 33, 214]. Comparing QRC(“Escher”) and QRCS(“Escher”), the position number of the changed codewords also are [4,6,7,12,15,18,23,25].In Figure4(d), under inputting the same key with Figure 4(b), the same secret is hidden in the QR code with the cover message “Linux” and the mask type 0. QRC(“Linux”) = [64, 84, 198, 150, 231, 87, 128, 236, 17, 7, 55, 171, 236, 178, 92, 79, 9, 79, 217, 71, 42, 143, 106, 227, 208, 123]. As the cover message is changed, S′ is changed to be [132,176,181,199,24,59,171,189]. So the final QRCS(“Linux”) = [64, 84, 198, 150, 159, 87, 152, 220, 17, 7, 55, 171, 188, 178, 92, 185, 9, 79, 2, 71, 42, 143, 106, 225, 208, 201] which has different data on the same changed codewords with Figure 4(c).


## 4.2. Schemes Performance

Considering the noise, compression, damage, etc., caused by the propagation and printing methods in practical applications, we analyzed the performances in Gaussian noise, salt and pepper noise, JPG lossy compression, damage, and rotation of QR codes generated by the proposed scheme hidden secret. As shown in Table3, the QR code generated by the proposed scheme can be read correctly when being subjected to various distortions.Table 3
The revealed results of various situations.
Variance 0.1 0.3 0.5 0.7 Gaussian noise QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable Decodable  Noise ratio 10% 30% 50% 70% Salt&Pepper noise QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable Decodable  Compression ratio 15% 30% 40% 50% Jpg compression QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable Decodable  broken’s blocks 1 2 4 8 Image damage QR content Readable Readable Readable Readable  Rotation angle 4 5 ∘ 9 0 ∘ 18 0 ∘ 27 0 ∘ Rotation QR content Readable Readable Readable Readable Secret Decodable Decodable Decodable DecodableTable4 shows a general comparison between the related schemes [6–12, 14, 16, 19] and the proposed scheme. Unlike the conventional hiding and watermarking schemes [6–12, 19], the proposed scheme utilizes the code character of the QR code and embeds the secret into the modules of the QR code directly. Hence, the QR code with the hidden secret information can be easily scanned by barcode readers, which make it suitable to the low-power mobile device applications.Table 4
Comparison of related QR code schemes.
Methods [6, 19] [7, 8] [9, 11, 12] [10] [14, 16] Proposed Applications Image hiding Image hiding Watermarking Watermarking Secret hiding Secret hiding  Embedding domain Frequency Spatial Frequency Spatial Spatial Spatial  Computational complexity High Low High Low Low Low  Module-based No No No No Yes Yes  Robustness of secret High Low High High High High  Against contrast analysis attack - - - - No TesTable5 shows the tolerant secret capacity of the proposed scheme with different QR versions and error correction levels. The proposed scheme can embed at most 2r secret bits into the QR tag. Here, the maximum secret capacity r is decided by the version and error correction level of the QR code. For example, in QR Version 1-H, the proposed scheme can embed at most 64 bits secret into the QR tag.Table 5
The QR data payload for different QR versions and error correction levels.
Version and Error Correction Level L M Q H 1 16 32 48 64 10 288 520 768 896 20 896 1664 2400 2800 30 1800 3248 4800 5760 40 3000 5488 8160 9720


## 4.3. Security Analysis

In what follows we discuss the resistance of the proposed scheme to two QR code attacks.Secret hiding payload in schemes [14–16] is not fixed; that is to say, the length of the secret to be embedded (which may be the original secret or the secret with confusion) is decided by the original secret, which result in their schemes being vulnerable to one kind of QR code attacks. Under this attack, when attackers have the information of the version of a QR code, they can generate a QR code in the same version with the same cover message and compare this QR code with the QR code embedding the secret and then get their different part including the secret information. If the payload of the hidden secret is not high, for example, in [15], secret could be leaked when being subjected to brute force attacks. The proposed scheme extends the length of the original secret to the maximum length by adding all 0 sequences to the code of the original secret. After confusion the extended secrets are embedded into the QR code. No matter how long the length of the secret is, the attacks get their different part with the longest length when they compare the original cover QR code with the new QR code embedding the secret. Hence, the scheme has the best resistance to brute force attack even if the original secret is short.The position and confusion of secret to be embedded are decided only by the user key in schemes [14–16]. Hence, QR codes hiding the same secret with the different cover message and the same key have some same data. These same data can be exploited by contrast analysis attack. The proposed scheme achieves confusing secret using the codewords of the cover message. So when the cover message changes, the data of the changed codewords will be different. For example, as shown in Section 4.1, compared with original QR code in Figure 4(b), QR codes in Figures 4(c) and 4(d) have changed codewords of cover messages on the same position [4,6,7,12,15,18,23,25] but have different data. Contrasting QRCS(“Escher”) and QRCS(“Linux”), there are not the same codewords which will leak the secret information. Hence the attacker can not find position where the secret information was embedded by contrasting the code of the QR codes hiding the same secret information with the different cover message and the same key.


## 5. Conclusion

The QR code secret hiding scheme designed in this paper can hide up to 9720 bits of secret information as needed and does not affect the readability of the cover message. The secret information can be extracted by the authorized user with the right key in the proposed scheme. Hence when the QR code is copied by the attacker, the attacker can not extract the secret without the key. The proposed scheme has low computational complexity and high secret payload and is suitable for low-power devices. In addition, the basic point is that, unlike the other known schemes, the proposed scheme can resist contrast analysis attack, which can prevent forgery if the scheme is applied for e-ticket, copyright protection, and brand anticounterfeit in IoT systems.



---

*Source: 8105787-2019-07-03.xml*