Privacy and Security of Information Processing in Industrial Big Data and Internet of Things
View this Special IssueResearch Article  Open Access
Qinglan Zhao, Shuntong Yang, Dong Zheng, Baodong Qin, "A QR Code Secret Hiding Scheme against Contrast Analysis Attack for the Internet of Things", Security and Communication Networks, vol. 2019, Article ID 8105787, 8 pages, 2019. https://doi.org/10.1155/2019/8105787
A QR Code Secret Hiding Scheme against Contrast Analysis Attack for the Internet of Things
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 lowpower 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.
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 twodimensional (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 lowpower mobile devices.
To meet the demands of applications of QR code to lowpower 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 pseudorandom 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. Section 2 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 modules and Version 40 has the largest 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.
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 Table 1. 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 is the total number of codewords, is the number of data codewords, and 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).


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 8bit 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 Figures 2 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.
3.1. Secret Hiding Procedure
For the secret information to be hidden, its code can be given according to the coding principle of the QR code. is expanded to a longest sequence whose length is related to error correction of the QR code version. Suppose be the number of error correction capacity. The length of is . In order to resist QR contrast attack, 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 key as input to generate a location sequence , where , such that with being a subset of and , for all .
Step 3. Use user’s key as input to generate a sequence with , such that the th codeword is one of data codewords for all .
Step 4. Let be the length of the secret codewords and the length of the code of be . Sequence with length is added to code , and then the code of is added at the end. The resulting sequence is .
Step 5. According to , find the data of the block on the position , that is, the th data of the th codeword, for all . Then get a sequence .
Step 6. Generate a sequence with for .
Step 7. Embed the sequence into the cover message codewords according to the position sequence . For with , look for the th bit of the th block in the cover message codewords and replace it with .
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 key . 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 key as input to generate a location sequence .
Step 3. According to the location sequence , for any with , find the th bit data of the th codeword in the QR code and get the sequence .
Step 4. Finish error correction and use user’s key as input to generate a sequence .
Step 5. According to , find the data on the position of the block and get the sequence corresponding with , .
Step 6. Generate sequence with for .
Step 7. Calculate the length of the secret according to the last th bits and then get the secret codewords .
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 1H QR versions are shown in Figure 4. 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”.
(a)
(b)
(c)
(d)
To show the hiding procedure, we introduce which denote the coding function of QR code including step 1 and step 2 of constructing QR code and denote the coding function of QR code with secret hidden. For simplicity, we use a decimal number to represents an 8bit binary sequence. In Figure 4(a), “Data” is the cover message of the QR code. With using the mask type 7, we get ( “Data”) as follows: (Data) = , 68, 70, 23, 70, 16, 236, 17, 236, 97, 53, 255, 172, 71, 43, 105, 94, 82, 129, 51, 201, 118, 131, 139, 97, .
In Figure 4(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 = . = . = , (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), . (Data)= , 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.
Comparing (“Data”) and (“Data”), we get that the positions of changed codewords are , in which the numbers such as 4 are position numbers of the codewords with underline.
Now we turn to Figure 4(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. (Escher) = , 100, 87, 54, 54, 134, 87, 32, 236, 147, 246, 165, 169, 32, 81, 187, 30, 0, 51, 111, 72, 5, 181, 71, 33, . and are the same as in Figure 4(b). But is different from Figure 4(b). (“Escher”) = , 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 (“Escher”) and (“Escher”), the position number of the changed codewords also are .
In Figure 4(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. (“Linux”) = , 84, 198, 150, 231, 87, 128, 236, 17, 7, 55, 171, 236, 178, 92, 79, 9, 79, 217, 71, 42, 143, 106, 227, 208, . As the cover message is changed, is changed to be . So the final (“Linux”) = , 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 Table 3, the QR code generated by the proposed scheme can be read correctly when being subjected to various distortions.

Table 4 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 lowpower mobile device applications.

Table 5 shows the tolerant secret capacity of the proposed scheme with different QR versions and error correction levels. The proposed scheme can embed at most secret bits into the QR tag. Here, the maximum secret capacity is decided by the version and error correction level of the QR code. For example, in QR Version 1H, the proposed scheme can embed at most 64 bits secret into the QR tag.

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 but have different data. Contrasting (“Escher”) and (“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 lowpower 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 eticket, copyright protection, and brand anticounterfeit in IoT systems.
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 was supported by the National Natural Science Foundation of China under Grants nos. 61472472, 61672414, and 61772418, the Natural Science Basic Research Plan in Shaanxi Province of China under Grant no. 2016JM6033, and the Key Laboratory of Applied Mathematics of Fujian Province University (Putian University) under Grant no. SX201807. Qinglan Zhao is supported by the Innovation Ability Support Program in Shaanxi Province of China under Grant no. 2017KJXX47.
References
 D. Wave, “QR code standardization,” 2003, http://www.qrcode.com/en/index.html. View at: Google Scholar
 J. Katz, A. J. Menezes, P. C. van Oorschot, and S. A. Vanstone, Handbook of Applied Cryptography, CRC Press, New York, NY, USA, 1996. View at: MathSciNet
 Z. Liu, X. Huang, Z. Hu, M. K. Khan, H. Seo, and L. Zhou, “On emerging family of elliptic curves to secure internet of things: ECC comes of age,” IEEE Transactions on Dependable and Secure Computing, vol. 14, no. 3, pp. 237–248, 2017. View at: Publisher Site  Google Scholar
 M. Zhang, Y. Zhang, Y. Jiang, and J. Shen, “Obfuscating EVES algorithm and its application in fair electronic transactions in public clouds,” IEEE Systems Journal, pp. 1–9, 2019. View at: Publisher Site  Google Scholar
 C.T. Hsu and J.L. Wu, “Hidden digital watermarks in images,” IEEE Transactions on Image Processing, vol. 8, no. 1, pp. 58–68, 1999. View at: Publisher Site  Google Scholar
 W. Y. Chen and J. W. Wang, “Nested image steganography scheme using QRbarcode technique,” Optical Engineering, vol. 48, no. 5, article no 057004, 2009. View at: Publisher Site  Google Scholar
 H.C. Huang, F.C. Chang, and W.C. Fang, “Reversible data hiding with histogrambased difference expansion for QR code applications,” IEEE Transactions on Consumer Electronics, vol. 57, no. 2, pp. 779–787, 2011. View at: Publisher Site  Google Scholar
 S. Dey, K. Mondal, J. Nath, and A. Nath, “Advanced steganography algorithm using randomized intermediate qr host embedded with any encrypted secret message: ASA_QR algorithm,” International Journal of Modern Education and Computer Science, vol. 4, no. 6, pp. 59–67, 2012. View at: Publisher Site  Google Scholar
 M. Sun, J. Si, and S. Zhang, “Research on embedding and extracting methods for digital watermarks applied to QR code images,” New Zealand Journal of Agricultural Research, vol. 50, no. 5, pp. 861–867, 2007. View at: Publisher Site  Google Scholar
 M. Gao and B. Sun, “Blind watermark algorithm based on QR barcode,” in Foundations of Intelligent Systems, vol. 122 of Advances in Intelligent and Soft Computing, pp. 457–462, Springer, Berlin, Germany, 2012. View at: Publisher Site  Google Scholar
 S. Rungraungsilp, M. Ketcham, V. Kosolvijak, and S. Vongpradhip, “Data hiding method for QR code based on watermark by compare DCT with DFT domain,” in Proceedings of the 3rd international conference on computer and communication technologies, pp. 144–148, India, 2012. View at: Google Scholar
 L. Li, R. Wang, and C. Chang, “A digital watermark algorithm for QR code,” International Journal of Intelligent Information Processing, vol. 2, no. 2, pp. 29–36, 2011. View at: Publisher Site  Google Scholar
 P.Y. Lin and Y.H. Chen, “QR code steganography with secret payload enhancement,” in Proceedings of the 2016 IEEE International Conference on Multimedia & Expo Workshops (ICMEW), pp. 1–5, 2016. View at: Google Scholar
 Y.J. Chiang, P.Y. Lin, R.Z. Wang, and Y.H. Chen, “Blind QR code steganographic approach based upon error correction capability,” KSII Transactions on Internet and Information Systems, vol. 7, no. 10, pp. 2527–2543, 2013. View at: Publisher Site  Google Scholar
 P.Y. Lin, Y.H. Chen, E. J.L. Lu, and P.J. Chen, “Secret hiding mechanism using QR barcode,” in Proceedings of the International Conference on SignalImage Technology InternetBased Systems, pp. 22–25, 2013. View at: Google Scholar
 P.Y. Lin and Y.H. Chen, “High payload secret hiding technology for QR codes,” Eurasip Journal on Image and Video Processing, vol. 2017, no. 1, article no 14, 2017. View at: Google Scholar
 T. V. Bui, N. K. Vu, T. T. Nguyen, I. Echizen, and T. D. Nguyen, “Robust message hiding for QR code,” in Proceedings of the Tenth International Conference on Intelligent Information Hiding and Multimedia Signal Processing (IIHMSP), pp. 520–523, IEEE, Kitakyushu, Japan, August 2014. View at: Publisher Site  Google Scholar
 D. Wave, “Information technology automatic identification and data capture techniques QR code bar code symbology specification,” in Proceedings of the International Organization for Standardization, ISO/IEC, vol. 18004, 2015. View at: Google Scholar
 C. Chung, W. Chen, and C. Tu, “Image hidden technique using QRbarcode,” in Proceedings of the Fifth International Conference on Intelligent Information Hiding and Multimedia Signal Processing (IIHMSP), pp. 522–525, Kyoto, Japan, September 2009. View at: Publisher Site  Google Scholar
Copyright
Copyright © 2019 Qinglan Zhao et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.