Two-dimensional code code word generation method, two-dimensional code recognition method and device

CN117010330BActive Publication Date: 2026-08-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211153595.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-21
Publication Date
2026-08-28
Estimated Expiration
2042-09-21

AI Technical Summary

Technical Problem

[0004]然而,在不同的应用场景中,需要所生成的二维码码字的长度是可变的,例如,在某些场景下需要较短的二维码码字,在另一些场景下需要较长的二维码码字,上述方法所生成的二维码码字的长度不够灵活

Benefits of technology

[0027]综上,在本申请实施例中,通过在二维码码字生成请求中携带目标对象的标识和二维码码字类型指示信息,以指示待生成的二维码码字的长度,在生成二维码码字时,根据指示信息指示的二维码码字类型和预存的数据码字的码段信息确定目标码段,根据目标码段生成数据码字,接着根据指示信息确定目标字符集,根据目标字符集和目标加密密钥集生成与数据码字对应的唯一码标识,最后根据请求域名、目标对象的标识和唯一码标识,生成二维码码字。从而,可根据生成请求生成所需码字长度的二维码码字,使得生成的二维码码字的长度比较灵活,进而可满足不同的场景需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117010330B_ABST
    Figure CN117010330B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a two-dimensional code code word generation method, a two-dimensional code recognition method and device, and can be applied to cloud technology, artificial intelligence and the like. The method comprises the following steps: receiving a two-dimensional code code word generation request, the two-dimensional code code word generation request carrying identification of a target object and two-dimensional code code word type indication information, different types of two-dimensional code code words corresponding to different code word length ranges, determining a target code segment according to the two-dimensional code code word type indicated by the indication information and pre-stored data code word code segment information, generating a data code word according to the target code segment, determining a target character set according to the indication information, generating a unique code identifier corresponding to the data code word according to the target character set and a target encryption key set, and generating a two-dimensional code code word according to a request domain name, the identification of the target object and the unique code identifier. Thus, the two-dimensional code code word of the required code word length can be generated, the length of the generated two-dimensional code code word is relatively flexible, and different scene requirements can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a method for generating QR code characters, a method for recognizing QR codes, and an apparatus. Background Technology

[0002] With the development of internet technology, QR codes are becoming increasingly widely used. A QR code is a graphic that records textual and numerical information using black and white alternating patterns of specific geometric shapes distributed according to a certain rule on a plane. In terms of coding, QR codes utilize the concept of "0" and "1" bit streams, which form the basis of computer logic, using several geometric shapes corresponding to binary to represent textual and numerical information. One item, one code means assigning a unique code to each item; scanning the code allows for unique location of the individual item. QR codes are currently widely used on items, meaning that a unique QR code is generated for each item.

[0003] In existing one-item-one-code generation methods, a QR code character is first generated based on the original information. This QR code character is a sequence of characters with a fixed length. A graphic QR code can be generated based on this QR code character using conversion technology, such as Quick Response Code (QRCode).

[0004] However, in different application scenarios, the length of the generated QR code text needs to be variable. For example, in some scenarios, shorter QR code text is required, while in other scenarios, longer QR code text is required. The length of the QR code text generated by the above method is not flexible enough. Summary of the Invention

[0005] This application provides a method for generating QR code characters, a method for recognizing QR codes, and an apparatus that can generate QR code characters of the required length, making the length of the generated QR code characters more flexible and thus meeting the needs of different scenarios.

[0006] In a first aspect, embodiments of this application provide a method for generating QR code characters, including:

[0007] Receive a QR code character generation request. The QR code character generation request carries the identifier of the target object and QR code character type indication information. Different types of QR code characters correspond to different code character length ranges.

[0008] The target code segment is determined based on the code segment information of the QR code code type indicated by the instruction information and the code segment information of the pre-stored data code segment, and the data code segment is generated based on the target code segment;

[0009] The target character set is determined according to the instruction information, and a unique code identifier corresponding to the data codeword is generated according to the target character set and the target encryption key set.

[0010] A QR code is generated based on the requested domain name, the identifier of the target object, and the unique identifier.

[0011] Secondly, embodiments of this application provide a QR code recognition method, including:

[0012] Receive a query request sent by a QR code recognition device, wherein the query request carries QR code characters;

[0013] The identification result is obtained by recognizing the length of the QR code, the content of the QR code, and the code segment information of the pre-stored data code.

[0014] The recognition result is sent to the QR code recognition device.

[0015] Thirdly, embodiments of this application provide a QR code character generation device, comprising:

[0016] The receiving module is used to receive a QR code generation request. The QR code generation request carries the identifier of the target object and QR code type indication information. Different types of QR code characters correspond to different code character length ranges.

[0017] The first generation module is used to determine the target code segment based on the QR code code type indicated by the indication information and the code segment information of the pre-stored data code segment, and generate data code words based on the target code segment;

[0018] The second generation module is used to determine the target character set according to the indication information, and generate a unique code identifier corresponding to the data codeword according to the target character set and the target encryption key set.

[0019] The third generation module is used to generate QR code characters based on the requested domain name, the identifier of the target object, and the unique code identifier.

[0020] Fourthly, embodiments of this application provide a QR code recognition device, including:

[0021] The receiving module is used to receive a query request sent by the QR code recognition device, wherein the query request carries the QR code characters;

[0022] The recognition module is used to recognize the QR code based on its length, content, and pre-stored data code segment information to obtain a recognition result.

[0023] The sending module is used to send the recognition result to the QR code recognition device.

[0024] Fifthly, embodiments of this application provide a computer device, including: a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to perform the method of the first aspect or the second aspect.

[0025] In a sixth aspect, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a computer program, cause the computer to perform the method as described in the first or second aspect.

[0026] In a seventh aspect, embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method as described in the first or second aspect.

[0027] In summary, in this embodiment, by including the target object's identifier and QR code type indication information in the QR code generation request to indicate the length of the QR code to be generated, the target code segment is determined based on the QR code type indicated by the indication information and the code segment information of the pre-stored data code characters during QR code generation. Data code characters are then generated based on the target code segment. Next, the target character set is determined based on the indication information. A unique identifier corresponding to the data code characters is generated based on the target character set and the target encryption key set. Finally, the QR code characters are generated based on the request domain name, the target object's identifier, and the unique identifier. Therefore, QR code characters of the required length can be generated according to the generation request, making the length of the generated QR code characters more flexible and thus meeting the needs of different scenarios.

[0028] Furthermore, in this embodiment, when generating a unique identifier corresponding to the data codeword based on the target character set and the target encryption key set, the data codeword is first converted to base M based on the target character set to obtain a first string. An encryption key is then selected from the target encryption key set, and the first string is encrypted using the FPE encryption algorithm with this encryption key to obtain a second string. Next, the identifier of the encryption key is converted to base M based on the target character set to obtain a target character with a codeword space of 1. This target character is then concatenated with the second string at a preset position to obtain the unique identifier. Since the FPE encryption algorithm ensures that the length of the original encrypted data is consistent with the length of the encrypted data, the length range of the data codeword can be flexibly selected according to the actual scenario, making the codeword length of the generated QR code flexible and variable to meet different scenario requirements. Attached Figure Description

[0029] Figure 1 This application provides an illustration of an application scenario for a QR code character generation method and a QR code recognition method.

[0030] Figure 2 A flowchart illustrating a method for generating QR code characters provided in this application embodiment;

[0031] Figure 3 A flowchart illustrating a method for generating QR code characters provided in this application embodiment;

[0032] Figure 4 A flowchart illustrating a QR code recognition method provided in this application embodiment;

[0033] Figure 5 This is a schematic diagram of the structure of a QR code character generation device provided in an embodiment of this application;

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

[0035] Figure 7 This is a schematic block diagram of the computer device 300 provided in the embodiments of this application. Detailed Implementation

[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the embodiments of this application.

[0037] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the present application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.

[0038] Before introducing the technical solutions of the embodiments of this application, the relevant knowledge of the embodiments of this application will be introduced below:

[0039] 1. Cloud computing refers to the delivery and usage model of IT infrastructure, meaning obtaining necessary resources in an on-demand and easily scalable manner through a network. In a broader sense, cloud computing also refers to the delivery and usage model of services, meaning obtaining necessary services in an on-demand and easily scalable manner through a network. These services can be IT and software related, internet-related, or other services. Cloud computing is a product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.

[0040] With the development of the internet, real-time data streams, and the diversification of connected devices, as well as the demands for search services, social networks, mobile commerce, and open collaboration, cloud computing has rapidly developed. Unlike previous parallel distributed computing, cloud computing will fundamentally revolutionize the entire internet model and enterprise management model.

[0041] 2. Big data refers to data sets that cannot be captured, managed, and processed within a certain timeframe using conventional software tools. It represents massive, rapidly growing, and diverse information assets that require new processing models to achieve stronger decision-making, insightful discovery, and process optimization capabilities. With the advent of the cloud era, big data has attracted increasing attention. Big data requires specialized technologies to effectively process large amounts of data within a tolerable timeframe. Technologies suitable for big data include massively parallel processing databases, data mining, distributed file systems, distributed databases, cloud computing platforms, the internet, and scalable storage systems.

[0042] 3. A QR code character refers to a sequence of characters, typically generated into a graphic QR code using a conversion technology, including but not limited to QRCode. The generated graphic QR code information is attached to an item (such as a product) using methods such as laser, inkjet, or printing. In this embodiment, the information reading method for the QR code character can be achieved by opening the QR code recognition function (such as "scan") of the target application on a terminal device to scan the image QR code and read the information of the QR code character. Alternatively, the information can be extracted by calling the scanning recognition interface of the target application within a mini-program of the target application. Other methods for reading the QR code character information are also possible, and this embodiment is not limited to them.

[0043] Optionally, a QR code character is generated using the QR code character generation method provided in this application embodiment, and then a graphic QR code information is generated using conversion technology. The generated graphic QR code can be printed inside the product packaging for marketing purposes, or it can be printed on the product exterior or outer packaging for production line information collection or circulation information collection.

[0044] The QR code generation method and QR code recognition method provided in this application involve technologies such as cloud computing, big data and blockchain.

[0045] In related technologies, the length of generated QR code characters is fixed, which is not flexible enough. To solve this problem, this application embodiment carries the identifier of the target object and QR code character type indication information in the QR code character generation request to indicate the length of the QR code character to be generated. When generating the QR code character, the target code segment is determined according to the QR code character type indicated by the indication information and the code segment information of the pre-stored data code character. Data code characters are generated according to the target code segment. Then, the target character set is determined according to the indication information. A unique code identifier corresponding to the data code character is generated according to the target character set and the target encryption key set. Finally, the QR code character is generated according to the request domain name, the identifier of the target object, and the unique code identifier. Thus, QR code characters of the required length can be generated according to the generation request, making the length of the generated QR code character more flexible and thus meeting the needs of different scenarios.

[0046] Furthermore, in this embodiment, when generating a unique identifier corresponding to the data codeword based on the target character set and the target encryption key set, the data codeword is first converted to M-ary according to the target character set to obtain a first string. An encryption key is selected from the target encryption key set, and the first string is encrypted using the Format-Preserving Encryption (FPE) algorithm to obtain a second string. Then, the identifier of the encryption key is converted to M-ary according to the target character set to obtain a target character with a codeword space of 1. This target character is then concatenated with the second string at a preset position to obtain the unique identifier. Since the FPE encryption algorithm ensures that the length of the original encrypted data is consistent with the length of the encrypted data, the length range of the data codeword can be flexibly selected according to the actual scenario, making the codeword length of the generated QR code flexible and variable to meet different scenario requirements.

[0047] The embodiments of this application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence and other scenarios.

[0048] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application are applicable. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.

[0049] For example, Figure 1 This application provides an illustration of an application scenario for a QR code character generation method and a QR code recognition method, as shown in the embodiments of this application. Figure 1 As shown, the application scenario of this application involves server 1 and terminal device 2. Terminal device 2 and server 1 can be directly or indirectly connected through wired or wireless communication. This application does not impose any restrictions on this scenario.

[0050] In some possible implementations, terminal device 2 refers to a device with rich human-computer interaction methods, internet access capabilities, typically running various operating systems, and possessing strong processing power. Terminal devices can be smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, etc., but are not limited to these. Optionally, in this embodiment, terminal device 2 has a QR code recognition application installed or an application with QR code recognition functionality installed.

[0051] In some possible ways, Figure 1 Server 1 in this application can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. This application embodiment does not impose any limitations on this. In this application embodiment, server 1 can be the backend server of a QR code recognition application in terminal device 2 or an application with QR code recognition functionality.

[0052] In some possible ways, Figure 1 An exemplary terminal device and a server are shown, but in practice, other numbers of terminal devices and servers may be included, and this application does not limit this.

[0053] For example, a target application with QR code recognition functionality can be installed and run on terminal device 2. Users can operate the target application on terminal device 2 to access services corresponding to QR code recognition, such as product traceability or product marketing. Users can operate terminal device 2 to open the QR code recognition function of the target application (e.g., "scan"). Terminal device 2 scans the QR code and parses it to obtain the QR code text. Terminal device 2 sends a query request carrying the QR code text to server 1. Server 1 recognizes the QR code text based on its length, content, and pre-stored data segment information, obtaining the recognition result. Server 1 sends the recognition result to terminal device 2. Optionally, terminal device 2 can also determine the Uniform Resource Locator (URL) address in the QR code text, redirecting the current page to the corresponding mini-program page or H5 page, and displaying the recognition result after receiving it. This completes product traceability or product marketing.

[0054] Optionally, before receiving the query request sent by the terminal device 2, the server 1 may also use the QR code generation method provided in this application embodiment to generate a QR code package. The QR code package includes multiple QR code characters, and after scanning, it can uniquely locate a single item or object.

[0055] The technical solutions of the embodiments of this application will be described in detail below:

[0056] Figure 2 This application provides a flowchart of a QR code generation method, wherein the executing entity of the method can be a QR code generation device, such as a server. Figure 2 As shown, the method may include:

[0057] S101. Receive a QR code generation request. The QR code generation request carries the identifier of the target object and the QR code type indication information. Different types of QR code characters correspond to different code character length ranges.

[0058] Specifically, the target object can be an item or product. Taking a product as an example, the target identifier can be the product's brand identifier. This brand identifier indicates that the QR code package to be generated is a QR code package for a product indicated by that brand identifier. For example, a certain brand and model of mobile phone has a unique code for each device.

[0059] The QR code generation request also carries QR code type indication information, which indicates the type of QR code. Different types of QR code correspond to different code length ranges.

[0060] Optionally, in one implementable manner, there are three types of QR code characters in the embodiments of this application.

[0061] (1) Short code: The codeword length is 26 bits. It can be used in application scenarios with shorter codewords and can be generated and printed using the QRCode standard version 2, M error correction level. The sequence of short codes can be composed of URL + target object identifier + unique code identifier.

[0062] (2) Medium-short code: The codeword length is 28 bits, which can be applied to most medium-short codeword application scenarios. It can be generated and printed using QRCode standard version 2, M error correction level. The sequence of the short code can be URL + target object identifier + unique code identifier. The difference between medium-short code and short code is that the target object identifier has two more bits compared to the short code, and the character sets of the brand identifier and unique code identifier have fewer lowercase letters a~z compared to the short code.

[0063] (3) Custom information variable-length codes can be added. The length of the codeword can be 31-61 bits, depending on the length of the custom information (the length of the custom information can be 0). The sequence of the custom information variable-length code can be composed of URL + encoding version + target object identifier + custom information field + unique code identifier.

[0064] S102. Determine the target code segment based on the QR code code type indicated by the instruction information and the code segment information of the pre-stored data code segment, and generate data code words based on the target code segment.

[0065] Specifically, in this embodiment of the application, the correspondence between QR code codeword type and data codeword segment range is pre-stored. This correspondence can be the codeword segment information of the data codeword. Different types of QR codewords correspond to different data codeword segment information, so that after generating QR codewords based on data codewords, different types of QR codewords correspond to different codeword length ranges.

[0066] Optionally, when the pre-stored data codeword segment information is a correspondence between QR codeword type and data codeword segment range, the target code segment is determined according to the QR codeword type indicated by the indication information and the pre-stored data codeword segment information. Specifically, this can be done by searching for the data codeword segment that corresponds to the QR codeword type indicated by the indication information from the correspondence between QR codeword type and data codeword segment range, which is the target code segment.

[0067] S103. Determine the target character set according to the instruction information, and generate a unique code identifier corresponding to the data codeword based on the target character set and the target encryption key set.

[0068] Specifically, different types of QR code characters correspond to different character sets. In this embodiment, the correspondence between QR code character types and the character sets of unique identifiers can be pre-stored.

[0069] Optionally, the target character set can be determined based on the indication information, which may specifically include:

[0070] Based on the QR code code type indication information, the target character set is determined from the correspondence between the pre-stored QR code code type and the character set of the unique code identifier.

[0071] Optionally, the method in this embodiment may further include: determining the target encryption key set from the pre-stored correspondence between object identifiers and encryption key sets based on the identifier of the target object.

[0072] In this embodiment, by pre-storing the correspondence between object identifiers and encryption key sets, different objects use different encryption keys when generating QR code characters, thereby improving the security of the generated QR code characters.

[0073] Optionally, in the correspondence between QR code codeword types and unique identifier character sets, the character set of the unique identifier corresponding to the first codeword type includes P characters, the character set of the unique identifier corresponding to the second codeword type includes Q characters, and the character set of the unique identifier corresponding to the third codeword type includes Q characters. The codeword length of the first codeword type is less than the codeword length of the second codeword type, the codeword length of the second codeword type is less than the codeword length of the third codeword type, and P is greater than Q. Optionally, the first codeword type is the aforementioned short code type, the second codeword type is the aforementioned medium-short code type, and the third codeword type is the aforementioned variable-length code type that can add custom information. Accordingly, in one implementable method, P can be 64, and these 64 characters can be: digits 0-9, uppercase letters A-Z, lowercase letters a-z, and the two special characters "-" and ".". Q can be 38, and these 38 characters can be: digits 0-9, uppercase letters A-Z, and the two special characters "-" and ".".

[0074] Optionally, in S103, a unique identifier corresponding to the data codeword is generated based on the target character set and the target encryption key set. Specifically, it can be:

[0075] S1031. Based on the target character set, perform M-ary conversion on the data codewords to obtain the first string, where M is the number of characters included in the target character set.

[0076] Specifically, for example, if the target character set includes 64 characters M, then the data codeword is converted to base-64 to obtain the first string. If the target character set includes 38 characters M, then the data codeword is converted to base-38 to obtain the first string.

[0077] S1032. Select an encryption key from the target encryption key set, and use the encryption key to encrypt the first string to generate a unique identifier.

[0078] For short codes, for example, if the target encryption key set includes 20 keys, with keys 1-20 as key identifiers (IDs), an encryption key can be randomly selected from these 20 keys and used to encrypt the first string to generate a unique identifier. For medium-short codes, for example, if the target encryption key set includes 10 keys, with keys 1-10 as key identifiers (IDs), an encryption key can be randomly selected from these 10 keys and used to encrypt the first string to generate a unique identifier. For variable-length codes that can add custom information, for example, if the target encryption key set includes 15 keys, with keys 1-15 as key identifiers (IDs), an encryption key can be randomly selected from these 15 keys and used to encrypt the first string to generate a unique identifier.

[0079] Optionally, in S1032, the first string is encrypted using an encryption key to generate a unique identifier, specifically:

[0080] The first string is encrypted using the FPE encryption algorithm with the encryption key to obtain the second string. The identifier of the encryption key is converted to base M according to the target character set to obtain the target character with a code space of 1. The target character is concatenated with the second string at a preset position to obtain a unique identifier, where M is the number of characters included in the target character set.

[0081] Specifically, taking short codes as an example, the sequence of short codes can be composed of a URL + the identifier of the target object + a unique code identifier, such as HTTPS: / / MA.RUN / AB / kxxxxxxx. Here, HTTPS: / / is the general protocol header, MA.RUN is the request domain name (15 characters in total), and the request domain name identifies the service address that handles the request. AB (two characters) is the identifier of the target object, and kxxxxxxx is the unique code identifier. The k bit in the unique code identifier is the key ID bit (i.e., the identifier of the encryption key is converted to M-ary based on the target character set to obtain the target character with a codeword space of 1; the k bit is the target character). The remaining 7 bits, xxxxxxx, are the encrypted unique code bits. The character set corresponding to the short code includes 64 characters, which can be: numbers 0-9, uppercase letters A-Z, lowercase letters a-z, and the two special characters "-" and ".". Based on this character set and the length of the encrypted unique code bits being 7, the unique code word capacity space can be calculated to be 64^7 = 4 * 10^12 (4 trillion). This codeword capacity is sufficient to meet the code space requirements of the generated code.

[0082] The FPE encryption algorithm refers to an encryption algorithm that maintains the same format as the original data in the encrypted result. For example, the encrypted result of a 16-bit number remains a 16-bit number, and the encrypted result of a string of English characters remains a string of English characters. Compared to commonly used block encryption techniques, the FPE encryption algorithm does not require the original data to be an integer multiple of the smallest encrypted block size (or require padding). Therefore, in this embodiment, a unique code identifier is obtained by encrypting using the FPE encryption algorithm. Since the FPE encryption algorithm can guarantee that the length of the original encrypted data is consistent with the length of the encrypted data, the length range of the data codeword can be flexibly selected according to the actual scenario, making the codeword length of the generated QR code flexible and variable to meet different scenario requirements.

[0083] S104. Generate QR code characters based on the requested domain name, the identifier of the target object, and the unique code identifier.

[0084] Optionally, a QR code can be generated based on the requested domain name, the target object's identifier, and the unique identifier. Specifically, it can be:

[0085] The request domain name, the identifier of the target object, and the unique identifier are concatenated according to the first preset method to obtain the QR code.

[0086] Specifically, taking short codes as an example, the sequence of a short code can be composed of a URL + the identifier of the target object + a unique identifier, such as HTTPS: / / MA.RUN / AB / kxxxxxxx. Here, HTTPS: / / is the general protocol header, MA.RUN is the request domain name, AB (two characters) is the identifier of the target object, and kxxxxxxx is the unique identifier. The character set corresponding to the identifier of the target object includes characters from 0 to 9, uppercase letters A to Z, and lowercase letters a to z, totaling 62 characters. Therefore, the maximum space that the identifier of the target object can hold is 3844. For example, if the generated unique identifier is 12345678, the request domain name, the identifier of the target object, and the unique identifier are concatenated according to the sequence of the short code (i.e., the first preset method) to obtain the QR code, for example, HTTPS: / / MA.RUN / AB / 12345678.

[0087] Taking short QR codes as an example, the sequence of a short QR code can be composed of a URL + the identifier of the target object + a unique identifier, such as HTTPS: / / MA.RUN / ABCD / kxxxxxxx. Here, HTTPS: / / is the general protocol header, MA.RUN is the request domain name, ABCD (4 characters) is the identifier of the target object, and kxxxxxxx is the unique identifier. The character set corresponding to the identifier of the target object includes characters from 0 to 9 and uppercase letters A to Z, a total of 36 characters. Therefore, the maximum capacity for the identifier of the target object is 1.6 * 10^6 characters (one million). For example, if the generated unique identifier is k1234567, the request domain name, the identifier of the target object, and the unique identifier are concatenated according to the sequence of the short QR code (i.e., the first preset method) to obtain the QR codeword, such as HTTPS: / / MA.RUN / ABCD / K12345678.

[0088] The above explanation uses short codes and medium-short codes as examples. The following explanation uses variable-length codes that can add custom information as an example.

[0089] Optionally, in one implementable method, if the QR code codeword type indication information indicates that the QR codeword type is a third codeword type, such as a variable-length code that can add custom information, and the QR codeword generation request also carries custom information, then in step S103, a unique code identifier corresponding to the data codeword is generated based on the target character set and the target encryption key set. This can be:

[0090] S1031. Determine the length of the unique identifier, the QR code generation version, and the error correction level based on the length of the custom information and the type of characters in the custom information.

[0091] Specifically, the length of the custom information and the correspondence between the type of characters in the custom information and the length of the unique code identifier, the QR code generation version and the error correction level can be stored in advance. When a QR code generation request is received, if the QR code generation request also carries custom information, the length of the unique code identifier, the QR code generation version and the error correction level can be determined from the correspondence based on the length of the custom information and the type of characters in the custom information.

[0092] Optionally, the correspondence between the length of the custom information, the type of characters in the custom information, the length of the unique identifier, the QR code generation version, and the error correction level can be as follows:

[0093] (1) When the custom information includes uppercase letters and numbers and is less than 7 characters long (excluding the separator / after the custom information), the unique identifier is 9 characters long. The QR code generation version and error correction level are QRCode version 2 and M error correction level, respectively. That is, QRCode version 2 with M error correction level can be used to generate the code. The unique identifier is 9 characters long, including the first digit as the key, the last digit as the check digit, and the middle 7 digits as the encryption digit. Therefore, the unique code word capacity space can be calculated to be 38. ^ 7 = 1 * 10 ^ 11 (100 billion).

[0094] (2) When the custom information includes uppercase letters and numbers and is 7 characters or more in length (excluding the separator / after the custom information), the unique code identifier is 15 characters long. When the custom information is less than or equal to 24 characters (total length less than or equal to 61 characters) (including the / symbol), the QR code generation version and error correction level are QRCode version 3 and M error correction level, respectively. That is, QRCode version 3 with M error correction level can be used to generate the code. When a longer number of custom information characters is required, a higher version of QRCode should be used to generate the code. In actual scenarios, it can be set as needed. The unique code identifier is 15 characters long, including the first key bit, the last check bit, and the middle 13 encryption bits. The unique code word capacity space can be calculated to be 38^13 = 3.4 * 10^20 (3 trillion trillion).

[0095] (3) When the custom information includes uppercase and lowercase letters and numbers, the length of the unique code identifier is 15 bits. When the length of the custom information is less than 6 bits, the QR code generation version and error correction level are QRCode version 3 and M error correction level, respectively. That is, QRCode version 3 with M error correction level can be used to generate the code. When a longer length of custom information is required, a higher version of QRCode should be used. In actual scenarios, it can be set as needed. The length of the unique code identifier is 15 bits, including the first key bit, the last check bit, and the middle 13 encryption bits. The unique code word capacity space can be calculated to be 38^13 = 3.4 * 10^20 (3 trillion trillion).

[0096] S1032. Generate a unique identifier corresponding to the data codeword based on the target character set, the target encryption key set, and the length of the unique identifier.

[0097] As one feasible approach, S1032 can specifically be:

[0098] S10321. Based on the target character set, perform M-ary conversion on the data codewords to obtain the first string, where M is the number of characters included in the target character set.

[0099] Specifically, in one feasible approach, the character set corresponding to the custom information variable-length code type can be added, which includes 38 characters, i.e., M is 38. Based on the target character set, the data codeword is converted to base-38 to obtain the first string.

[0100] S10322. If the length of the first string is less than N-1, where N is the length of the encryption bits in the unique identifier, pad the first string with zero characters until the length of the second string obtained after padding is equal to N-1.

[0101] For example, if the length of the unique identifier is 7 bits, and the length of the first string is less than 6, then 0s are added to the beginning of the first string until the length of the second string obtained after adding 0s is equal to 6.

[0102] S10323. Select an encryption key from the target encryption key set, and use the encryption key to encrypt the second string using the FPE encryption algorithm to generate the third string.

[0103] S10324. Perform a hash calculation on the third string, and convert the hash calculation result into M-ary to obtain the target result.

[0104] S10325. Take the character at the preset position in the target result as the check character, and concatenate the third string with the check character to obtain the unique identifier.

[0105] For example, the last character in the target result can be taken as the check character, and the third string can be concatenated with the check character to obtain the unique identifier.

[0106] Accordingly, in S104, the QR code is generated based on the requested domain name, the identifier of the target object, and the unique identifier. This can be done by generating the QR code based on the requested domain name, the encoding version, the identifier of the target object, custom information, and the unique identifier.

[0107] Optionally, a QR code can be generated based on the requested domain name, encoding version, target object identifier, custom information, and unique code identifier. Specifically, it can be:

[0108] The request domain name, encoding version, target object identifier, custom information, and unique code identifier are concatenated according to the second preset method to obtain the QR code.

[0109] For example, when the custom information includes uppercase letters and numbers and is less than 7 characters long, the generated QR code will look like this: HTTPS: / / MA.RUN / M / ABCD / USERDE / K1234567C. Here, HTTPS: / / is the general protocol header, MA.RUN is the request domain name, M is the encoding version (including but not limited to identifying the encoding algorithm version and the type of code's purpose, such as marketing or traceability), ABCD (4 characters) is the identifier of the target object, USERDE is the custom information (the character set of the custom information includes numbers 0-9, uppercase letters A-Z, and the two special characters -., for a total of 38 characters), and K1234567C is the unique identifier, where C is the check digit.

[0110] When the custom information includes uppercase letters and numbers and is longer than 7 characters, the generated QR code will look like this: HTTPS: / / MA.RUN / M / ABCD / USERDEFINEDINFO / K1234567890123C. Here, HTTPS: / / is the general protocol header, MA.RUN is the request domain name, M is the encoding version (including but not limited to identifying the encoding algorithm version, the intended use of the code (e.g., marketing or traceability), and facilitates unified redirection by prefix. ABCD (4 characters) is the identifier of the target object, USERDEFINEDINFO is the custom information (the character set includes numbers 0-9, uppercase letters A-Z, and the two special characters -., for a total of 38 characters), and K1234567890123C is the unique identifier, where C is the check digit.

[0111] When the custom information includes uppercase and lowercase letters and numbers, the generated QR code will look like this: HTTPS: / / MA.RUN / M / ABCD / UserDefinedInfo / K1234567890123C. Here, HTTPS: / / is the general protocol header, MA.RUN is the request domain name, M is the encoding version (which includes, but is not limited to, identifying the encoding algorithm version, the intended use of the code (e.g., marketing or traceability), and facilitates unified redirection by prefix, etc. ABCD (4 characters) is the identifier of the target object, UserDefinedInfo is the custom information, and the character set of the custom information includes numbers 0-9, uppercase letters A-Z, and the two special characters -., for a total of 38 characters. K1234567890123C is the unique identifier, where C is the check digit.

[0112] Optionally, this embodiment may further include the following after generating the QR code characters:

[0113] The generated QR code version and error correction level are carried in the QR code package composed of the above QR code characters, so as to instruct the QR code package to generate a QR code graphic according to the generated QR code version and error correction level.

[0114] It's important to note that QR codes offer multiple versions, each supporting a fixed amount of data. Higher versions can hold more data but also have a larger number of QR code dots. Increasing the number of dots slows down the coding process, and within the same area, increased density lowers the recognition rate and increases the difficulty of coding. Therefore, choosing the right version is crucial for both QR code production and recognition performance.

[0115] Meanwhile, an appropriate fault tolerance rate is also a key factor in QR code recognition speed and accuracy. A higher fault tolerance rate means less impact from light and foreign objects on the QR code, resulting in higher recognition rates for terminal devices (such as mobile phones) in various environments. However, a higher fault tolerance rate also means less data can be accommodated for the same version. Therefore, a comprehensive balance needs to be struck when choosing the fault tolerance rate. Experiments have shown that a 15% fault tolerance rate is a good compromise between data capacity and error correction capability. Therefore, this application adopts a 15% fault tolerance rate, i.e., error correction level M.

[0116] In this embodiment of the application, for the three types of QR code codes, the unique code identifier includes at least 7 encryption words, each with 38 bits of space, and the probability space reaches 1.1*10^11, making decryption difficult and thus providing high security.

[0117] Optionally, in this embodiment, the encryption key is automatically and randomly generated, and after generation, it can be encrypted using a Key Management Service (KMS) to further improve security.

[0118] In this embodiment, different objects (e.g., brands) use different sets of encryption keys that do not affect each other. A single object uses a batch of keys, and the leakage of a single key does not affect the use of other keys. Keys can be discarded and new keys can be added in the system. Furthermore, without knowing the originally allocated data codewords, obtaining the key will not allow the generation of data codewords.

[0119] Optionally, in this embodiment, after generating the QR code characters, a QR code packet consisting of all the QR code characters of the target object can be sent to the graphic QR code generator. The server does not store the generated QR code packet; however, the server can store characters used for digest encryption calculation. Since the digest characters cannot be used to reconstruct the original characters, even if the server's database is retrieved, valid QR code characters cannot be obtained.

[0120] The QR codeword generation method provided in this embodiment carries the identifier of the target object and QR codeword type indication information in the QR codeword generation request to indicate the length of the QR codeword to be generated. When generating the QR codeword, the target code segment is determined based on the QR codeword type indicated by the indication information and the code segment information of the pre-stored data codeword. Data codewords are then generated based on the target code segment. Next, the target character set is determined based on the indication information. A unique identifier corresponding to the data codeword is generated based on the target character set and the target encryption key set. Finally, the QR codeword is generated based on the request domain name, the identifier of the target object, and the unique identifier. Therefore, QR codewords of the required length can be generated according to the generation request, making the length of the generated QR codewords more flexible and thus meeting the needs of different scenarios.

[0121] The following is combined with Figure 3 The present application will use a specific embodiment to provide a detailed description of the QR code character generation method provided in the embodiments of this application.

[0122] Figure 3 A flowchart illustrating a QR code character generation method provided in this application embodiment is shown. The execution entity of this method can be a server, such as... Figure 3 As shown, the method may include:

[0123] S201, Receive QR code character generation request.

[0124] Specifically, in one implementable embodiment, this application provides three types of QR codewords: short codes, medium-short codes, and variable-length codes with customizable information. In this embodiment, the QR codeword generation request carries the identifier of the target object and QR codeword type indication information. Different types of QR codewords correspond to different codeword length ranges. If the QR codeword type indication information indicates a variable-length codeword with customizable information, the QR codeword generation request also carries customizable information. The server can determine the type of QR codeword to be generated based on the information carried in the QR codeword generation request.

[0125] S202. Determine the target code segment based on the QR code code type indicated by the instruction information and the code segment information of the pre-stored data code words, and generate data code words based on the target code segment.

[0126] Specifically, in this embodiment of the application, the correspondence between QR code codeword type and data codeword segment range is pre-stored. This correspondence can be the codeword segment information of the data codeword. Different types of QR codewords correspond to different data codeword segment information, so that after generating QR codewords based on data codewords, different types of QR codewords correspond to different codeword length ranges.

[0127] Optionally, when the pre-stored data codeword segment information is a correspondence between QR codeword type and data codeword segment range, the target code segment is determined according to the QR codeword type indicated by the indication information and the pre-stored data codeword segment information. Specifically, this can be done by searching for the data codeword segment that corresponds to the QR codeword type indicated by the indication information from the correspondence between QR codeword type and data codeword segment range, which is the target code segment.

[0128] S203. Based on the QR code code type indication information, determine the target character set from the pre-stored correspondence between the QR code code type and the character set of the unique code identifier. Based on the identifier of the target object, determine the target encryption key set from the pre-stored correspondence between the object identifier and the encryption key set.

[0129] In this embodiment, by pre-storing the correspondence between object identifiers and encryption key sets, different objects use different encryption keys when generating QR code characters, thereby improving the security of the generated QR code characters.

[0130] S204. Generate a unique identifier corresponding to the data codeword based on the target character set and the target encryption key set.

[0131] S205. Generate a QR code based on the requested domain name, the identifier of the target object, and the unique code identifier.

[0132] Specifically, if the type of the QR code codeword to be generated indicated by the instruction information is a short code or a medium-short code, a unique code identifier corresponding to the data codeword can be generated according to the target character set and the target encryption key set in the following way:

[0133] S1. Based on the target character set, perform M-ary conversion on the data codewords to obtain the first string, where M is the number of characters included in the target character set.

[0134] Specifically, for example, if the target character set includes 64 characters M, then the data codeword is converted to base-64 to obtain the first string. If the target character set includes 38 characters M, then the data codeword is converted to base-38 to obtain the first string.

[0135] S2. Select an encryption key from the target encryption key set, use the encryption key to encrypt the first string using the FPE encryption algorithm to obtain the second string, convert the identifier of the encryption key to base M according to the target character set to obtain the target character with code space of 1, and concatenate the target character with the second string according to the preset position to obtain the unique code identifier, where M is the number of characters included in the target character set.

[0136] Optionally, a QR code can be generated based on the requested domain name, the identifier of the target object, and the unique identifier. Specifically, the requested domain name, the identifier of the target object, and the unique identifier can be concatenated according to a first preset method to obtain the QR code.

[0137] For example, the request domain name, the identifier of the target object, and the unique identifier are concatenated according to the sequence of short code segments (i.e., the first preset method) to obtain the QR code characters, such as HTTPS: / / MA.RUN / AB / 12345678.

[0138] For example, the request domain name, the identifier of the target object, and the unique identifier are concatenated according to the sequence of short and medium codes (i.e., the first preset method) to obtain the QR code characters, such as HTTPS: / / MA.RUN / ABCD / K12345678.

[0139] If the type of the QR code to be generated indicated by the instruction information is a variable-length code that can add custom information, it can be generated through... Figure 2 In the embodiments shown in S1031-S1032, a unique code identifier corresponding to the data codeword is generated based on the target character set and the target encryption key set.

[0140] Accordingly, after generating a unique identifier corresponding to the data codeword, the request domain name, encoding version, target object identifier, custom information, and unique identifier are concatenated according to the second preset method to obtain the QR codeword.

[0141] Figure 4 This application provides a flowchart of a QR code recognition method, the execution entity of which can be a server, such as... Figure 4 As shown, the method may include:

[0142] S301. Receive a query request sent by a QR code recognition device. The query request carries the QR code.

[0143] Specifically, the QR code recognition device scans the QR code and parses it to obtain the QR code text, then sends a query request carrying the QR code text to the server. Optionally, after scanning the QR code and obtaining the QR code text, the QR code recognition device can also determine the URL address in the QR code text and redirect the current page to the corresponding mini-program page or H5 page.

[0144] S302. Based on the length of the QR code, the content of the QR code, and the code segment information of the pre-stored data code, the identification is performed to obtain the identification result.

[0145] Optionally, in one feasible approach, the recognition result is obtained by identifying the QR code based on its length, content, and pre-stored data code segment information. Specifically, this can be as follows:

[0146] S3021. If the type of the QR code is determined to be either the first code type or the second code type based on the length of the QR code, or if the type of the QR code is determined to be the third code type based on the length of the QR code, and the verification is successful, then the QR code is parsed according to the preset parsing method to obtain the content of the QR code.

[0147] S3022. Obtain the unique identifier and encryption key from the content of the QR code code.

[0148] S3023. Determine the target character set of the QR code based on the type of the QR code and the correspondence between the pre-stored QR code type and the character set of the unique identifier.

[0149] S3024. Based on the encryption key and the target character set, decrypt the unique identifier to obtain the data codeword.

[0150] S3025. Determine the recognition result based on the data codeword and the code segment information of the data codeword.

[0151] Optionally, in S3025, the recognition result is determined based on the data codeword and the code segment information of the data codeword, which can be specifically:

[0152] Based on the type of QR code codeword and the code segment information of the data codeword, the target code segment of the data codeword is determined. If the data codeword is within the target code segment range, the data codeword is determined as the recognition result; if the data codeword is not within the target code segment range, the recognition error information is determined as the recognition result.

[0153] Optionally, in this embodiment, determining that the verification was successful can be specifically as follows:

[0154] Read the check bit information from the QR code codeword, perform verification based on the check bit information, and if the verification passes, the verification is considered successful.

[0155] Optionally, the method in this embodiment may further include: performing verification based on the verification bit information; if the verification does not fail, then determining the verification failure information as the recognition result.

[0156] S303. Send the recognition result to the QR code recognition device.

[0157] Optionally, after receiving the recognition result, the QR code recognition device can also display the recognition result.

[0158] The QR code recognition method provided in this embodiment recognizes QR code characters based on their length, content, and pre-stored data segment information, thereby obtaining recognition results. This allows for flexible recognition of QR code characters of different lengths, thus meeting the needs of different scenarios.

[0159] Figure 5 This is a schematic diagram of the structure of a QR code character generation device provided in an embodiment of this application, as shown below. Figure 5 As shown, the device may include: a receiving module 11, a first generating module 12, a second generating module 13, and a third generating module 14.

[0160] The receiving module 11 is used to receive a QR code generation request. The QR code generation request carries the identifier of the target object and the QR code type indication information. Different types of QR code characters correspond to different code character length ranges.

[0161] The first generation module 12 is used to generate data codewords according to the target code segment. The target code segment is determined according to the codeword type of the QR code indicated by the indication information and the code segment information of the pre-stored data codewords.

[0162] The second generation module 13 is used to generate a unique code identifier corresponding to the data codeword based on the target character set and the target encryption key set. The target character set is determined according to the QR code codeword type indication information.

[0163] The third generation module 14 is used to generate QR code characters based on the requested domain name, the identifier of the target object, and the unique code identifier.

[0164] Optionally, the second generation module 13 is further configured to: determine the target character set from the pre-stored correspondence between the QR code code type and the character set of the unique code identifier according to the QR code code type indication information;

[0165] Based on the identifier of the target object, the target encryption key set is determined from the pre-stored correspondence between object identifiers and encryption key sets.

[0166] Optionally, the second generation module 13 is used to: convert the data codewords into M-ary based on the target character set to obtain the first string, where M is the number of characters included in the target character set;

[0167] Select an encryption key from the target encryption key set, and use the encryption key to encrypt the first string to generate a unique identifier.

[0168] Optionally, the second generation module 13 is specifically used to: encrypt the first string using the FPE encryption algorithm with the encryption key to obtain the second string;

[0169] The identifier of the encryption key is converted to base M based on the target character set to obtain the target character with a codeword space of 1. The target character is then concatenated with the second string at a preset position to obtain a unique identifier, where M is the number of characters included in the target character set.

[0170] Optionally, the third generation module 14 is used to: concatenate the request domain name, the identifier of the target object and the unique code identifier according to the first preset method to obtain the QR code.

[0171] Optionally, if the QR code code type indication information indicates that the QR code code type is the third code type, the QR code code generation request also carries custom information. The second generation module 13 is specifically used to: determine the length of the unique code identifier, the QR code generation version, and the error correction level based on the length of the custom information and the type of characters in the custom information.

[0172] Generate a unique identifier corresponding to the data codeword based on the target character set, the target encryption key set, and the length of the unique identifier.

[0173] Optionally, the second generation module 13 is specifically used to: convert the data codewords into M-ary based on the target character set to obtain the first string, where M is the number of characters included in the target character set;

[0174] If the length of the first string is less than N-1, where N is the length of the encryption bits in the unique identifier, zero characters are added to the front of the first string until the length of the second string obtained after adding zeros is equal to N-1.

[0175] Select an encryption key from the target encryption key set, and use the encryption key to encrypt the second string using the FPE encryption algorithm to generate the third string;

[0176] Perform a hash calculation on the third string, and convert the hash result to base M to obtain the target result;

[0177] Take the character at the preset position in the target result as the check character, and concatenate the third string with the check character to obtain the unique identifier.

[0178] Optionally, the third generation module 14 is used to generate QR code characters based on the requested domain name, encoding version, target object identifier, custom information, and unique code identifier.

[0179] Optionally, the third generation module 14 is specifically used to: concatenate the request domain name, encoding version, target object identifier, custom information and unique code identifier according to the second preset method to obtain the QR code characters.

[0180] Optionally, the third generation module 14 is also used to: carry the QR code generation version and error correction level in the QR code package composed of QR code characters, so as to instruct the QR code package to generate a QR code graphic according to the QR code generation version and error correction level.

[0181] Figure 6 This is a schematic diagram of the structure of a QR code recognition device provided in an embodiment of this application, as shown below. Figure 6 As shown, the device may include a receiving module 21, an identification module 22, and a sending module 23.

[0182] The receiving module 21 is used to receive a query request sent by the QR code recognition device, and the query request carries the QR code characters.

[0183] The recognition module 22 is used to recognize the QR code based on the length of the QR code, the content of the QR code, and the code segment information of the pre-stored data code, and obtain the recognition result;

[0184] The sending module 23 is used to send the recognition result to the QR code recognition device.

[0185] Optionally, the recognition module 22 is used to: if the type of the QR code is determined to be the first code type or the second code type based on the length of the QR code, or if the type of the QR code is determined to be the third code type based on the length of the QR code, and the verification is successful, then parse the QR code according to the preset parsing method to obtain the content of the QR code;

[0186] Obtain the unique identifier and encryption key from the content of the QR code;

[0187] The target character set of the QR code is determined based on the type of QR code and the correspondence between the pre-stored QR code code type and the character set of the unique code identifier.

[0188] Based on the encryption key and the target character set, the unique identifier is decrypted to obtain the data codeword;

[0189] The recognition result is determined based on the data codeword and the code segment information of the data codeword.

[0190] Optionally, the recognition module 22 is specifically used to: determine the target code segment of the data code character based on the type of the QR code code character and the code segment information of the data code character;

[0191] If the data codeword is within the target code segment range, then the data codeword is determined as the recognition result;

[0192] If the data codeword is not within the target code segment range, the recognition error message will be determined as the recognition result.

[0193] Optionally, confirm successful verification by including:

[0194] Read the check bit information from the QR code codeword, perform verification based on the check bit information, and if the verification passes, the verification is considered successful.

[0195] Optionally, the recognition module 22 is also used to: perform verification based on the check bit information, and if the verification does not fail, determine the verification failure information as the recognition result.

[0196] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, Figure 5 The QR code generation device shown or Figure 6 The QR code recognition device shown can execute the method embodiment corresponding to the computer device, and the foregoing and other operations and / or functions of each module in the device are respectively for implementing the method embodiment corresponding to the computer device. For the sake of brevity, they will not be described in detail here.

[0197] The QR code generation device and QR code recognition device of this application embodiments have been described above from the perspective of functional modules, with reference to the accompanying drawings. It should be understood that these functional modules can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by the integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the methods disclosed in this application embodiments can be directly manifested as execution by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.

[0198] Figure 7 This is a schematic block diagram of the computer device 300 provided in the embodiments of this application.

[0199] like Figure 7 As shown, the computer device 300 may include:

[0200] The system includes a memory 310 and a processor 320. The memory 310 stores computer programs and transfers the program code to the processor 320. In other words, the processor 320 can retrieve and run the computer program from the memory 310 to implement the methods described in the embodiments of this application.

[0201] For example, the processor 320 can be used to execute the above-described method embodiments according to instructions in the computer program.

[0202] In some embodiments of this application, the processor 320 may include, but is not limited to:

[0203] General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0204] In some embodiments of this application, the memory 310 includes, but is not limited to:

[0205] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).

[0206] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 310 and executed by the processor 320 to complete the method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.

[0207] like Figure 7 As shown, the computer device may further include:

[0208] Transceiver 330, which can be connected to processor 320 or memory 310.

[0209] The processor 320 can control the transceiver 330 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 330 may include a transmitter and a receiver. The transceiver 330 may further include antennas, and the number of antennas may be one or more.

[0210] It should be understood that the various components in the electronic device are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.

[0211] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, this application also provides a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.

[0212] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0213] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments of this application.

[0214] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.

[0215] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0216] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be included within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. A method for generating QR code characters, characterized in that, include: Receive a QR code character generation request. The QR code character generation request carries the identifier of the target object and QR code character type indication information. Different types of QR code characters correspond to different code character length ranges. The target code segment is determined based on the code segment information of the QR code code type indicated by the instruction information and the code segment information of the pre-stored data code segment, and the data code segment is generated based on the target code segment; The target character set is determined according to the instruction information, and a unique code identifier corresponding to the data codeword is generated according to the target character set and the target encryption key set. A QR code is generated based on the requested domain name, the identifier of the target object, and the unique identifier.

2. The method according to claim 1, characterized in that, Determining the target character set based on the indication information includes: Based on the instruction information, the target character set is determined from the correspondence between the pre-stored QR code codeword types and the character sets of unique code identifiers; The method further includes: Based on the identifier of the target object, the target encryption key set is determined from the pre-stored correspondence between object identifiers and encryption key sets.

3. The method according to claim 1, characterized in that, The step of generating a unique identifier corresponding to the data codeword based on the target character set and the target encryption key set includes: Based on the target character set, the data codewords are converted to base M to obtain a first string, where M is the number of characters included in the target character set; Select an encryption key from the target encryption key set, and use the encryption key to encrypt the first string to generate the unique identifier.

4. The method according to claim 3, characterized in that, The step of encrypting the first string using the encryption key to generate the unique identifier includes: The first string is encrypted using the format-preserving FPE encryption algorithm with the encryption key to obtain the second string; The identifier of the encryption key is converted into M-ary according to the target character set to obtain a target character with a codeword space of 1. The target character is then concatenated with the second string at a preset position to obtain the unique identifier, where M is the number of characters included in the target character set.

5. The method according to claim 1, characterized in that, If the QR code type indication information indicates that the QR code type is a third type, the QR code generation request also carries custom information; The step of generating a unique identifier corresponding to the data codeword based on the target character set and the target encryption key set includes: The length of the unique identifier, the QR code generation version, and the error correction level are determined based on the length of the custom information and the type of characters in the custom information. A unique identifier corresponding to the data codeword is generated based on the target character set, the target encryption key set, and the length of the unique identifier.

6. The method according to claim 5, characterized in that, The step of generating a unique identifier corresponding to the data codeword based on the target character set, the target encryption key set, and the length of the unique identifier includes: Based on the target character set, the data codewords are converted to base M to obtain a first string, where M is the number of characters included in the target character set; If the length of the first string is less than N-1, where N is the length of the encryption bits in the unique identifier, the length of the second string obtained by padding the first string with zero characters until the first string is equal to N-1; Select an encryption key from the target encryption key set, and use the encryption key to encrypt the second string using the FPE encryption algorithm to generate the third string; Perform a hash calculation on the third string, and then perform the M-ary conversion on the hash calculation result to obtain the target result; The character at a preset position in the target result is taken as the check character, and the third string is concatenated with the check character to obtain the unique identifier.

7. The method according to claim 5, characterized in that, The step of generating a QR code based on the requested domain name, the identifier of the target object, and the unique identifier includes: The QR code is generated based on the requested domain name, encoding version, the identifier of the target object, the custom information, and the unique code identifier.

8. The method according to claim 7, characterized in that, After generating the QR code characters, the process further includes: The generated QR code version and the error correction level are carried in the QR code package composed of the QR code characters, so as to instruct the QR code package to generate a QR code graphic according to the generated QR code version and the error correction level.

9. A QR code recognition method, characterized in that, include: Receive a query request sent by a QR code recognition device, wherein the query request carries QR code characters; If the type of the QR code is determined to be a first code type or a second code type based on the length of the QR code, or if the type of the QR code is determined to be a third code type based on the length of the QR code, and the verification is successful, then the QR code is parsed according to a preset parsing method to obtain the content of the QR code. Obtain the unique identifier and encryption key from the content of the QR code codeword; The target character set of the QR code is determined based on the type of the QR code and the correspondence between the pre-stored QR code type and the character set of the unique code identifier. The unique identifier is decrypted using the encryption key and the target character set to obtain the data codeword; The recognition result is determined based on the data codeword and the code segment information of the data codeword; The recognition result is sent to the QR code recognition device.

10. The method according to claim 9, characterized in that, Determining the recognition result based on the data codeword and the code segment information of the data codeword includes: Based on the type of the QR code codeword and the code segment information of the data codeword, determine the target code segment of the data codeword; If the data codeword is within the target code segment range, then the data codeword is determined as the recognition result; If the data codeword is not within the target code segment range, then the identification error information is determined as the identification result.

11. A QR code character generation device, characterized in that, include: The receiving module is used to receive a QR code generation request. The QR code generation request carries the identifier of the target object and QR code type indication information. Different types of QR code characters correspond to different code character length ranges. The first generation module is used to determine the target code segment based on the QR code code type indicated by the indication information and the code segment information of the pre-stored data code segment, and generate data code words based on the target code segment; The second generation module is used to determine the target character set according to the indication information, and generate a unique code identifier corresponding to the data codeword according to the target character set and the target encryption key set. The third generation module is used to generate QR code characters based on the requested domain name, the identifier of the target object, and the unique code identifier.

12. A QR code recognition device, characterized in that, include: The receiving module is used to receive a query request sent by the QR code recognition device, wherein the query request carries the QR code characters; The recognition module is used to determine that the type of the QR code is a first code type or a second code type based on the length of the QR code, or if the type of the QR code is a third code type based on the length of the QR code, and the verification is successful, then parse the QR code according to a preset parsing method to obtain the content of the QR code. Obtain the unique identifier and encryption key from the content of the QR code codeword; The target character set of the QR code is determined based on the type of the QR code and the correspondence between the pre-stored QR code type and the character set of the unique code identifier. The unique identifier is decrypted using the encryption key and the target character set to obtain the data codeword; The recognition result is determined based on the data codeword and the code segment information of the data codeword; The sending module is used to send the recognition result to the QR code recognition device.

13. A computer device, characterized in that, include: A processor and a memory, the memory being used to store a computer program, the processor being used to invoke and run the computer program stored in the memory to perform the method of any one of claims 1 to 8 or 9 to 10.

14. A computer-readable storage medium, characterized in that, Includes instructions that, when executed on a computer program, cause the computer to perform the method as described in any one of claims 1 to 8 or 9 to 10.

Citation Information

Patent Citations

  • Two-dimension code generation, identification and information providing method, device and system

    CN104424496A