Construction method and decoding method, device and equipment of two-dimensional code, and storage medium

CN117371475BActive Publication Date: 2026-10-20CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311480755.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-08
Publication Date
2026-10-20
Estimated Expiration
2043-11-08

AI Technical Summary

Technical Problem

[0005]本申请提供一种二维码的构建方法、解码方法、装置、设备及存储介质,用以解决现有技术中二维码中数据进行加密后不可读的问题

Benefits of technology

[0073]本申请提供的二维码的构建方法、解码方法、装置、设备及存储介质,通过确定二维码构建日期、以及二维码构建数据,二维码构建数据包括明文数据和密文数据;根据二维码构建日期,确定目标密钥、以及目标密钥的识别号,目标密钥的识别号包括日期信息和密钥序号信息,日期信息表征日期距离设定日期的天数;根据目标密钥,对密文数据进行加密,得到密文字节码;根据密文字节码、明文字节码、密文定位符、明文定位符、以及目标密钥的识别号,得到二维码图形;确定二维码图形的字节码信息、以及二维码图形中的明文定位符、密文定位符、以及识别号,明文定位符表征明文字节码在二维码图形中的位置,密文字节符表征密文字节码在二维码图形中的位置;根据明文定位符,对字节码信息中与明文定位符相对应的字节码信息进行解码,得到明文数据;根据密文定位符,确定字节码信息中的密文字节码信息;根据识别号,确定字节码信息中的日期信息和密钥序号信息;根据日期信息和密钥序号信息,确定目标密钥;根据目标密钥,对密文字节码信息进行解码,得到密文数据;根据明文数据、以及密文数据,得到二维码图形的原始数据的手段,实现了对明文数据和密文数据进行分区编码加密、以及分区解码解密的效果,使得二维码图形中可以同时包含明文信息和密文信息,提高了二维码的数据存储能力,同时提高了二维码图形中数据的防伪和追溯能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117371475B_ABST
    Figure CN117371475B_ABST
Patent Text Reader

Abstract

The application provides a two-dimensional code construction method, a decoding method, a device, equipment and a storage medium. The method comprises the following steps: determining a two-dimensional code construction date and construction data; determining a target key and an identification number of the target key according to the two-dimensional code construction date, and encrypting ciphertext data to obtain ciphertext byte code; obtaining a two-dimensional code pattern according to the ciphertext byte code, plaintext byte code, ciphertext locator, plaintext locator and the identification number of the target key; determining the plaintext byte code, the ciphertext byte code and the identification number according to the two-dimensional code pattern, and decoding the plaintext byte code; and decoding the ciphertext byte code according to the identification number to obtain original data of the two-dimensional code pattern. The method of the application can transmit public information and private information, improves the anti-counterfeiting capability of the two-dimensional code, and increases the confidentiality and security of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data encryption technology, and in particular to a method for constructing, decoding, apparatus, device, and storage medium for a QR code. Background Technology

[0002] With the development of Internet technology, the advantages of QR code data transmission, storage and recognition technology have attracted more and more attention. QR code technology can realize functions such as data sharing.

[0003] In existing technologies, QR codes mainly adopt Quick Response (QR) codes, which have advantages such as large data capacity, high error correction rate, high coding density, small space occupation, and support for multiple data encodings. Relying on positioning graphics and verification, QR codes can achieve high-speed 360-degree reading.

[0004] However, the openness and transparency of QR code algorithms mean that QR codes are easily copied and generated, and anyone can easily obtain all the information in a QR code, thus reducing the effectiveness of using QR codes for anti-counterfeiting verification. Summary of the Invention

[0005] This application provides a method for constructing a QR code, a method for decoding a QR code, an apparatus, a device, and a storage medium to solve the problem in the prior art that the data in a QR code is unreadable after encryption.

[0006] Firstly, this application provides a method for constructing a QR code, comprising:

[0007] Determine the date the QR code was created, as well as the QR code creation data, which includes plaintext and ciphertext data.

[0008] Based on the date the QR code was created, the target key and its identification number are determined. The identification number of the target key includes date information and key sequence number information. The date information represents the number of days since the set date.

[0009] Based on the target key, the ciphertext data is encrypted to obtain the ciphertext bytecode;

[0010] A QR code image is obtained based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key. The plaintext bytecode is the bytecode obtained by encrypting the plaintext data. The ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data.

[0011] In this embodiment of the application, determining the target key and its identification number based on the QR code creation date includes:

[0012] Based on the QR code creation date, determine the number of days between the QR code creation date and the set date, the initial key within the QR code creation date, and the sequence number of the initial key;

[0013] Based on the initial key, determine the target key for the ciphertext data;

[0014] Based on the sequence number information of the initial key, determine the target key sequence number information of the target key;

[0015] Based on the number of days between the constructed date and the set date using the QR code, as well as the target key sequence number, the identification number of the encrypted data is determined.

[0016] In this embodiment of the application, the ciphertext data is encrypted according to the target key to obtain ciphertext bytecode, including:

[0017] The target key is expanded to obtain multiple sets of key data;

[0018] The ciphertext data is grouped to obtain target ciphertext data of the same length.

[0019] Based on multiple sets of key data, the target ciphertext data is encrypted sequentially to obtain the target ciphertext byte block;

[0020] By concatenating the target ciphertext byte blocks, the ciphertext bytecode is obtained.

[0021] In this embodiment of the application, before obtaining the QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, the method further includes:

[0022] Based on the QR code construction data, determine the plaintext data in the QR code construction data;

[0023] Encode the plaintext data to obtain plaintext bytecode;

[0024] Based on the plaintext bytecode, determine the plaintext locator corresponding to the plaintext bytecode. The plaintext locator represents the position of the plaintext bytecode in the QR code.

[0025] Based on the ciphertext bytecode, determine the ciphertext locator corresponding to the ciphertext bytecode. The ciphertext locator indicates the position of the ciphertext bytecode in the QR code.

[0026] In this embodiment of the application, a QR code image is obtained based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, including:

[0027] The ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the target key identifier are concatenated to obtain the full-text bytecode;

[0028] Generate error correction codes for the full-text bytecode based on the full-text bytecode.

[0029] The error correction code is inserted into the full-text bytecode to obtain the updated full-text bytecode;

[0030] The updated full-text bytecode is encoded to obtain a QR code image.

[0031] Secondly, this application provides a method for decoding a QR code, including:

[0032] The bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image are determined. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image.

[0033] Based on the plaintext locator, the bytecode information corresponding to the plaintext locator in the bytecode information is decoded to obtain the plaintext data;

[0034] Based on the ciphertext locator, the ciphertext bytecode information in the bytecode information can be determined;

[0035] Based on the identification number, determine the date information and key sequence number information in the bytecode information;

[0036] The target key is determined based on the date and key sequence number information;

[0037] Based on the target key, the ciphertext bytecode information is decoded to obtain the ciphertext data;

[0038] The original data of the QR code image is obtained from the plaintext data and the encrypted data.

[0039] In this embodiment of the application, determining the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image, includes:

[0040] Based on the QR code image, decode the QR code image to obtain the initial information in the QR code image;

[0041] Based on the error correction algorithm, the initial information is decoded to determine the bytecode information, plaintext locator, ciphertext locator, and identification number of the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image.

[0042] In this embodiment of the application, based on the plaintext locator, the bytecode information corresponding to the plaintext locator in the bytecode information is decoded to obtain plaintext data, including:

[0043] Based on the plaintext locator, determine the plaintext bytecode information in the bytecode information;

[0044] Decode the plaintext bytecode information to obtain the plaintext data in the QR code image.

[0045] In this embodiment of the application, the target key is determined based on date information and key serial number information, including:

[0046] Based on the date information, determine the number of days, which is the number of days between the date the QR code image was created and the set date;

[0047] Based on the number of days, determine the date the QR code image was created;

[0048] Based on the construction date, determine the initial key within the construction date, as well as the initial key sequence number;

[0049] Based on the key sequence number information, determine the target key sequence number information that matches the key sequence number information in the initial key sequence number information;

[0050] Based on the target key sequence number information, determine the target key in the initial key that corresponds to the target key sequence number information.

[0051] In this embodiment of the application, the ciphertext bytecode information is decoded according to the target key to obtain ciphertext data, including:

[0052] The target key is expanded to obtain multiple sets of key data;

[0053] The ciphertext bytecode information is grouped to obtain target ciphertext bytecode with the same length;

[0054] Based on multiple sets of key data, the target ciphertext bytecode is decoded sequentially to obtain multiple sets of ciphertext data;

[0055] Multiple sets of ciphertext data are concatenated to obtain the ciphertext data.

[0056] Thirdly, this application provides a QR code construction apparatus, comprising:

[0057] The first determining module is used to determine the QR code creation date and the QR code creation data, which includes plaintext data and ciphertext data.

[0058] The second determining module is used to determine the target key and the identification number of the target key based on the date of the QR code construction. The identification number of the target key includes date information and key serial number information. The date information represents the number of days between the target date and the set date.

[0059] The ciphertext bytecode acquisition module is used to encrypt ciphertext data according to the target key to obtain ciphertext bytecode;

[0060] The QR code image generation module is used to generate a QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key. The plaintext bytecode is the bytecode obtained by encrypting the plaintext data. The ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data.

[0061] Fourthly, this application provides a QR code decoding device, comprising:

[0062] The QR code image determination module is used to determine the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext bytecode represents the position of the ciphertext bytecode in the QR code image.

[0063] The plaintext data acquisition module is used to decode the bytecode information corresponding to the plaintext locator in the bytecode information according to the plaintext locator to obtain the plaintext data;

[0064] The ciphertext bytecode determination module is used to determine the ciphertext bytecode information in the bytecode information based on the ciphertext locator;

[0065] The bytecode information determination module is used to determine the date information and key sequence number information in the bytecode information based on the identification number;

[0066] The target key determination module is used to determine the target key based on date information and key serial number information;

[0067] The ciphertext data acquisition module is used to decode the ciphertext bytecode information according to the target key to obtain the ciphertext data;

[0068] The raw data acquisition module is used to obtain the raw data of the QR code image based on the plaintext data and the ciphertext data.

[0069] Fifthly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0070] The memory stores computer-executed instructions;

[0071] The processor executes computer execution instructions stored in the memory to implement the method of the embodiments of this application.

[0072] In a sixth aspect, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods of the embodiments of this application.

[0073] The QR code construction method, decoding method, apparatus, device, and storage medium provided in this application determine the QR code construction date and QR code construction data, which includes plaintext data and ciphertext data; based on the QR code construction date, determine the target key and its identification number, which includes date information and key sequence number information, with the date information representing the number of days since the set date; encrypt the ciphertext data according to the target key to obtain ciphertext bytecode; obtain a QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key; determine the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number within the QR code image, where the plaintext locator represents the position of the plaintext bytecode within the QR code image, and the ciphertext bytecode represents... The method involves: 1) determining the location of the encrypted bytecode within the QR code image; 2) decoding the bytecode information corresponding to the plaintext locator to obtain the plaintext data; 3) identifying the encrypted bytecode information within the bytecode information based on the encrypted locator; 4) determining the date and key sequence number information within the bytecode information based on the identification number; 5) determining the target key based on the date and key sequence number information; 6) decoding the encrypted bytecode information based on the target key to obtain the encrypted data; and 7) obtaining the original data of the QR code image based on the plaintext and encrypted data. This method achieves the effect of partitioned encoding and encryption, as well as partitioned decoding and decryption of plaintext and encrypted data, allowing the QR code image to simultaneously contain both plaintext and encrypted information. This improves the data storage capacity of the QR code and enhances the anti-counterfeiting and traceability capabilities of the data within the QR code image. Attached Figure Description

[0074] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0075] Figure 1 A flowchart illustrating the method for constructing a QR code as provided in this application embodiment;

[0076] Figure 2 A flowchart illustrating the QR code decoding method provided in this application embodiment;

[0077] Figure 3 A flowchart illustrating another method for constructing a QR code provided in this application embodiment;

[0078] Figure 4 A flowchart illustrating another QR code decoding method provided in this application embodiment;

[0079] Figure 5A schematic diagram of the structure of the QR code construction device provided in the embodiments of this application;

[0080] Figure 6 This is a schematic diagram of the structure of a QR code decoding device provided in an embodiment of this application;

[0081] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0082] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0083] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0084] In existing technologies, QR codes are typically used for encryption when encrypting QR codes. This makes the data in QR codes easily accessible, reducing their anti-counterfeiting capabilities. Furthermore, the entire data of the QR code is overwritten and then encrypted, making the entire QR code data unreadable on ordinary devices.

[0085] To address the aforementioned issues, this application provides a QR code construction method, decoding method, apparatus, device, and storage medium. This method partitions the data used to construct the QR code graphic. Publicly available plaintext data is standardly encoded to generate location information. For privately controlled encrypted data, encrypted and encoded based on the date information of QR code construction, location information is also generated. Simultaneously, an identification number for the encrypted data is obtained based on the date information. During decoding, the positions of the plaintext and encrypted data are determined based on the location, and the encrypted data is decoded based on the identification number. Publicly available data is decoded using a standard decoding method. This solves the problem of existing QR codes being unreadable after encryption. Furthermore, the constructed QR code can simultaneously contain both plaintext and encrypted data, enabling the transmission of both public and private data, thus improving the data protection and anti-counterfeiting capabilities of the QR code.

[0086] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0087] The execution entity for the QR code construction and decoding methods provided in this application embodiment can be a server. The server can be a computer or other similar device. This embodiment does not impose any particular restrictions on the implementation method of the execution subject, as long as the execution subject can determine the QR code construction date and the QR code construction data; determine the target key and the target key identification number based on the QR code construction date; encrypt the ciphertext data based on the target key to obtain ciphertext bytecode; obtain the QR code graphic based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the target key identification number; or determine the bytecode information of the QR code graphic, as well as the plaintext locator, ciphertext locator, and identification number in the QR code graphic; decode the bytecode information corresponding to the plaintext locator in the bytecode information based on the plaintext locator to obtain plaintext data; determine the ciphertext bytecode information in the bytecode information based on the ciphertext locator; determine the date information and key sequence number information in the bytecode information based on the identification number; determine the target key based on the date information and key sequence number information; decode the ciphertext bytecode information based on the target key to obtain ciphertext data; and obtain the original data of the QR code graphic based on the plaintext data and the ciphertext data.

[0088] Bytecode refers to binary data encoded from source data, including plaintext bytecode and ciphertext bytecode.

[0089] Plaintext bytecode refers to data in bytecode that can be made public.

[0090] Ciphertext bytecode refers to the data in bytecode that needs to be encrypted.

[0091] Plaintext locators are the marker symbols used to locate plaintext bytecode within a QR code graphic.

[0092] Cipher locator refers to the location marker symbol of the ciphertext bytecode in the QR code graphic.

[0093] Figure 1 This is a flowchart illustrating the QR code construction method provided in an embodiment of this application. Figure 1 As shown, the method may include:

[0094] S101. Determine the QR code creation date and the QR code creation data, which includes plaintext data and encrypted data.

[0095] The QR code creation date refers to the date on which the QR code was created.

[0096] Plaintext data refers to data that is used to generate QR code images and can be made public.

[0097] Encrypted data refers to data used to generate QR code images that is not allowed to be disclosed.

[0098] When constructing a QR code, it is necessary to determine the date of construction, all data that the QR code needs to contain, plaintext data that can be publicly known, and encrypted data that is not allowed to be publicly known.

[0099] S102. Based on the date constructed by the QR code, determine the target key and the identification number of the target key. The identification number of the target key includes date information and key sequence number information. The date information represents the number of days from the set date.

[0100] Here, the key refers to the parameter in an algorithm that converts ciphertext data into ciphertext bytecode, including symmetric keys and asymmetric keys.

[0101] The identification number refers to the binary number of the key used to generate the ciphertext bytecode, which includes a 16-bit binary number representing the date and a 2-bit binary number representing the sequence number.

[0102] In this embodiment of the application, determining the target key and its identification number based on the QR code creation date includes:

[0103] Based on the QR code creation date, determine the number of days between the QR code creation date and the set date, the initial key within the QR code creation date, and the sequence number of the initial key;

[0104] Based on the initial key, determine the target key for the ciphertext data;

[0105] Based on the sequence number information of the initial key, determine the target key sequence number information of the target key;

[0106] Based on the number of days between the constructed date and the set date using the QR code, as well as the target key sequence number, the identification number of the encrypted data is determined.

[0107] The process involves several steps. First, based on the date the QR code is generated, the number of days between that date and a predetermined date is determined and converted into a 16-bit binary number M. Simultaneously, several keys are randomly generated within that date, and each key is assigned a corresponding serial number. One key is randomly selected from these keys as the target key for encrypting the ciphertext data, and its serial number is determined and converted into a binary number N. Assuming the number of bits in binary number N is p, the number of bytes q required to store this serial number is calculated by dividing p by 8 and rounding up. If the number of bits in binary number N is less than 8q, it is padded with 0s to fill in the higher bits. The number of bytes q is then converted into a 2-bit binary number R. Finally, the date binary number M, the serial number byte number R, and the serial number binary number N are concatenated to obtain the identification number of the ciphertext data.

[0108] S103. Encrypt the ciphertext data according to the target key to obtain the ciphertext bytecode.

[0109] In this embodiment of the application, the ciphertext data is encrypted according to the target key to obtain ciphertext bytecode, including:

[0110] The target key is expanded to obtain multiple sets of key data;

[0111] The ciphertext data is grouped to obtain target ciphertext data of the same length.

[0112] Based on multiple sets of key data, the target ciphertext data is encrypted sequentially to obtain the target ciphertext byte block;

[0113] By concatenating the target ciphertext byte blocks, the ciphertext bytecode is obtained.

[0114] The process involves expanding the target key into multiple 128-bit target key data sets, dividing the ciphertext data into multiple 16-bit target ciphertext data sets (each bit being 8 bits), and performing ten rounds of byte substitution, row shifting, column mixing, and round key addition on the target ciphertext data to obtain multiple target ciphertext byte blocks. These multiple target ciphertext byte blocks are then concatenated to obtain the ciphertext bytecode. Row shifting refers to a simple left circular shift operation. Column mixing involves multiplying the shifted state matrix with a fixed matrix to obtain a confused state matrix. Round key addition involves performing a bitwise XOR operation between the 128-bit round key and the data in the state matrix.

[0115] S104. Based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, a QR code graphic is obtained. The plaintext bytecode is the bytecode obtained by encrypting the plaintext data. The ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data.

[0116] In this embodiment of the application, before obtaining the QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, the method further includes:

[0117] Based on the QR code construction data, determine the plaintext data in the QR code construction data;

[0118] Encode the plaintext data to obtain plaintext bytecode;

[0119] Based on the plaintext bytecode, determine the plaintext locator corresponding to the plaintext bytecode. The plaintext locator represents the position of the plaintext bytecode in the QR code.

[0120] Based on the ciphertext bytecode, determine the ciphertext locator corresponding to the ciphertext bytecode. The ciphertext locator indicates the position of the ciphertext bytecode in the QR code.

[0121] Specifically, based on the data required to construct the QR code, the plaintext data that can be published is determined. This plaintext data is then encoded using a QR encoding algorithm to obtain the plaintext bytecode in the QR code image. The position of the plaintext bytecode in the QR code image is determined based on this plaintext bytecode, and the corresponding plaintext byte character is also determined based on this position. Similarly, the corresponding ciphertext byte character is determined based on the position of the ciphertext bytecode in the QR code image.

[0122] The QR encoding algorithm converts the data to be encoded into binary code, and then groups it according to certain rules so that each group of data becomes a character.

[0123] In this embodiment of the application, a QR code image is obtained based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, including:

[0124] The ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the target key identifier are concatenated to obtain the full-text bytecode;

[0125] Generate error correction codes for the full-text bytecode based on the full-text bytecode.

[0126] The error correction code is inserted into the full-text bytecode to obtain the updated full-text bytecode;

[0127] The updated full-text bytecode is encoded to obtain a QR code image.

[0128] Error-correcting codes are codes that can automatically correct errors that occur during data transmission at the receiving end. They are verification data obtained by calculating the full-text bytecode. Based on this verification data, the recoverability of the full-text bytecode can be guaranteed. For example, error-correcting codes can be generated using the Reed-Solomon algorithm.

[0129] The Reed-Solomon algorithm is an error correction algorithm that expands redundant content in any information to obtain longer information. This longer information can be perfectly corrected and decoded after being transmitted with noise, as long as the number of errors is less than a predefined value.

[0130] By concatenating the obtained ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the target key's identifier, the initial full-text bytecode of the QR code image can be obtained. Then, according to the Reed-Solomon algorithm, error-correcting bytecode with a certain degree of redundancy is obtained. This error-correcting bytecode is put into the initial full-text bytecode to obtain the updated full-text bytecode. Finally, the updated full-text bytecode is encoded according to the QR encoding flag to obtain a QR code image that contains both plaintext and ciphertext data.

[0131] The QR code construction method provided in this application can determine the QR code construction date and QR code construction data, which includes plaintext data and ciphertext data; determine the target key and its identification number based on the QR code construction date, where the target key identification number includes date information and key sequence number information, and the date information represents the number of days since the set date; encrypt the ciphertext data based on the target key to obtain ciphertext bytecode; and obtain the QR code graphic based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and target key identification number. Here, the plaintext bytecode is the bytecode obtained after encrypting the plaintext data, and the ciphertext locator and plaintext locator represent the positions of the ciphertext data and plaintext data in the QR code construction data, respectively. This method enables a QR code graphic to contain both public and private data, thus solving the problem in existing technologies where QR code graphics can only contain public or only private information, and improving the data capacity of the QR code.

[0132] Figure 2 This is a flowchart illustrating the QR code decoding method provided in an embodiment of this application. Figure 2 As shown, the method may include:

[0133] S201. Determine the bytecode information of the QR code graphic, as well as the plaintext locator, ciphertext locator, and identification number in the QR code graphic. The plaintext locator represents the position of the plaintext bytecode in the QR code graphic, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code graphic.

[0134] In this embodiment of the application, determining the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image, includes:

[0135] Based on the QR code image, decode the QR code image to obtain the initial information in the QR code image;

[0136] Based on the error correction algorithm, the initial information is decoded to determine the bytecode information, plaintext locator, ciphertext locator, and identification number of the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image.

[0137] Specifically, the QR code image is decoded according to the QR standard decoding method to obtain the initial information contained in the QR code image. The Reed-Solomon algorithm is then used to decode the initial information to obtain the plaintext bytecode, ciphertext bytecode, ciphertext locator, and identification number in the QR code image.

[0138] S202. Based on the plaintext locator, decode the bytecode information corresponding to the plaintext locator in the bytecode information to obtain the plaintext data.

[0139] In this embodiment of the application, the plaintext data is obtained by decoding the bytecode information corresponding to the plaintext locator in the bytecode information according to the plaintext locator, including:

[0140] Based on the plaintext locator, determine the plaintext bytecode information in the bytecode information;

[0141] Decode the plaintext bytecode information to obtain the plaintext data in the QR code image.

[0142] Specifically, the plaintext bytecode in the QR code is determined based on the plaintext locator in the QR code image. The plaintext bytecode is then decoded using the QR standard decoding algorithm to obtain the plaintext data contained in the QR code image.

[0143] S203. Determine the ciphertext bytecode information in the bytecode information based on the ciphertext locator.

[0144] Specifically, based on the ciphertext locator in the QR code image, the position information of the ciphertext bytecode information in the QR code image can be determined, and based on this position information, the ciphertext bytecode information in the bytecode information can be determined.

[0145] S204. Based on the identification number, determine the date information and key sequence number information in the bytecode information.

[0146] Specifically, based on the identification number, the binary number M of 16 bits in the identification number is read, and the binary number M is converted into an integer m. m is the number of days between the date of generating the QR code graphic and the set date. Adding m to the set date gives the date t of generating the QR code graphic. The binary number N of 2 bits in the identification number is read, and the binary number N is converted into an integer n. 8n bits are read and converted into an integer p, which is the key sequence number for generating the encrypted data in the QR code graphic.

[0147] S205. Determine the target key based on the date information and key serial number information.

[0148] In this embodiment of the application, determining the target key based on date information and key serial number information includes:

[0149] Based on the date information, determine the number of days, which is the number of days between the date the QR code image was created and the set date;

[0150] Based on the number of days, determine the date the QR code image was created;

[0151] Based on the construction date, determine the initial key within the construction date, as well as the initial key sequence number;

[0152] Based on the key sequence number information, determine the target key sequence number information that matches the key sequence number information in the initial key sequence number information;

[0153] Based on the target key sequence number information, determine the target key in the initial key that corresponds to the target key sequence number information.

[0154] S206. Decode the ciphertext bytecode information according to the target key to obtain the ciphertext data.

[0155] In this embodiment of the application, the ciphertext bytecode information is decoded according to the target key to obtain ciphertext data, including:

[0156] The target key is expanded to obtain multiple sets of key data;

[0157] The ciphertext bytecode information is grouped to obtain target ciphertext bytecode with the same length;

[0158] Based on multiple sets of key data, the target ciphertext bytecode is decoded sequentially to obtain multiple sets of ciphertext data;

[0159] Multiple sets of ciphertext data are concatenated to obtain the ciphertext data.

[0160] The target key is divided into multiple key data of the same length, and the ciphertext bytecode information is divided into multiple target ciphertext bytecodes of the same length. By sequentially performing reverse shift, reverse byte substitution, round key addition, and reverse column mixing on the target ciphertext bytecode, multiple sets of ciphertext data can be obtained. The ciphertext data is then concatenated in sequence to obtain the ciphertext data.

[0161] S207. Based on the plaintext data and the ciphertext data, obtain the original data of the QR code image.

[0162] The QR code decoding method provided in this application can determine the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image. Based on the plaintext locator, the bytecode information corresponding to the plaintext locator in the bytecode information is decoded to obtain plaintext data. Based on the ciphertext locator, the ciphertext bytecode information in the bytecode information is determined. Based on the identification number, the date information and key sequence number information in the bytecode information are determined. Based on the date information and key sequence number information, the target key is determined. Based on the target key, the ciphertext bytecode information is decoded to obtain ciphertext data. Based on the plaintext data, ciphertext data, and the original data of the QR code image, the method realizes the partitioned decryption of the QR code image, thereby solving the problem of insecurity in the existing QR code image decoding methods and improving the reliability and security of the data in the QR code image.

[0163] Figure 3 This is a flowchart illustrating another method for constructing a QR code, provided in an embodiment of this application. Figure 3 As shown, the method may include:

[0164] S301. Determine the plaintext region and the corresponding end symbol for the plaintext region.

[0165] The plaintext area can refer to the publicly available information in the QR code graphic, including format information, version information, and plaintext data information.

[0166] The terminator can refer to the information in the QR code graphic that indicates the end of the plaintext area, or it can refer to a binary number of four bit words. For example, the terminator can refer to the binary number 0000.

[0167] S302. Randomly generate an initial key.

[0168] The process involves determining the date for constructing the QR code, randomly generating an initial key within that date, and assigning a serial number to the initial key in sequence.

[0169] S303. Determine the target key and the sequence number corresponding to the target key based on the initial key.

[0170] Among them, a key is randomly selected from the initial key as the target key, and the sequence number is the one corresponding to the target key.

[0171] S304. Encrypt the information to be encrypted according to the Advanced Encryption Standard algorithm to obtain ciphertext bytecode and a corresponding identifier.

[0172] Among them, the Advanced Encryption Standard (AES) algorithm is one of the most common QR code encryption algorithms. By performing AES block encryption on QR code data, block data of the same length can be obtained until a complete encrypted QR code is obtained.

[0173] The identifier can refer to the marker that marks the beginning of the ciphertext area in the QR code image, or it can refer to a binary number of ten bits. For example, the identifier can be the binary number 1111111111.

[0174] S305. Based on the target key and the sequence number corresponding to the target key, determine the identification number corresponding to the ciphertext bytecode.

[0175] The identification number consists of three parts: date, number of bytes for the sequence number, and sequence number. The date is a 16-bit binary number representing the number of days since January 1, 2020. The number of bytes for the sequence number is a 2-bit binary number representing the number of bytes for the next sequence number. The number of bits in the sequence number can be multiplied by 8. For example, to calculate the number of days between the current date and January 1, 2020, convert it to a 16-bit binary number m. Convert the sequence number to a binary number n. Let the number of bits in binary number n be p. Calculate the number of bytes required to store the sequence number, which is the number of bits in the binary number divided by 8 and then rounded up. If the number of bits in binary number n is less than 8q bits, pad the higher bits with 0. Convert the number of bytes for the sequence number q to a 2-bit binary number r. Concatenate the binary date m, the number of bytes for the sequence number r, and the sequence number n to obtain the bytecode, thus obtaining the identification number.

[0176] S306. Encode the plaintext according to the QR code data encoding standard to obtain the plaintext bytecode;

[0177] S307. Concatenate the plaintext bytecode with the end character, identifier, identification number, and ciphertext bytecode to obtain the fulltext bytecode;

[0178] S308. Generate error correction codes according to the error correction algorithm and concatenate them into the full-text bytecode.

[0179] Among them, the error correction algorithm can refer to the Reed-Solomon algorithm, which calculates the verification data from the original data, and then ensures the recoverability of the original data based on the verification data.

[0180] S309. Convert the full-text bytecode into a QR code image according to the QR standard.

[0181] Another method for constructing a QR code provided in this application involves encrypting the information to be encrypted using a randomly generated key each day, generating an identification number and a marker for the information to be encrypted; encrypting the plaintext data using the QR encoding standard to obtain plaintext bytecode and a plaintext bytecode terminator; concatenating the plaintext bytecode, terminator, identifier, and ciphertext to generate an error correction code, thus obtaining the QR code image. This allows for partitioned encryption of the QR code image based on the plaintext and ciphertext, enabling the QR code image to contain both public and private data, improving the anti-counterfeiting capabilities of the QR code image and increasing its privacy.

[0182] Figure 4 This is a flowchart illustrating another QR code decoding method provided in an embodiment of this application. Figure 4 As shown, the method may include:

[0183] S401. Read the QR code image and determine the original byte stream.

[0184] The byte stream is mainly composed of bytes. By reading the QR code image, the 0 and 1 modules in the QR code image are determined. Based on the position of the 0 and 1 modules, all the byte information of the QR code image is determined. Based on the byte information, the original byte stream in the QR code image can be determined.

[0185] S402. Use the Reed-Solomon algorithm to decode the original byte stream, obtain the byte array, and convert it into a bit stream.

[0186] A bit stream is a data stream consisting of a string of binary bits, where each binary bit represents a logical value of 0 or 1.

[0187] S403. Determine the first end symbol, and decode the bit stream before the end symbol according to the QR data encoding standard to obtain plaintext data.

[0188] Specifically, based on the QR code image, the position of the end-of-line character is determined. Based on the position of the end-of-line character, the position of the bitstream preceding the end-of-line character is determined, which is the plaintext bytecode region. This region of bitstream is then processed according to the QR code.

[0189] S404, Read the marker and identification number after the end marker.

[0190] The process involves reading the identification number, converting its 16 bits into an integer m (the number of days between the date the QR code image was generated and the set date), adding m days to the set date to obtain the date t when the QR code image was generated, reading 2 bits from the identification number and converting them into an integer n, and reading n*8 bits and converting them into an integer p (the sequence number in the identification number).

[0191] S405. Obtain the target key based on the date and serial number information in the identification number;

[0192] S406. Read the ciphertext information, decrypt the ciphertext using the AES algorithm, and obtain the original encrypted information.

[0193] Another QR code decoding method provided in this application embodiment can read the end symbol, identifier, and identification number in the QR code graphic, decode the plaintext bytecode according to the position of the end symbol, and decode the ciphertext bytecode according to the identifier and identification number, thereby reading the plaintext data and ciphertext data in the QR code. This allows the plaintext data and ciphertext data to be directly located based on the end symbol and identifier in the QR code graphic, thus speeding up the QR code decoding speed and improving the QR code decoding efficiency.

[0194] Figure 5 This is a schematic diagram of the structure of the QR code construction device provided in this embodiment of the application. Figure 5 As shown, the QR code construction device 50 includes: a first determining module 501, a second determining module 502, a ciphertext bytecode obtaining module 503, and a QR code image obtaining module 504. Wherein:

[0195] The first determining module 501 is used to determine the QR code construction date and the QR code construction data, which includes plaintext data and ciphertext data.

[0196] The second determining module 502 is used to determine the target key and the identification number of the target key based on the date of the QR code construction. The identification number of the target key includes date information and key serial number information. The date information represents the number of days from the set date.

[0197] The ciphertext bytecode acquisition module 503 is used to encrypt the ciphertext data according to the target key to obtain the ciphertext bytecode;

[0198] The QR code image acquisition module 504 is used to obtain a QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key. The plaintext bytecode is the bytecode obtained by encrypting the plaintext data, the ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data.

[0199] In this embodiment of the application, the second determining module 502 may also be specifically used for:

[0200] Based on the QR code creation date, determine the number of days between the QR code creation date and the set date, the initial key within the QR code creation date, and the sequence number of the initial key;

[0201] Based on the initial key, determine the target key for the ciphertext data;

[0202] Based on the sequence number information of the initial key, determine the target key sequence number information of the target key;

[0203] Based on the number of days between the constructed date and the set date using the QR code, as well as the target key sequence number, the identification number of the encrypted data is determined.

[0204] In this embodiment of the application, the ciphertext bytecode acquisition module 503 can also be specifically used for:

[0205] The target key is expanded to obtain multiple sets of key data;

[0206] The ciphertext data is grouped to obtain target ciphertext data of the same length.

[0207] Based on multiple sets of key data, the target ciphertext data is encrypted sequentially to obtain the target ciphertext byte block;

[0208] By concatenating the target ciphertext byte blocks, the ciphertext bytecode is obtained.

[0209] In this embodiment of the application, the QR code image obtaining module 504 can also be specifically used for:

[0210] Based on the QR code construction data, determine the plaintext data in the QR code construction data;

[0211] Encode the plaintext data to obtain plaintext bytecode;

[0212] Based on the plaintext bytecode, determine the plaintext locator corresponding to the plaintext bytecode. The plaintext locator represents the position of the plaintext bytecode in the QR code.

[0213] Based on the ciphertext bytecode, determine the ciphertext locator corresponding to the ciphertext bytecode. The ciphertext locator indicates the position of the ciphertext bytecode in the QR code.

[0214] In this embodiment of the application, the QR code image obtaining module 504 can also be specifically used for:

[0215] The ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the target key identifier are concatenated to obtain the full-text bytecode;

[0216] Generate error correction codes for the full-text bytecode based on the full-text bytecode.

[0217] The error correction code is inserted into the full-text bytecode to obtain the updated full-text bytecode;

[0218] The updated full-text bytecode is encoded to obtain a QR code image.

[0219] As can be seen from the above, the QR code construction device 50 of this application embodiment comprises a first determining module 501, used to determine the QR code construction date and QR code construction data, the QR code construction data including plaintext data and ciphertext data; a second determining module 502, used to determine the target key and the identification number of the target key according to the QR code construction date, the identification number of the target key including date information and key sequence number information, the date information representing the number of days from the set date; a ciphertext bytecode obtaining module 503, used to encrypt the ciphertext data according to the target key to obtain ciphertext bytecode; and a QR code graphic obtaining module 504, used to obtain the QR code graphic according to the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, wherein the plaintext bytecode is the bytecode obtained after encrypting the plaintext data, the ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data. Therefore, by partitioning and encrypting plaintext and ciphertext data, the phenomenon of plaintext data being unreadable is avoided. At the same time, ciphertext data is encrypted with a random key, making the confidentiality of ciphertext data stronger and solving the problem of insecurity of ciphertext data information in QR code images.

[0220] Figure 6 This is a schematic diagram of the structure of the QR code decoding device improved in the embodiments of this application. Figure 6 As shown, the QR code decoding device 60 includes: a QR code image determination module 601, a plaintext data acquisition module 602, a ciphertext bytecode determination module 603, a bytecode information determination module 604, a target key determination module 605, a ciphertext data acquisition module 606, and a raw data acquisition module 607. Wherein:

[0221] The QR code image determination module 601 is used to determine the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext bytecode represents the position of the ciphertext bytecode in the QR code image.

[0222] The plaintext data acquisition module 602 is used to decode the bytecode information corresponding to the plaintext locator in the bytecode information according to the plaintext locator to obtain plaintext data;

[0223] The ciphertext bytecode determination module 603 is used to determine the ciphertext bytecode information in the bytecode information based on the ciphertext locator;

[0224] The bytecode information determination module 604 is used to determine the date information and key sequence number information in the bytecode information based on the identification number;

[0225] The target key determination module 605 is used to determine the target key based on the date information and the key serial number information;

[0226] The ciphertext data acquisition module 606 is used to decode the ciphertext bytecode information according to the target key to obtain the ciphertext data;

[0227] The raw data acquisition module 607 is used to obtain the raw data of the QR code image based on the plaintext data and the ciphertext data.

[0228] In this embodiment of the application, the QR code image determination module 601 can also be specifically used for:

[0229] Based on the QR code image, decode the QR code image to obtain the initial information in the QR code image;

[0230] Based on the error correction algorithm, the initial information is decoded to determine the bytecode information, plaintext locator, ciphertext locator, and identification number of the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image.

[0231] In this embodiment of the application, the plaintext data acquisition module 602 can also be specifically used for:

[0232] Based on the plaintext locator, determine the plaintext bytecode information in the bytecode information;

[0233] Decode the plaintext bytecode information to obtain the plaintext data in the QR code image.

[0234] In this embodiment of the application, the target key determination module 605 can also be specifically used for:

[0235] Based on the date information, determine the number of days, which is the number of days between the date the QR code image was created and the set date;

[0236] Based on the number of days, determine the date the QR code image was created;

[0237] Based on the construction date, determine the initial key within the construction date, as well as the initial key sequence number;

[0238] Based on the key sequence number information, determine the target key sequence number information that matches the key sequence number information in the initial key sequence number information;

[0239] Based on the target key sequence number information, determine the target key in the initial key that corresponds to the target key sequence number information.

[0240] In this embodiment of the application, the encrypted data acquisition module 606 can also be specifically used for:

[0241] The target key is expanded to obtain multiple sets of key data;

[0242] The ciphertext bytecode information is grouped to obtain target ciphertext bytecode with the same length;

[0243] Based on multiple sets of key data, the target ciphertext bytecode is decoded sequentially to obtain multiple sets of ciphertext data;

[0244] Multiple sets of ciphertext data are concatenated to obtain the ciphertext data.

[0245] As can be seen from the above, the QR code decoding device 60 of this application embodiment comprises a QR code pattern determination module 601, used to determine the bytecode information of the QR code pattern, as well as the plaintext locator, ciphertext locator, and identification number in the QR code pattern. The plaintext locator represents the position of the plaintext bytecode in the QR code pattern, and the ciphertext bytecode represents the position of the ciphertext bytecode in the QR code pattern; a plaintext data obtaining module 602, used to decode the bytecode information corresponding to the plaintext locator in the bytecode information according to the plaintext locator to obtain the plaintext data; and a ciphertext bytecode determination module. Module 603 is used to determine the ciphertext bytecode information in the bytecode information based on the ciphertext locator; Module 604 is used to determine the date information and key sequence number information in the bytecode information based on the identification number; Module 605 is used to determine the target key based on the date information and key sequence number information; Module 606 is used to decode the ciphertext bytecode information based on the target key to obtain the ciphertext data; Module 607 is used to obtain the original data of the QR code image based on the plaintext data and the ciphertext data. Therefore, by partitioning and decoding the QR code image, the readability of the plaintext data in the QR code image can be guaranteed, while determining the key of the ciphertext data based on the identification number can improve the confidentiality of the ciphertext data, thereby improving the anti-counterfeiting and effectiveness of the QR code image data.

[0246] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device 70 includes:

[0247] The electronic device 70 may include a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a communication component 703, and other components. The processor 701, memory 702, and communication component 703 are connected via a bus 704.

[0248] In the specific implementation process, at least one processor 701 executes computer execution instructions stored in memory 702, causing at least one processor 701 to execute the above-mentioned QR code construction method and decoding method.

[0249] The specific implementation process of processor 701 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0250] In the above Figure 7 In the illustrated embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0251] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0252] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0253] In some embodiments, a computer program product is also provided, including a computer program or instructions that, when executed by a processor, implement the steps in any of the above-described methods for constructing or decoding QR codes.

[0254] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0255] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0256] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the QR code construction or decoding methods provided in embodiments of this application.

[0257] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0258] According to one aspect of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium.

[0259] Since the instructions stored in the storage medium can execute the steps in any of the QR code construction and decoding methods provided in the embodiments of this application, the beneficial effects that any of the QR code construction and decoding methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0260] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0261] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for constructing a QR code, characterized in that, The method includes: The date of QR code creation and the QR code creation data are determined, wherein the QR code creation data includes plaintext data and ciphertext data; Based on the QR code creation date, determine the number of days between the QR code creation date and the set date, the initial key within the QR code creation date, and the sequence number of the initial key; based on the initial key, determine the target key of the encrypted data; based on the sequence number of the initial key, determine the target key sequence number of the target key; based on the number of days between the QR code creation date and the set date, and the target key sequence number, determine the identification number of the target key, wherein the identification number of the target key includes date information and key sequence number information, and the date information represents the number of days between the QR code creation date and the set date; The ciphertext data is encrypted using the target key to obtain ciphertext bytecode; A QR code image is obtained based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key. The plaintext bytecode is the bytecode obtained by encrypting the plaintext data. The ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data.

2. The method according to claim 1, characterized in that, The step of encrypting the ciphertext data according to the target key to obtain ciphertext bytecode includes: The target key is expanded to obtain multiple sets of key data; The ciphertext data is grouped to obtain target ciphertext data of the same length; Based on the multiple sets of key data, the target ciphertext data is encrypted sequentially to obtain the target ciphertext byte block; The target ciphertext byte blocks are concatenated to obtain the ciphertext bytecode.

3. The method according to claim 1, characterized in that, Before obtaining the QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key, the method further includes: Based on the QR code construction data, determine the plaintext data in the QR code construction data; The plaintext data is encoded to obtain plaintext bytecode; Based on the plaintext bytecode, a plaintext locator corresponding to the plaintext bytecode is determined, and the plaintext locator represents the position of the plaintext bytecode in the QR code; Based on the ciphertext bytecode, a ciphertext locator corresponding to the ciphertext bytecode is determined, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code.

4. The method according to claim 1, characterized in that, The step of obtaining a QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key includes: The ciphertext bytecode, the plaintext bytecode, the ciphertext locator, the plaintext locator, and the identification number of the target key are concatenated to obtain the full-text bytecode; Based on the full-text bytecode, generate error correction codes for the full-text bytecode; The error correction code is inserted into the full-text bytecode to obtain the updated full-text bytecode; The updated full-text bytecode is encoded to obtain a QR code graphic.

5. A method for decoding a QR code, characterized in that, The method includes: The bytecode information of the QR code graphic, as well as the plaintext locator, ciphertext locator, and identification number in the QR code graphic are determined. The plaintext locator represents the position of the plaintext bytecode in the QR code graphic, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code graphic. Based on the plaintext locator, the bytecode information corresponding to the plaintext locator in the bytecode information is decoded to obtain plaintext data; Based on the ciphertext locator, the ciphertext bytecode information in the bytecode information is determined; Based on the identification number, the date information and key sequence number information in the bytecode information are determined; Based on the date information, determine the number of days, which is the number of days between the construction date of the QR code graphic and a set date; based on the number of days, determine the construction date of the QR code graphic; based on the construction date, determine the initial key and initial key sequence number information within the construction date; based on the key sequence number information, determine the target key sequence number information that matches the initial key sequence number information; based on the target key sequence number information, determine the target key in the initial key that corresponds to the target key sequence number information. Based on the target key, the ciphertext bytecode information is decoded to obtain ciphertext data; The original data of the QR code graphic is obtained based on the plaintext data and the ciphertext data.

6. The method according to claim 5, characterized in that, The determination of the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image, includes: Based on the QR code image, the QR code image is decoded to obtain the initial information in the QR code image; According to the error correction algorithm, the initial information is decoded to determine the bytecode information, plaintext locator, ciphertext locator, and identification number in the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image.

7. The method according to claim 5, characterized in that, The step of decoding the bytecode information corresponding to the plaintext locator in the bytecode information to obtain plaintext data includes: Based on the plaintext locator, the plaintext bytecode information in the bytecode information is determined; The plaintext bytecode information is decoded to obtain the plaintext data in the QR code graphic.

8. The method according to claim 5, characterized in that, The step of decoding the ciphertext bytecode information according to the target key to obtain ciphertext data includes: The target key is expanded to obtain multiple sets of key data; The ciphertext bytecode information is grouped to obtain target ciphertext bytecode with the same length; Based on the multiple sets of key data, the target ciphertext bytecode is decoded sequentially to obtain multiple sets of ciphertext data; The multiple sets of ciphertext data are concatenated to obtain the ciphertext data.

9. A device for constructing a QR code, characterized in that, include: The first determining module is used to determine the QR code construction date and the QR code construction data, wherein the QR code construction data includes plaintext data and ciphertext data; The second determining module is configured to, based on the QR code creation date, determine the number of days between the QR code creation date and a set date, an initial key within the QR code creation date, and the sequence number of the initial key; determine the target key of the encrypted data based on the initial key; determine the target key sequence number of the target key based on the sequence number of the initial key; and determine the identification number of the target key based on the number of days between the QR code creation date and the set date, and the target key sequence number, wherein the identification number of the target key includes date information and key sequence number information, and the date information represents the number of days between the QR code creation date and the set date. The ciphertext bytecode acquisition module is used to encrypt the ciphertext data according to the target key to obtain ciphertext bytecode; The QR code image generation module is used to generate a QR code image based on the ciphertext bytecode, plaintext bytecode, ciphertext locator, plaintext locator, and the identification number of the target key. The plaintext bytecode is the bytecode obtained by encrypting the plaintext data, the ciphertext locator represents the position of the ciphertext data in the QR code construction data, and the plaintext locator represents the position of the plaintext data in the QR code construction data.

10. A QR code decoding device, characterized in that, include: The QR code image determination module is used to determine the bytecode information of the QR code image, as well as the plaintext locator, ciphertext locator, and identification number in the QR code image. The plaintext locator represents the position of the plaintext bytecode in the QR code image, and the ciphertext locator represents the position of the ciphertext bytecode in the QR code image. The plaintext data acquisition module is used to decode the bytecode information corresponding to the plaintext locator in the bytecode information according to the plaintext locator to obtain plaintext data; The ciphertext bytecode determination module is used to determine the ciphertext bytecode information in the bytecode information based on the ciphertext locator; The bytecode information determination module is used to determine the date information and key sequence number information in the bytecode information based on the identification number; The target key determination module is used to determine the number of days information based on the date information, wherein the number of days information is the number of days between the construction date of the QR code graphic and a set date; determine the construction date of the QR code graphic based on the number of days information; determine the initial key and initial key sequence number information within the construction date based on the construction date; and determine the target key sequence number information that matches the initial key sequence number information based on the key sequence number information. Based on the target key sequence number information, determine the target key in the initial key that corresponds to the target key sequence number information; The ciphertext data acquisition module is used to decode the ciphertext bytecode information according to the target key to obtain ciphertext data; The raw data acquisition module is used to obtain the raw data of the QR code image based on the plaintext data and the ciphertext data.

11. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 8.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Information hiding and hidden information extraction method based on two-dimensional barcode and information hiding and hidden information extraction system thereof

    CN105825257A

  • Two-dimensional code generation method and device, electronic equipment and computer readable storage medium

    CN111144531A