A book printed two-dimensional code security risk automatic inspection system and method
By privately encrypting the first row and first column of the QR code accompanying the book to generate a ciphertext QR code, and combining public and private algorithms for scanning verification, the problem of QR code information leakage in books is solved, and the security inspection and anti-piracy effects are achieved in various regions.
Patent Information
- Application Number
- CN202510299110.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2045-03-13
AI Technical Summary
Existing technologies cannot effectively protect the security of QR codes printed with books, making it easy for information to be leaked and making it difficult for book users and administrators in various regions to inspect the security risks of QR codes.
A proprietary encryption algorithm is used to process the first row and first column of the QR code to generate a ciphertext QR code. The encryption method is changed by periodically updating the proprietary algorithm. By combining public and proprietary algorithms, QR code scanning verification is performed to achieve secure inspection of the QR code.
It achieves secure protection for the QR codes printed with books, enabling users and administrators in various regions to easily conduct inspections and prevent information leakage and piracy.
Smart Images

Figure CN119808807B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data security technology, specifically relating to an automatic inspection system and method for security risks of QR codes printed with books. Background Technology
[0002] Books often include QR codes printed or affixed to them, but these codes are usually generated in plaintext, making the information easily leaked and exploited by book pirates. Although existing technologies exist to encrypt QR code information, the wide geographical distribution of books means that current technologies cannot easily allow book users and administrators in all regions to inspect the security risks of the QR codes printed with books. Summary of the Invention
[0003] This invention provides an automatic inspection method for security risks of QR codes printed with books, the method comprising the following steps:
[0004] S101. Obtain the book's QR code information and use a public QR code algorithm to convert it into a plaintext QR code;
[0005] S102. Using a proprietary encryption algorithm, process the first row and first column of the plaintext QR code to obtain the coordinates of the encryption point; the proprietary encryption algorithm is updated periodically.
[0006] S103. Reverse the data at the coordinates of the encryption point corresponding to the plaintext QR code to generate the ciphertext QR code;
[0007] S104. Print or affix the encrypted QR code to the surface of the book;
[0008] S105. Using a public QR code algorithm, scan and convert the encrypted QR code. If a recognizable book QR code is obtained, it indicates that the QR code is not encrypted, and a warning is issued.
[0009] S106. Using a proprietary encryption algorithm, scan and convert the encrypted QR code. If a recognizable book QR code is obtained, the QR code is considered valid, and a prompt is issued. If an unrecognizable book QR code is obtained, the QR code is considered incorrect, and a warning is issued.
[0010] Furthermore, step S101 specifically includes:
[0011] S1011. Obtain the book's QR code information and confirm the encoding format based on the book's QR code information type;
[0012] S1012. Encode the book QR code information data, converting it into binary data;
[0013] S1013. Add error correction codes, using the BCH Code Reed-Solomon error correction algorithm to process binary data and generate error correction codewords;
[0014] S1014. Construct the final data, arrange the binary data and error correction codewords, and arrange the binary data and error correction codewords into blocks according to the QR code specification;
[0015] S1015. Fill in the data: Fill the QR Code matrix with binary data and error correction codewords;
[0016] Specifically,
[0017]
[0018] in, The obtained plaintext QR code data matrix, For book QR code information, This is a QR code encoding algorithm function. For error correction algorithms, This is QR code data.
[0019] Furthermore, step S101 further includes:
[0020] S1016. Select the masking mode for data masking processing;
[0021] S1017. Add format and version information. The format information includes error correction level and mask mode.
[0022] Furthermore, step S102 specifically includes:
[0023] S1021. Concatenate the first row and first column data of the plaintext QR code into a string S, and use a hash function to encrypt the string S to generate a key;
[0024] S1022. Use the AES encryption algorithm to encrypt the string S again with the key.
[0025]
[0026] in, The string obtained after encryption. The string obtained by concatenating the data in the first row and the first column. It uses the AES encryption algorithm. For hash encryption functions;
[0027] S1023. Divide the re-encrypted string into groups according to the QR code size, with each group corresponding to a coordinate (x, y).
[0028]
[0029]
[0030] in, The string obtained after encryption. , The first The x and y coordinates of each encrypted coordinate. The number of coordinates, , It is a rounding function. To determine the length of the encrypted string, The side length of the plaintext QR code. represent After grouping, the first The sum of the group values.
[0031] Furthermore, step S103 specifically includes:
[0032] Based on the coordinates of the encryption point, the data at the corresponding position in the plaintext QR code is reversed.
[0033]
[0034] in for The data corresponding to the plaintext QR code at the location is either 0 or 1. This represents the XOR operation.
[0035] Furthermore, step S105 specifically includes:
[0036] S1051. Perform grayscale and binarization preprocessing on the scanned image;
[0037] S1052. Determine the position and orientation of the QR code by identifying the positioning clusters and separators in the QR code;
[0038] S1053. Decode the data area in the QR code according to the QR code encoding rules to extract the original data information;
[0039] S1054. Use the BCH Code Reed-Solomon error correction algorithm to perform error correction processing on the decoded data and recover the correct data information. If the decoded data information meets the format and content requirements of the book QR code, it means that the QR code is not encrypted and a warning is issued.
[0040] Specifically, the following processing steps are included:
[0041]
[0042] in, For the recognition results, To obtain the book's QR code image, This is an image preprocessing function. This is a QR code decoding algorithm.
[0043] Furthermore, step S106 specifically includes:
[0044] S1061. Perform grayscale and binarization preprocessing on the scanned image;
[0045] S1062. Determine the position and orientation of the QR code by identifying the positioning clusters and separators in the QR code;
[0046] S1063. Using the private encryption algorithm and key used in step S102, perform inverse operation on the first row and first column of the QR code to obtain the coordinates of the decryption point;
[0047] S1064. Reverse the data at the decryption point coordinates in the ciphertext QR code to restore the plaintext QR code data;
[0048] S1065. Use the QR code decryption algorithm to decode the restored plaintext QR code, extract the book QR code information, and compare and verify it with the book information stored in the system. If they match, the QR code is valid and a prompt is issued; if they do not match or cannot be decoded, it indicates that the QR code is incorrect and a warning is issued.
[0049] The specific process includes:
[0050]
[0051] in, For the recognition results, For QR code decoding algorithms, For the obtained book QR code image, This is an image preprocessing function. The key used by the encryption algorithm. This is the inverse operation function for the encryption algorithm.
[0052] This invention also relates to an automatic security risk inspection system for QR codes printed with books. The system employs the automatic security risk inspection method for QR codes printed with books as described above, and the system includes:
[0053] The conversion module is used to obtain the book's QR code information and convert it into a plaintext QR code using a publicly available QR code algorithm.
[0054] The encryption module is used to process the first row and first column of plaintext QR code data using a proprietary encryption algorithm to obtain the coordinates of the encryption point; the proprietary encryption algorithm is updated periodically.
[0055] The generation module is used to reverse the data at the coordinates of the encryption point corresponding to the plaintext QR code to generate the ciphertext QR code.
[0056] The verification module first uses a public QR code algorithm to scan and convert the encrypted QR code. If a recognizable book QR code is obtained, it indicates that the QR code is not encrypted, and a warning is issued. Then, it uses a private encryption algorithm to scan and convert the encrypted QR code. If a recognizable book QR code is obtained, it indicates that the QR code is valid, and a prompt is issued. If an unrecognizable book QR code is obtained, it indicates that the QR code is incorrect, and a warning is issued.
[0057] The present invention also relates to a computer program product, which includes a computer program executed by a processor for performing an automatic inspection method for security risks of QR codes printed with books as described above.
[0058] The present invention also relates to a computer-readable storage medium for storing a computer program, which is executed by a processor to perform an automatic inspection method for security risks of QR codes printed with books as described above.
[0059] The technical solution of this invention extracts the key features of the QR code and uses a proprietary algorithm for encryption, thereby ensuring the security of the QR code printed with the book. Since the proprietary algorithm is easy to share, it can meet the requirements of book users and managers in various regions to easily inspect the security risks of the QR code printed with the book. Furthermore, the proprietary algorithm can be updated periodically to change the encryption method and prevent piracy. Attached Figure Description
[0060] Figure 1 This is a structural block diagram of an automatic inspection system for security risks of QR codes printed with books, according to the present invention. Detailed Implementation
[0061] The present invention will now be further described with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention. It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of the present invention.
[0062] Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular forms are intended to include the plural forms as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0063] Embodiment 1 of the present invention relates to an automatic inspection method for security risks of QR codes printed with books, the method comprising the following steps:
[0064] S101. Obtain the book's QR code information and use a publicly available QR code algorithm to convert it into a plaintext QR code.
[0065] Specifically, the following processes are included:
[0066] S1011. Obtain the book's QR code information and confirm the encoding format based on the book's QR code information type.
[0067] S1012. Encode the book QR code information data and convert it into binary data.
[0068] S1013. Add error correction codes. Use the BCH Code Reed-Solomon error correction algorithm to process binary data and generate error correction codewords.
[0069] S1014. Construct the final data, arrange the binary data and error correction codewords, and arrange the binary data and error correction codewords into blocks according to the QR code specification.
[0070] S1015. Fill in the data: Fill the QR Code matrix with binary data and error correction codewords.
[0071] S1016. Select the mask mode for data masking.
[0072] S1017. Add format and version information. The format information includes error correction level and mask mode.
[0073] Specifically,
[0074]
[0075] in, The obtained plaintext QR code data matrix, For book QR code information, This is a QR code encoding algorithm function. For error correction algorithms, This is QR code data.
[0076] S102. Using a proprietary encryption algorithm, process the first row and first column of the plaintext QR code to obtain the coordinates of the encryption point.
[0077] The proprietary encryption algorithm is updated periodically.
[0078] Specifically, it includes:
[0079] S1021. Concatenate the first row and first column data of the plaintext QR code into a string S, and use a hash function to encrypt the string S to generate a key.
[0080] S1022. Use the AES encryption algorithm to encrypt the string S again with the key.
[0081]
[0082] in, The string obtained after encryption. The string obtained by concatenating the data in the first row and the first column. It uses the AES encryption algorithm. This is a hash encryption function.
[0083] S1023. Divide the re-encrypted string into groups according to the QR code size, with each group corresponding to a coordinate (x, y).
[0084]
[0085]
[0086] in, The string obtained after encryption. , The first The x and y coordinates of each encrypted coordinate. The number of coordinates, , It is a rounding function. To determine the length of the encrypted string, The side length of the plaintext QR code. represent After grouping, the first The sum of the group values.
[0087] S103. Reverse the data at the coordinates of the encryption point corresponding to the plaintext QR code to generate the ciphertext QR code.
[0088] The result of the above reversal, visually speaking, is that the small squares at the corresponding points in the plain text QR code turn from black to white or from white to black.
[0089] Specifically, it includes:
[0090] Based on the coordinates of the encryption point, the data at the corresponding position in the plaintext QR code is reversed.
[0091]
[0092] in for The data corresponding to the plaintext QR code at the location is either 0 or 1. This represents the XOR operation.
[0093] S104. Print or affix the encrypted QR code to the surface of the book.
[0094] S105. Using a public QR code algorithm, scan and convert the encrypted QR code. If a recognizable book QR code is obtained, it indicates that the QR code is not encrypted, and a warning is issued.
[0095] Specifically, it includes:
[0096] S1051. Perform grayscale and binarization preprocessing on the scanned image.
[0097] S1052. Determine the position and orientation of the QR code by identifying the positioning clusters and separators in the QR code.
[0098] S1053. Decode the data area in the QR code according to the QR code encoding rules to extract the original data information.
[0099] S1054. Use the BCH Code Reed-Solomon error correction algorithm to perform error correction processing on the decoded data and recover the correct data information. If the decoded data information meets the format and content requirements of the book QR code, it means that the QR code is not encrypted and an alert is issued.
[0100] Specifically, the following processing steps are included:
[0101]
[0102] in, For the recognition results, To obtain the book's QR code image, This is an image preprocessing function. This is a QR code decoding algorithm.
[0103] S106. Using a proprietary encryption algorithm, scan and convert the encrypted QR code. If a recognizable book QR code is obtained, the QR code is considered valid, and a prompt is issued. If an unrecognizable book QR code is obtained, the QR code is considered incorrect, and a warning is issued.
[0104] This step specifically includes:
[0105] S1061. Perform grayscale and binarization preprocessing on the scanned image.
[0106] S1062. Determine the position and orientation of the QR code by identifying the positioning clusters and separators in the QR code.
[0107] S1063. Using the private encryption algorithm and key used in step S102, perform inverse operations on the first row and first column of the QR code to obtain the coordinates of the decryption point.
[0108] S1064. Reverse the data at the decryption point coordinates in the ciphertext QR code to restore the plaintext QR code data.
[0109] S1065. Use the QR code decryption algorithm to decode the restored plaintext QR code, extract the book QR code information, and compare and verify it with the book information stored in the system. If they match, the QR code is valid and a prompt is issued; if they do not match or cannot be decoded, it indicates that the QR code is incorrect and a warning is issued.
[0110] The specific process is as follows:
[0111]
[0112] in, For the recognition results, For QR code decoding algorithms, For the obtained book QR code image, This is an image preprocessing function. The key used by the encryption algorithm. This is the inverse operation function for the encryption algorithm.
[0113] Embodiment 2 of the present invention relates to an automatic security risk inspection system for QR codes printed with books. The system employs an automatic security risk inspection method for QR codes printed with books as described in Embodiment 1, as shown in the appendix. Figure 1 As shown, the system includes:
[0114] The conversion module is used to obtain the book's QR code information and convert it into a plaintext QR code using a publicly available QR code algorithm.
[0115] The encryption module is used to process the first row and first column of plaintext QR code data using a proprietary encryption algorithm to obtain the coordinates of the encryption point; the proprietary encryption algorithm is updated periodically.
[0116] The generation module is used to reverse the data at the coordinates of the encryption point corresponding to the plaintext QR code to generate the ciphertext QR code.
[0117] The verification module first uses a public QR code algorithm to scan and convert the encrypted QR code. If a recognizable book QR code is obtained, it indicates that the QR code is not encrypted, and a warning is issued. Then, it uses a private encryption algorithm to scan and convert the encrypted QR code. If a recognizable book QR code is obtained, it indicates that the QR code is valid, and a prompt is issued. If an unrecognizable book QR code is obtained, it indicates that the QR code is incorrect, and a warning is issued.
[0118] Embodiment 3 of the present invention relates to a computer program product, the computer program product comprising a computer program executed by a processor for performing a multimodal intelligent sorting method according to Embodiment 1.
[0119] Embodiment 4 of the present invention relates to a computer-readable storage medium for storing a computer program, which is executed by a processor to perform a multimodal intelligent sorting method according to Embodiment 1.
[0120] The above description is merely a preferred embodiment of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for automatically inspecting security risks of a book printed with a two-dimensional code, characterized in that, The method comprises the following steps: S101. Obtain the book two-dimensional code information, convert it into plaintext two-dimensional code using a public two-dimensional code algorithm; S102. Use a private encryption algorithm to process the first row and first column data of the plaintext two-dimensional code to obtain encrypted point coordinates; the private encryption algorithm is updated irregularly; step S102 specifically comprises: S1021. Concatenate the first row and first column data of the plaintext two-dimensional code into a string S, and use a hash function to encrypt the string S to generate a key; S1022. Use an AES encryption algorithm to encrypt the string S again using the key, S' = AES(hash(S), S) wherein S' is the string obtained after encryption, S is the string obtained by concatenating the first row and first column data, AES() is the AES encryption algorithm, and hash() is the hash encryption function; S1023. Group the string obtained after encryption again according to the size of the two-dimensional code, and each group corresponds to a coordinate (x, y), Wherein, S' is a string obtained after encryption, x j ,y j are the horizontal and vertical coordinate values of the jth encrypted coordinate respectively, k+1 is the number of coordinates, k+1=ceiling(n / m), ceiling() is a rounding up function, n is the length of the encrypted string, m is the length of the plaintext two-dimensional code, represents the sum of the group values of the jth group after grouping of S', S' i represents the value of the ith character in S'. S103. Reverse the data at the encrypted point coordinates corresponding to the plaintext two-dimensional code to generate a ciphertext two-dimensional code; S104. Print or paste the ciphertext two-dimensional code on the surface of the book; S105. Use a public two-dimensional code algorithm to scan and convert the ciphertext two-dimensional code, and if identifiable book two-dimensional code information is obtained, it indicates that the two-dimensional code is not encrypted, and a warning is issued; S106. Use a private encryption algorithm to scan and convert the ciphertext two-dimensional code, and if identifiable book two-dimensional code information is obtained, it indicates that the two-dimensional code is qualified, and a prompt is issued; if unidentifiable book two-dimensional code information is obtained, it indicates that the two-dimensional code is incorrect, and a warning is issued.
2. The method according to claim 1, wherein, Step S101 specifically comprises: S1011. Obtain the book two-dimensional code information, and confirm the encoding format according to the type of the book two-dimensional code information; S1012. Data encode the book two-dimensional code information data, and convert the book two-dimensional code information data into binary data; S1013. Add error correction code, and process the binary data using a BCH Code Reed-Solomon error correction algorithm to generate error correction code words; S1014. Construct the final data, arrange the binary data and error correction code words, and arrange the binary data and error correction code words into blocks according to the specification of QR code; S1015. Fill the binary data and error correction code words into the QR Code matrix; Specifically, A = QR_Code(S, Reed-Solomon(M)) wherein A is the data matrix of the obtained plaintext two-dimensional code, S is the book two-dimensional code information, QR_Code is the QR Code encoding algorithm function, Reed-Solomon() is the error correction algorithm, and M is the two-dimensional code data.
3. The method of claim 1, wherein the method further comprises: Step S101 further comprises: S1016. Select a mask mode for data mask processing; S1017. Add format information and version information, and the format information includes error correction level and mask mode.
4. The method of claim 1, wherein the method further comprises: Step S103 specifically comprises: According to the encrypted point coordinates, reverse the data at the corresponding positions in the plaintext two-dimensional code, A (x,y) = A (x,y) XOR1 where A (x,y) is the data corresponding to the plaintext two-dimensional code at the (x, y) position, the data is 0 or 1, and XOR represents an exclusive OR operation.
5. The method of claim 1, wherein the method further comprises: Step S105 specifically comprises: S1051. Perform gray-scale and binarization preprocessing operations on the scanned image; S1052. Determine the position and direction of the two-dimensional code by recognizing the locating group and separator features in the two-dimensional code; S1053. Decode the data area in the two-dimensional code according to the encoding rules of QR Code, and extract the original data information; S1054. Perform error correction processing on the decoded data using the BCH Code Reed-Solomon error correction algorithm to recover the correct data information, and if the decoded data information meets the format and content requirements of the book two-dimensional code, it is determined that the two-dimensional code is not encrypted, and a warning is issued. Specifically, the following processing procedures are included: R = QR_decode(g(I)) Wherein, R is the recognition result, I is the obtained book two-dimensional code image, g() is the image preprocessing function, and QR_decode() is the QR Code decoding algorithm.
6. The method of claim 1, wherein the method further comprises: Step S106 specifically includes: S1061. Perform gray-scale and binarization preprocessing operations on the scanned image; S1062. Determine the position and direction of the two-dimensional code by recognizing the locating group and separator features in the two-dimensional code; S1063. Perform inverse operation on the data in the first row and the first column of the two-dimensional code using the private encryption algorithm and the key used in step S102 to obtain the coordinates of the decryption point; S1064. Perform reverse operation on the data at the coordinates of the decryption point in the ciphertext two-dimensional code to restore the plaintext two-dimensional code data; S1065. Decode the restored plaintext two-dimensional code using the QR Code decryption algorithm, extract the book two-dimensional code information, and compare and verify it with the book information stored in the system, if they are consistent, the two-dimensional code is qualified, and a prompt is issued; if they are inconsistent or cannot be decoded, it is determined that the two-dimensional code is incorrect, and a warning is issued; The specific process includes: R' = QR_decode(f(key, g(I))) Wherein, R' is the recognition result, QR_decode() is the QR Code decoding algorithm, I is the obtained book two-dimensional code image, g() is the image preprocessing function, key is the key used by the encryption algorithm, and f() is the inverse operation function of the encryption algorithm.
7. A system for automatically inspecting security risks of a printed two-dimensional code in a book, wherein the system adopts the method for automatically inspecting security risks of a printed two-dimensional code in a book according to any one of claims 1-6, and is characterized in that, The system includes: A conversion module for obtaining book two-dimensional code information and converting it into plaintext two-dimensional code using a public two-dimensional code algorithm; An encryption module for processing the data in the first row and the first column of the plaintext two-dimensional code using a private encryption algorithm to obtain the coordinates of the encryption point; A generation module for reversing the data at the coordinates of the encryption point corresponding to the plaintext two-dimensional code to generate a ciphertext two-dimensional code; A verification module for first scanning and converting the ciphertext two-dimensional code using a public two-dimensional code algorithm, and if identifiable book two-dimensional code information is obtained, it is determined that the two-dimensional code is not encrypted, and a warning is issued; then, the ciphertext two-dimensional code is scanned and converted using a private encryption algorithm, and if identifiable book two-dimensional code information is obtained, it is determined that the two-dimensional code is qualified, and a prompt is issued; if unidentifiable book two-dimensional code information is obtained, it is determined that the two-dimensional code is incorrect, and a warning is issued.
8. A computer program product, characterised in that, The computer program product comprises a computer program, which is executed by a processor, and is used for executing the method for automatically inspecting security risks of a book-printed two-dimensional code according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium is used for storing a computer program, which is executed by a processor, and is used for executing the method for automatically inspecting security risks of a book-printed two-dimensional code according to any one of claims 1-6.
Citation Information
Patent Citations
Information encryption and decryption method based on two-dimensional code
CN112134687A