Efficient QR Code Secret Embedding Mechanism Based on Hamming Code

QR code is designed as machine readable symbol, which is widely used in various ﬁelds of life due to its large message capacity and fast decoding speed. However, as a public standard, it will give rise to the security issue when delivering sensitive information with QR code. To overcome this weakness, this paper explores the characteristic of QR code to propose an efﬁcient secret hiding mechanism to protect the sensitive information within QR code. The secret message would be embedded into cover QR code based on (8, 4) Hamming code. The error correction capacity (ECC) of QR code would correct the errors produced in the secret embedding procedure, and the valid marked QR code would reduce people’s curious. Compared to the state-of-art works, the proposed scheme achieves a better performance on the aspects of secret payload and embedding efﬁciency.


I. INTRODUCTION
With the rapid development of mobile communication technology and Internet of things technology (IoT), electronic tag technology has gradually been widely used in all walks of life. Compared with one-dimensional barcode, Quick Response (QR) code has the advantages of large information capacity, high decoding reliability, strong error correction ability, wide range of storage information, high density, high information transmission efficiency, etc. It has been widely used in many fields, such as ID identification [1], advertising [2], warehousing and logistics [3], product traceability [4], e-commerce [5], mobile payment [6], [7], etc. As the core perception technology of Internet of things and the important information entrance of the Internet, QR code has gradually penetrated into various fields of national economy and social life. However, because of the openness of QR code encoding and decoding technology, the sensitive information transmitted by QR code is easy to be stolen, especially in the fields The associate editor coordinating the review of this manuscript and approving it for publication was Cesar Vargas-Rosales .
of O2O e-commerce, mobile payment and ID identification. This will cause security issue.
To protect the sensitive information in QR code, many researchers are investigating pattern recognition technology to improve the sensitive information security. Tkachenko et al. [8] designed a rich QR code to sharing the sensitive information. Their scheme constructed some special textured patterns to transmit the sensitive message by replacing them with black modules in the cover QR code. The same idea is applied to Erlangga et al.'s method [9], their method divided a QR code module into nine sub modules, then embedded the sensitive information by using those sub-module patterns. Although this kind of schemes always achieves a high secret payload, those schemes have two obviously disadvantages. The first one is the generated marked QR code would attract people's attention for its strange appearance. The second one is, those module patterns need to be identified by pattern recognition technology. However, the recognition rate of those module patterns still needs to be improved.
Recently, many researchers start to employ data hiding technology to solve this issue. The main idea of this kind of research is embedding the secret message in the space domain of cover QR code, the generated marked QR code would be kept valid because of the fault tolerance of QR code. The valid and meaningful marked QR code would reduce people's attention when delivering in the public channel. Chang et al. [10] exploited the Wet Paper Codes algorithm [11] to uniformly distribute secret message in the cover QR code. To enhance the security of secret message embedded in the QR code, Lin et al. [12] proposed a new QR code secret hiding scheme to encrypt the secret message before embedding procedure. Then many researchers [13]- [16] study new secret embedding strategies for QR code to further improve the secret payload. However, these methods have low embedding efficiency, which is the average number of secret message bits carried by one bit flipping in the cover QR code. The lower the embedding efficiency, the more bits are modified in the cover QR code to embed a bit of secret message. The greater the difference before and after embedding, the higher the probability of being discovered.
To improve the embedding efficiency, this paper proposes a new secret message embedding scheme to embed sensitive message in the public message of a meaningful cover QR code. The new embedding mechanism designs a data bit flipping rule to hide a hexadecimal secret digit into data codeword based on (8,4) Hamming code. The fault tolerance of cover QR code would correct the errors caused by the embedding procedure. The valid and meaningful marked QR code would divert people's attention. Experimental result shows that, the proposed secret embedding scheme achieves a high secret payload, and its embedding efficiency is close to 2.9, which is much better than the state-of-art works.
This paper is organized as follows: Section 2 briefly introduces QR code technology and Hamming code. Section 3 presents the state-of-art works. Section 4 presents the proposed secret embedding strategy for QR code based on (8,4) Hamming code. Section 5 shows the experimental results and the comparison with previous works. Finally, Section 6 makes a conclusion.

A. QR CODE TECHNOLOGY
QR code is an effective information transmission medium, it is widely used in product traceability, advertising, mobile payment and other filed. According to the QR code bar code symbology specification [17], QR code is defined into 40 symbol versions and 4 user-selectable error correction level (ECL): L, M, Q and H, it can correct up to 7%, 15%, 25% and 30% error codewords when attacked by defacement, respectively. This is due to the fault tolerance mechanism introduced by QR code standard. QR code employs Reed-Solomon code to realize the fault tolerance, the error correction codewords would be generated by Reed-Solomon code algorithm and added in the tail of QR code data codewords. Normally two error correction codewords could correct one codeword data error. Table 1 lists the fault tolerance of QR code for some specific version and error correction level.

B. HAMMING CODE
Hamming codes [18] are a class of linear block codes, they were designed by Bell Labs in 1950 to detect and correct errors when the error rate is low. They have been widely used in digital communication and data storage systems as error control codes. The (n, k) Hamming code is n bits in length, it consists of k data bits and (n − k) parity check bits. The minimum distance of a Hamming code is 3, it implies that Hamming code can detect and correct single-bit error or detect double-bits errors. Take the most basic Hamming code (7, 4) code as an example, (7, 4) Hamming code is 1-bit error correcting linear code which consists of 4 data bits and 3 parity check bits. The bit string b 1 b 2 b 3 b 4 gets encoded as c 1 c 2 b 1 c 3 b 2 b 3 b 4 with: This three parity check bits could potentially specify not only that an error occurred but also the error bit location. An additional parity bit c 0 can be added at the beginning or at the end of each codeword of (7, 4) Hamming code to derive an extended (8, 4) Hamming code.
This way, the minimum hamming distance of the Hamming code is increased form 3, in (7, 4) Hamming code, to 4 in (8, 4) Hamming code. Therefore, the (8, 4) Hamming code has the ability to detect up to 3 errors. It is also called Single Error Correction Double Error Detection (SECDED), and widely used in the computer ECC memory system. Figure 1 illustrates the bit position of the data bits and parity bits for Hamming (7,4) and Hamming (8,4) in Venn diagrams.

III. RELATED WORKS A. LIN et al. 's METHOD
In 2017, Lin et al. [15] improved the LSB matching revisited embedding scheme [19] to hide secret message into cover QR code. The secret hiding procedure is outlined below. Step 1. Calculate the secret embedding capacity sc for the cover QR code. Generally, sc = n e 2 , where n e is the number of error correction codewords of QR code.
Step 2. Divide all the data codewords into several pairs, each pair consists of two modules, then put all of them into a pool.
Step 3. Select two data pairs p 1 and p 2 from the pool with a secret embedding key K .
Step 4. Embed four secret bits (denotes as s 1 , s 2 , s 3 and s 4 ) into this two data pair with (3). Then remove these two data pairs from the pool.
Step 5. Count the number of modified digits n in Step 4, then renew the embedding capacity sc by sc = sc − n.
Step 6. Repeat Step 3 to Step 5, until all the secret message bits are embedded.

B. HUANG et al. 's SCHEME
Exploiting Modification Direction (EMD) [20], which was introduced by Zhang and Wang, is used to increase secret capacity and improve quality of the stego-image while hiding data in cover image. In 2018, Huang et al. [16] improved EMD method to propose a QR code steganographic scheme to hide sensitive information in a cover QR code. Their method defines a new secret message extraction function: With the new extraction function, secret message would be embedded into the public message of cover QR code. The embedded procedure is as follows.
Step 1. Calculate the secret embedding capacity sc of cover QR code.
Step 3. Group two octal number from {d 0 , d 1 , · · · , d m } in order as a data pair (x, y). Add or substrate the elements of data pair (x, y) in range of 1 to make the value of f (x , y ) equal to s i , and 0 < i < n.
Step 4. Repeat Step 3 until all the secret message s are embedded in the cover QR code, within the limited of secret capacity sc.
In the process of information extraction, the sensitive information will be easily retrieved with the help of extraction function (4). Their method embeds three bits of sensitive information in six bits of public message of cover QR code. Moreover, the secret embedding mechanism of Huang et al.'s scheme is based on the error correction capacity of cover QR code, so the amount of secret payload depends on the fault tolerance of cover QR code. The corresponding secret payload is sc × 8 6 × 3, and it's in the range of [12,4860].

IV. THE PROPOSED SCHEME
This section presents a secret hiding scheme for QR code based on its error correction capacity. The proposed scheme employs (8,4) Hamming to design a new secret embedding mechanism to improve the secret embedding efficiency, while maintaining a good secret payload.

A. THE SECRET EMBEDDING STRATEGY BASED ON HAMMING CODE
Let H be the parity-check matrix of extended (8,4) Hamming code, and cw be a codeword of the (8, 4) Hamming code.
If no error is introduced during data transmission, the vector α β γ ϕ T will equal to zero. Suppose cw + e i is 86708 VOLUME 8, 2020 received, where e i is the vector with only one position 1. In other words, one error is made in codeword cw.
where h i is one column of check matrix H . Suppose two errors are made in the codeword cw, and cw + e i + e j is received. The corresponding result α β γ ϕ T will be calculated as following.
It equals to the sum of two columns of check matrix H . Since the value of vector α β γ ϕ T from 0000 to 1111 can represent 16 status, we flip one or two bits of the codeword cw into a new codeword cw to embed a hexadecimal number based on data bit flipping rules. The secret data would also be easily to extract by using (6). The data bit flipping rules is closely related to check matrix H . Table 2 illustrates the data flipping rules based on the check matrix H 1 showed in (10).
The flipping operation in the public message of QR code would produce errors during QR code decoding. Thanks to the fault tolerance of QR code, it can still be decoded successfully when the numbers of error codewords is less than its ECC. A meaningful QR code will greatly reduce the possibility of secret information disclosure.

B. THE STEGANOGRAPHIC QR CODE PROCEDURE
Take H 1 as the parity-check matrix of extended (8,4) Hamming code.
Input: Cover QR code QR c , Secret message S. Output: Marked QR code QR s . The number of hexadecimal secret digit n.   Step 1. Calculate the fault tolerant capacity tc of the cover QR code. Thanks to Reed-Solomon code, the error correction code within QR code could correct errors caused by fouling. According to the characteristic of RS code, two error correction codewords could correct one codeword data error, so the tolerant capacity tc is defined as here, ecc denotes the number of error correction code within the cover QR code. It's easy to conclude that the value of tc VOLUME 8, 2020 varies with the versions and error correction levels of cover QR code.
Step 2. Transform the secret message S into hexadecimal digit stream {s 1 , s 2 , · · · , s n }. If n ≤ tc, then go to Step 3. Otherwise, reselect a later version of cover QR code and go back to Step 1.
Step 3. Let i = 1, where i represents the serial number of hexadecimal secret digit stream.
Step 4. Pick up a data codeword cw i of cover QR code QR c , then calculate the vector α β γ ϕ T by using (12).
where ⊕ represents the XOR operation.
Step 5. According to the result α β γ ϕ T , flip one or two bits in the data codeword cw i by looking up flipping rules showed in Table 2.
Step 6. i = i + 1. If i ≤ n, then go to Step 4. Otherwise, go to Step 7.
Step 7. The algorithm ends.

Input:
The marked QR code QR s . The number of hexadecimal secret digit n.
Output: Secret message S.
Step 1. Let i = 1, S = { }, where i represents the serial number of hexadecimal secret digit stream. S is used to store the secret message.
Step 2. Extract the secret message piece s i from the data codeword cw i of marked QR code QR s by using formula Step 3. S = S ∪ s i , where '∪ represents the consolidation of sets.
Step 4. i = i + 1. If i ≤ n, then go to Step 2. Otherwise, go to Step 5.
Step 5. The algorithm ends.

V. EXPERIMENTAL RESULTS AND ANALYSIS A. SOME EXAMPLES OF THE PROPOSED SCHEME
A program is implemented in Python programming language to access the availability of the proposed secret message embedding mechanism. Some experiments are done in different versions of QR code. Figure 2 shows the result of the proposed scheme with version 5-M QR code after embedding the secret message ''1234567890987654321''. The cover QR code is meaningful whose public message is ''fcu.edu.tw''. The secret message will be first converted into 16 Table 1, QR code in version 5-M has 48 error correction codewords, this means that it could correct 24 codewords errors. The embedding procedure produces 16 errors codewords, which are within the tolerance range of QR code in version 5-M. And this will guarantee the validity of marked QR code. A valid and meaningful marked QR code will reduce people's curiosity. Figure 3 and Figure 4 show the examples for QR code in 86710 VOLUME 8, 2020

B. THE EMBEDDING CAPACITY OF THE PROPOSED SCHEME
One hexadecimal secret message digit is embedded in one public message codeword of cover QR code based on (8,4) Hamming code, that is eight bits data hide four bits secret message. The embedding procedure of the proposed scheme ensures the validity of the marked QR code by limiting the number of error codewords within the corresponding fault tolerance of cover QR code. Therefore, the upper bound of secret message embedding capacity of the proposed scheme depends on the level of QR code version V-E. Table 3 lists the secret payload of cover QR code with different versions and different error correction levels.

C. THE EMBEDDING EFFICIENCY OF THE PROPOSED SCHEME
As mentioned in Section 1, the embedding efficiency is defined as the average number of secret message bits carried by one bit flipping in the cover QR code. In the secret embedding process of the proposed scheme, one public message data codeword would be flipped one bit or two bits to embed a hexadecimal secret digit based on (8,4) Hamming code, one of the data bit flipping rule based on parity check matrix is showing in Table 2. From Table 2, we can see that, only one bit needs to be flipped when embedding an odd hexadecimal secret digit, two bits when embedding an even hexadecimal VOLUME 8, 2020 secret digit, and zero bit when embedding secret message ''0''. Suppose that the probability of sixteen hexadecimal secret digits is equal, so the secret message embedding efficiency ee of the proposed scheme could be calculated as following.
This means that the proposed scheme embeds nearly 2.9 secret bits into cover QR code when modifying one bit in public message codeword of cover QR code.

D. THE ROBUSTNESS OF THE PROPOSED SCHEME
QR code is usually scanned by QR code reader with camera. In the capturing process, lack of sufficient light will introduce noise into the QR code image. This noise will degrade the quality of QR code, and reduce success rate of QR code capturing process. Figure 5 shows the result that marked QR code shown in Figure 2 (b) suffers different level of noise attack, such as salt & pepper, gaussian noise, gaussian blur, speckle noise. The results show that the attacked marked QR codes are still valid, and the embedding secret message can be extracted correctly. It means that the marked QR code of the proposed scheme has a strong robustness against noise attack.

E. THE SECURITY OF THE PROPOSED SCHEME
The proposed scheme embeds secret message in public message of cover QR code based on (8,4) Hamming code. The check matrix H could be considered as a key to embed into cover QR code and extract secret message from marked QR code. Suppose that the adversary knows the secret embedding mechanism of the proposed scheme, and he try to extract secret message by adopting a brute force attack strategy to go through all the possibility of the check matrix H . Therefore, the probability of success for adversary to exact secret message will be bounded by 1 2 32 .

F. COMPARISON AND ANALYSIS
The secret hiding schemes for QR code always exploit some kinds of message embedding strategy to conceal the secret message bits in the public message of cover QR code. This research mainly concerns how to improve the secret payload and the embedding efficiency while keeping the marked QR code valid. The valid and meaningful marked QR code will greatly reduce the possibility of secret message being discovered.
As the aspect of secret payload, Lin et al.'s scheme embeds four bits secret message bits into two data pairs that randomly selected from a pool. However, this data pair selection strategy will evenly distribute the modified data bits in the cover QR code, it will lead to more error codewords than they expected. The corresponding secret payload would be reduced to between 0 and 1,215. Huang et al.'s method improved the EMD method to propose a secret hiding scheme for QR code. Their method embeds three bits of secret message in six bits of public message of cover QR code. The secret embedding mechanism of Huang et al.'s scheme is based on the error correction capacity of cover QR code, so the fault tolerance determines the upper limit of the secret embedding capacity. The corresponding secret payload is sc × 8 6 × 3, and it's in the range of [12,4860]. The proposed scheme exploits the error correction capacity of QR code to hide the secret message in the space domain of cover QR code. Four secret message bits are embedded in a data codewords, therefore, the scope of secret payload of the proposed scheme is in the range of [12,4860]. Table 4 lists the secret payload comparison between the proposed scheme and previous works.
As the aspect of embedding efficiency, Lin et al.' scheme embeds four bits secret message into four bits data codeword by using (3), the data bits in public message codewords ranging from 0 to 4 need to be flipped for secret embedding. Suppose that the probability of these five cases is equal. Therefore, the embedding efficiency ee Lin can be calculated as follows.
Huang et al.'s scheme embeds three bits secret message into six bits data codeword by using improved EMD scheme. The number of flipped bits varies according to different secret bits and different carrier data codeword. Table 5 shows an example to count the number of flipped bits of data pair (0, 7) when embedding secret digits 0-7 in it in the field of GF (8). Therefore, we randomly generated 100 bits of secret message, and then embedded secret message into a version 20-H cover QR code according to the embedding process of Huang et al.'s scheme. With 100 embedding iterations, we found out that the embedding efficiency ee Huang close to 1.4. As analyzed in Section 5.3, the embedding efficiency of the proposed scheme is close to 2.9, which is much better than previous two schemes.

VI. CONCLUSION
This paper presents a new secret hiding scheme for QR code based on (8,4) Hamming code, the proposed scheme improves the embedding efficiency on the basis of keeping good secret payload. This method can effectively protect the sensitive information in QR code from being discovered while transmitting in the public channel. Although the error correction capacity of QR code keeps the marked QR code valid after embedded secret message, it also limits the upper bound of secret payload. For future work, we plan to invest the linear characteristic of Reed-Solomon code employed by QR code to improve the secret payload. He is also the author of more than 900 journal articles and has written 36 book chapters. His research interests include computer cryptography, data engineering, and image compression. VOLUME 8, 2020 YUNG-HUI LI (Member, IEEE) received the B.S. degree from National Taiwan University, in 1995, the M.S. degree from the University of Pennsylvania, in 1998, and the Ph.D. degree from the School of Computer Science, Language Technology Institute, Carnegie Mellon University, in 2010. He is currently an Assistant Professor with National Central University. He is also the author of more than 30 conference and journal articles and has written five book chapters. His current research interests include image processing, machine learning, pattern recognition, and biometric recognition.
YANJUN LIU received the Ph.D. degree from the School of Computer Science and Technology, University of Science and Technology of China (USTC), Hefei, China, in 2010. She has been an Assistant Professor with Anhui University, China, since 2010. She currently serves as a Senior Research Fellow with Feng Chia University, Taiwan. Her specialties include E-business security and electronic imaging techniques.