Robust two-dimensional code steganography method based on path planning and pixel flipping
Through algorithms and pixel flip technology that simulate computer mice finding paths in the maze, the problem of difficulty in taking into account both robustness and security in the existing QR code steganography methods is solved, and strong robustness, high security and difficult to easily achieve The perceived QR code steganography method uses the high QR code error tolerance to transmit secret information.
Patent Information
- Application Number
- CN202410695251.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-05-31
AI Technical Summary
The existing QR code steganography method is difficult to make effective compromises between robustness and information volume, and is difficult to achieve high security and invisibility.
Using a method based on path planning and pixel flip, an algorithm that simulates computer mice finding paths in the maze is used to embed secret information into the QR code image, and pixel flips are performed when necessary to ensure the robustness and security of information hiding. .
It realizes a QR code steganography method that is robust, high security and difficult to detect, which can effectively convey secret information, and at the same time, it uses the high tolerance of QR codes to ensure the stability of information hiding.
Smart Images

Figure CN119272791A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of two-dimensional code steganography, and in particular relates to a robust two-dimensional code steganography method based on path planning and pixel flipping. Background Art
[0002] Among the current two-dimensional code steganography methods, information hiding of two-dimensional codes can be divided into transform domain and spatial domain hiding technologies. Transform domain hiding technology first transforms the two-dimensional code image into the frequency domain through different algorithms, mainly discrete cosine transform, discrete Fourier transform, discrete wavelet transform, etc., and realizes information hiding by modifying the frequency domain coefficients. Spatial domain hiding technology mainly embeds hidden information into the redundant information of the image, such as LSB technology, error-allowed embedding technology, etc. Information hiding technology based on two-dimensional codes should have the characteristics of robustness, invisibility, unpredictability, stability, and non-destructiveness of the original information. For information hiding technology, its robustness and the amount of embedded information are always a contradiction, which requires a certain compromise.
[0003] "Computer mouse", English name Micromouse, is a small automatic wheeled intelligent robot composed of embedded microprocessor, sensor and motor. According to the computer mouse maze competition rules specified by the International Institute of Electrical and Electronics Engineering (IEEE), the computer mouse needs to walk by itself in different unknown mazes composed of 16×16 cells of 18cm×18cm, search for information inside the maze and find the path from the starting point to the end point of the maze to quickly reach the end point of the maze. Computer mouse is an embedded mobile robot that can autonomously explore unknown mazes and achieve the shortest path sprint. In order to run at high speed in a small and complex maze, computer mouse has high requirements for control and decision-making performance, and has long been a research hotspot in the field of robotics. For the same maze, different path planning strategies will lead to different path selections. If the QR code is regarded as a maze, given a starting point, an end point and a path finding strategy, it will walk out of a certain path. The left turn and right turn on this path can be used to encode secret information. In view of this, the present invention simulates the process of computer mouse finding the end point in the maze, and proposes a robust QR code steganography method based on path planning and pixel flipping. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a robust two-dimensional code steganography method based on path planning and pixel flipping in view of the shortcomings of the prior art. The two-dimensional code steganography method has the advantages of strong robustness, high security and being difficult to detect, and can effectively transmit secret information using two-dimensional code images.
[0005] The technical solution adopted by the present invention to solve the above technical problems is: a robust two-dimensional code steganography method based on path planning and pixel flipping, characterized in that it includes the following steps:
[0006] S1. Secret Information Embedding
[0007] The secret information is hidden in the plaintext generated QR code image through the watermark embedding algorithm, which specifically includes three steps S1.1-S1.3:
[0008] S1.1. Original QR code image generation
[0009] According to the plaintext information Msg provided by the user, the original QR code image Q with version v and error tolerance e is generated according to the standard GB / T 18284-2000 original , where the value range of the version v of the original QR code image is 1 to 10, and the error tolerance rate e includes three levels: "M", "Q" and "H":
[0010] Q original =G(Msg,v,e)(1)
[0011] S1.2. Binary secret generation
[0012] According to the ciphertext information s provided by the user, use the character encoding mode m c Generate a binary secret, then perform a cyclic redundancy check on the generated binary secret to obtain the binary secret W to be embedded:
[0013] W=CRC(EC(s,m c ))(2)
[0014] S1.3. Secret QR code image and key generation
[0015] According to the original QR code image Q original and the binary secret W to be embedded, using the path planning mode m r Find the right path;
[0016] If the path is found successfully, the encrypted QR code image Q is output final , and the key Key containing the starting point location information, the end point location information, the character encoding mode, and the path planning mode:
[0017] Q final ,Key=EM(Q original ,W,m c ,m r )(3)
[0018] If the path finding fails, the path planning mode, the version of the original QR code image, the error tolerance of the original QR code image, and the value of the ciphertext encoding mode are adjusted in sequence until the path finding is successful;
[0019] If the path finding still fails after adjusting the path planning mode, the version of the original two-dimensional code image, the error tolerance rate of the original two-dimensional code image, and the value of the ciphertext encoding mode in sequence, then a specified number of pixels of the original two-dimensional code image are flipped, and black pixels in the original two-dimensional code image are changed to white pixels or white pixels are changed to black pixels, until the path finding is successful; if the number of flipped pixels reaches the specified number and a suitable path is still not found, the secret information embedding fails and the method ends;
[0020] The specific pseudo code of step S1 above is as follows:
[0021]
[0022] S2. Secret Information Extraction
[0023] The watermark extraction algorithm is used to extract the hidden QR code image Q final The secret information in the code includes three steps S2.1-S2.3:
[0024] S2.1. QR code image reconstruction
[0025] By scanning the encrypted QR code image Q final , capture the two-dimensional code image C, reconstruct the pixels of the two-dimensional code image C, and obtain a high-quality two-dimensional code image Q′:
[0026] Q′=R(C)(4)
[0027] S2.2. Binary Secret Extraction
[0028] The reconstructed QR code image Q′ is decoded using the key Key to extract the original binary secret W′. The specific process is: extract the starting point location information, the end point location information, the character encoding mode, and the path planning mode from the key Key, find a path connecting the starting point and the end point according to the path planning mode, and restore the original binary secret W′:
[0029] W′=DC(Q′,Key)(5)
[0030] S2.3. Secret verification and decryption
[0031] Perform a cyclic redundancy check on the extracted binary secret W′ to obtain the corrected binary sequence. Use the character encoding mode in the key Key to decode the corrected binary sequence and restore the secret plaintext information S′, which is the ciphertext information s:
[0032] S′=EX(CRC(W ′ ),Key)(6)
[0033] The method ends.
[0034] The specific pseudo code of step S2 above is as follows:
[0035]
[0036] Specifically, the pixel flipping strategy in step S1.3 is: without affecting the normal reading of the two-dimensional code image, when a suitable path cannot be found, find a path that satisfies its longest string, and perform pixel flipping near both ends of this path. The number of flipped pixels starts from 1, and each round is executed t times. The number of flipped pixels in the next round is increased by 1, and it is continued for t times until a suitable path is found; if the number of flipped pixels reaches the specified number and a suitable path is still not found, the secret information embedding fails and the method ends.
[0037] Compared with the prior art, the present invention has the following advantages: The robust two-dimensional code steganography method based on path planning and pixel flipping of the present invention utilizes the high fault tolerance of the two-dimensional code. By simulating the path planning algorithm of a computer mouse seeking in a "two-dimensional code maze" and the method of flipping the pixels of the two-dimensional code, it has the advantages of strong robustness, high security, and being difficult to detect, and can effectively transmit secret information using the two-dimensional code image. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a flow chart of the method of the present invention;
[0039] Figure 2 A flowchart of the steps for embedding secret information;
[0040] Figure 3 Flowchart of the decryption steps for secret verification;
[0041] Figure 4 This is the basic structure diagram of a QR code. DETAILED DESCRIPTION
[0042] The present invention is further described in detail below with reference to the accompanying drawings.
[0043] Embodiment: A robust two-dimensional code steganography method based on path planning and pixel flipping. The overall method flow is as follows: Figure 1 As shown, the specific steps include:
[0044] S1. Embed secret information (the flowchart of this step is as follows Figure 2 (shown)
[0045] The secret information is hidden in the plaintext generated QR code image through the watermark embedding algorithm, which specifically includes three steps S1.1-S1.3:
[0046] S1.1. Original QR code image generation
[0047] According to the plaintext information Msg provided by the user, the original QR code image Q with version v and error tolerance e is generated according to the standard GB / T 18284-2000 original , where the value range of the version v of the original QR code image is 1 to 10, and the error tolerance rate e includes three levels: "M", "Q" and "H":
[0048] Q original =G(Msg,v,e)(1)
[0049] S1.2. Binary secret generation
[0050] According to the ciphertext information s provided by the user, use the character encoding mode m c Generate binary secret (users can configure character encoding mode m c ), and then perform a cyclic redundancy check on the generated binary secret to obtain the binary secret W to be embedded. In this embodiment, the character encoding mode m is used. c Convert the ciphertext information s provided by the user into a binary bit string, character encoding mode m c Including but not limited to existing encoding standards such as ISO / IEC 646 and Unicode:
[0051] W=CRC(EC(s,m c ))(2)
[0052] S1.3. Secret QR code image and key generation
[0053] According to the original QR code image Q original and the binary secret W to be embedded, using the path planning mode m r Find the right path;
[0054] If the path is found successfully, the encrypted QR code image Q is output final , and the key Key containing the starting point location information, the end point location information, the character encoding mode, and the path planning mode:
[0055] Q final ,Key=EM(Q original ,W,m c ,m r )(3)
[0056] The path planning mode is customized by the user. In this embodiment, the ciphertext encoding mode is: from the starting position to the end position, the left turn on the path is recorded as "1" and the right turn is recorded as "0". The path planning process is: the original two-dimensional code image Q originalThe white pixels in the image are regarded as channels, and the black pixels are regarded as obstacles. A white pixel is randomly selected as the starting point. From this starting point, a path that can encode the current bit string is found according to the currently selected path planning mode.
[0057] If the path finding fails, the path planning mode, the version of the original QR code image, the error tolerance of the original QR code image, and the value of the ciphertext encoding mode are adjusted in sequence until the path finding is successful;
[0058] If path finding still fails after adjusting the path planning mode, the version of the original QR code image, the error tolerance of the original QR code image, and the value of the ciphertext encoding mode in sequence, the original QR code image is flipped by a specified number of pixels to change the black pixels in the original QR code image to white pixels or the white pixels to black pixels until path finding is successful.
[0059] like Figure 4 As shown in the figure, the QR code is composed of multiple different components, and each area contains specific information, including positioning patterns, alignment patterns, timing modes, format information, encoding data, and version information. Among them, the position detection pattern, the position detection pattern separator, and the positioning pattern are used to locate the QR code. For each QR code, the position is fixed, but the size specifications may vary. The correction pattern is used to determine the specifications, and the number and position of the correction pattern are also determined. The format information indicates the error correction level of the QR code, which is divided into L, M, Q, and H. The version information is the specification of the QR code. The QR code symbol has a total of 40 matrices of specifications, ranging from 21x21 (version 1) to 177x177 (version 40). Each version symbol adds 4 modules on each side compared to the previous version. The data and error correction codewords are the actual stored QR code information, and the error correction codewords are used to correct errors caused by damage to the QR code.
[0060] In order to ensure the readability of the QR code and the concealment of information hiding, the area where pixels are flipped is limited to the data and error correction codeword area.
[0061] Among them, the pixel flipping strategy is: without affecting the normal reading of the QR code image, when a suitable path cannot be found, find a path that satisfies its longest string, and perform pixel flipping near both ends of this path. The number of flipped pixels starts from 1, and each round is executed 50 times. The number of flipped pixels in the next round is increased by 1, and it is continued for 50 times until a suitable path is found; if the number of flipped pixels reaches the user-specified threshold and a suitable path is still not found, the secret information embedding fails and the method ends.
[0062] S2, secret information extraction (the flowchart of this step is as follows Figure 3 (shown)
[0063] The watermark extraction algorithm is used to extract the hidden QR code image Q final The secret information in the code includes three steps S2.1-S2.3:
[0064] S2.1. QR code image reconstruction
[0065] By scanning the encrypted QR code image Q final , the captured two-dimensional code image C is obtained. Since the captured two-dimensional code image C is affected by various factors and will produce unpredictable distortion, in order to facilitate subsequent processing, the two-dimensional code image C is pixel reconstructed to obtain a high-quality two-dimensional code image Q′:
[0066] Q′=R(C)(4)
[0067] Wherein, a digital image processing method is used to reconstruct pixels of the two-dimensional code image C, and the digital image processing method includes but is not limited to one or more of the following methods: contrast brightness adjustment, filtering noise reduction, debinarization, corrosion expansion processing, Canny edge detection, Hough operator fitting straight line, calculation of the coordinates of the four vertices of the two-dimensional code, and affine transformation using the vertex coordinates;
[0068] S2.2. Binary Secret Extraction
[0069] The reconstructed QR code image Q′ is decoded using the key Key to extract the original binary secret W′. The specific process is: extract the starting point location information, the end point location information, the character encoding mode, and the path planning mode from the key Key, find a path connecting the starting point and the end point according to the path planning mode, and restore the original binary secret W′:
[0070] W′=DC(Q′,Key)(5)
[0071] S2.3. Secret verification and decryption
[0072] Perform a cyclic redundancy check on the extracted binary secret W′ to obtain the corrected binary sequence. Use the character encoding mode in the key Key to decode the corrected binary sequence and restore the secret plaintext information S′, which is the ciphertext information s:
[0073] S′=EX(CRC(W ′ ),Key)(6)
[0074] The method ends.
Claims
1. A robust two-dimensional code steganography method based on path planning and pixel flipping, characterized in that: The following steps are involved: S1. Secret Information Embedding The secret information is hidden in the plaintext generated QR code image through the watermark embedding algorithm, which specifically includes three steps S1.1-S1.3: S1.
1. Original QR code image generation According to the plaintext information Msg provided by the user, the original QR code image Q with version v and error tolerance e is generated according to the standard GB / T 18284-2000 original , where the value range of the version v of the original QR code image is 1 to 10, and the error tolerance e includes three levels: "M", "Q" and "H": Q original = G(Msg,v,e) (1) S1.
2. Binary secret generation According to the ciphertext information s provided by the user, use the character encoding mode m c Generate a binary secret, then perform a cyclic redundancy check on the generated binary secret to obtain the binary secret W to be embedded: W = CRC(EC(s ,m c )) (2) S1.
3. Secret QR code image and key generation According to the original QR code image Q original and the binary secret W to be embedded, using the path planning mode m r Find the right path; If the path is found successfully, the encrypted QR code image Q is output final , and the key Key containing the starting point location information, the end point location information, the character encoding mode, and the path planning mode: Q final ,Key = EM(Q original ,W ,m c ,m r ) (3) If the path finding fails, the path planning mode, the version of the original QR code image, the error tolerance of the original QR code image, and the value of the ciphertext encoding mode are adjusted in sequence until the path finding is successful; If the path finding still fails after adjusting the path planning mode, the version of the original two-dimensional code image, the error tolerance rate of the original two-dimensional code image, and the value of the ciphertext encoding mode in sequence, then a specified number of pixels of the original two-dimensional code image are flipped, and black pixels in the original two-dimensional code image are changed to white pixels or white pixels are changed to black pixels, until the path finding is successful; if the number of flipped pixels reaches the specified number and a suitable path is still not found, the secret information embedding fails and the method ends; S2. Secret Information Extraction The watermark extraction algorithm is used to extract the hidden QR code image Q final The secret information in the code includes three steps S2.1-S2.3: S2.
1. QR code image reconstruction By scanning the encrypted QR code image Q final , capture the two-dimensional code image C, reconstruct the pixels of the two-dimensional code image C, and obtain a high-quality two-dimensional code image Q′: Q′= R(C) (4) S2.
2. Binary Secret Extraction The reconstructed QR code image Q′ is decoded using the key Key to extract the original binary secret W′. The specific process is: extract the starting point location information, the end point location information, the character encoding mode, and the path planning mode from the key Key, find a path connecting the starting point and the end point according to the path planning mode, and restore the original binary secret W′: W′= DC(Q′,Key) (5) S2.
3. Secret verification and decryption Perform a cyclic redundancy check on the extracted binary secret W′ to obtain the corrected binary sequence. Use the character encoding mode in the key Key to decode the corrected binary sequence and restore the secret plaintext information S′, which is the ciphertext information s: S′= EX(CRC(W ′ ),Key) (6) The method ends.
2. According to claim 1, a robust two-dimensional code steganography method based on path planning and pixel flipping is characterized in that: The pixel flipping strategy in step S1.3 is: without affecting the normal reading of the two-dimensional code image, when a suitable path cannot be found, find a path that satisfies its longest string, and perform pixel flipping near both ends of this path. The number of flipped pixels starts from 1, and each round is executed t times. The number of flipped pixels in the next round is increased by 1, and it is continued for t times until a suitable path is found; if the number of flipped pixels reaches the specified number and a suitable path is still not found, the secret information embedding fails and the method ends.
Citation Information
Patent Citations
Method for hiding running coding of confidential information
CN102315931A
High-capacity binary image information hiding method
CN108629728A
Two-dimensional code steganography method based on STC coding
CN116976383A
Two-dimensional code, program, information storage medium, and image recognition device
JP2008003791A
Apparatus, method and program
US20100202695A1
Cited By
Two-dimensional code generation method and device, equipment, storage medium and program product
CN121118954A