Encryption generation method and decryption method of combination code

By combining positioning graphics and identifying graphics in the QR code to generate dot-shaped gold dot codes, the problem of QR code being vulnerable to attack is solved, safer data transmission and identification is achieved, cost reduction and broadening the scope of application.

CN120387472APending Publication Date: 2025-07-29SHENZHEN JINTIANSU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510510803.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

QR codes are vulnerable to attacks, resulting in the leakage of sensitive information and the circulation of counterfeit and shoddy goods. The existing technology cannot effectively solve data security problems.

Method used

Generate dot-shaped gold dot codes, and generate positioning and recognition graphics on the BufferedImage layer, merge them with standard QR codes to form a combined code, and use custom graphics generation algorithms and mechanical visual recognition technology for decryption.

Benefits of technology

It improves the security of QR codes, broadens the scope of application, reduces the identification cost, maintains compatibility with traditional QR codes, and provides a more secure and reliable alternative.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120387472A_ABST
    Figure CN120387472A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of information security, and particularly discloses an encryption generation method and decryption method of a combination code, and the method comprises the steps: obtaining public data and to-be-encrypted data; generating a standard two-dimensional code based on the public data; a Buffer Image layer is generated on the basis of the standard two-dimensional code; calculating the data to be encrypted to generate positioning graphs and recognition graphs, compiling the positioning graphs and the recognition graphs to a Buffer Image layer to generate dot-shaped gold dot codes, and the distribution of the positioning graphs and the recognition graphs on the Buffer Image layer is that every four positioning graphs correspond to one recognition graph; the point-shaped gold point code and the standard two-dimensional code are combined to generate the combined code and the point-shaped font code, so that the problem that the original two-dimensional code is easily attacked is solved, the application range of the bar code technology is expanded by the powerful functionality of the bar code, a safer and more reliable alternative scheme is provided for the market, the bar code is basically consistent with the original two-dimensional code in use, and the application range of the bar code technology is expanded. And mechanical printing or printing compatibility is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security technology, and specifically to an encryption generation method and a decryption method for a combined code. Background Art

[0002] Due to the high circulation and easy-to-use characteristics of two-dimensional codes, they have been widely used in many fields such as commodity circulation and information transmission. Any device, such as a smart phone, a handheld PDA, etc., can scan and identify the content in the two-dimensional code through the built-in "scan" function.

[0003] However, this universality and convenience also bring data security problems: during the process of commodity circulation, two-dimensional codes are easily illegally copied or imitated, which may not only lead to the leakage of sensitive information, but also facilitate the circulation of counterfeit and shoddy goods, thus damaging the legitimate rights and interests of merchants and consumers.

[0004] Due to the universality of two-dimensional codes and the fact that they are an open-source product themselves, the content of two-dimensional codes is not protected and can be easily parsed into plain text. Therefore, how to solve the problem of data theft caused by the exposure of two-dimensional codes is an issue that needs to be considered in the present invention. Summary of the Invention

[0005] The purpose of the present invention is to provide an encryption generation method and a decryption method for a combined code to solve the problems raised in the above background art.

[0006] To achieve the above purpose, the present invention provides the following technical solution: An encryption generation method for a combined code, the method comprising:

[0007] Obtain public data and data to be encrypted;

[0008] Generate a standard two-dimensional code based on the public data; generate a BufferedImage layer based on the standard two-dimensional code;

[0009] Calculate the positioning pattern and the recognition pattern for the data to be encrypted, and compile the positioning pattern and the recognition pattern onto the BufferedImage layer to generate a dot-like gold dot code. The distribution of the positioning pattern and the recognition pattern on the BufferedImage layer is such that one recognition pattern corresponds to every four positioning patterns;

[0010] Merge the dot-like gold dot code with the standard two-dimensional code to generate a combined code.

[0011] As a further scheme of the present invention, the BufferedImage layer further includes meaningless patterns, and the meaningless patterns correspond to the positioning patterns.

[0012] As a further scheme of the present invention, the recognition pattern is an asymmetric structure.

[0013] As a further solution of the present invention, the merging method of the dot-shaped gold dot code and the standard two-dimensional code is embedding or splicing.

[0014] The present invention also provides a decryption method for the combined code, and the method includes:

[0015] Obtain the combined code image data, and generate the standard two-dimensional code image data and the dot-shaped gold dot code image data based on the combined code image data;

[0016] Identify and decrypt the standard two-dimensional code data, and output the public data;

[0017] Identify and decrypt the positioning pattern and the recognition image of the dot-shaped gold dot code image data, and output the encrypted data.

[0018] As a further solution of the present invention, the method further includes adjusting the combined code image data to be horizontal based on a multi-angle classifier.

[0019] As a further solution of the present invention, the step of identifying and decrypting the positioning pattern and the recognition image of the dot-shaped gold dot code image data to output the encrypted data specifically includes:

[0020] Identify the positioning points in the positioning pattern of the dot-shaped gold dot code image data;

[0021] Divide the recognition graphic area in the image data according to the positioning points;

[0022] Convert the recognition graphic area into a standard rectangular image based on affine transformation;

[0023] Identify and decrypt the recognition graphic area, and output the encrypted data.

[0024] Compared with the prior art, the beneficial effects of the present invention are: the dot-shaped character code solves the problem that the original two-dimensional code is vulnerable to attack, and with its powerful functionality, it broadens the application scope of the bar code technology, provides a more secure and reliable alternative for the market, is basically the same as the original two-dimensional code in use, and has high compatibility with mechanical printing or printing. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention.

[0026] Figure 1 It is a flowchart of a two-dimensional code encryption method provided by an embodiment of the present invention.

[0027] Figure 2The combined code with different merging methods provided by the embodiments of the present invention.

[0028] Figure 3 The enlarged view of the dot-shaped gold dot code embedded in the standard two-dimensional code provided by the embodiments of the present invention.

[0029] Figure 4 The data set diagram of a dot-shaped gold dot code provided by the embodiments of the present invention.

[0030] Figure 5 The graphic annotation diagram of a dot-shaped gold dot code provided by the embodiments of the present invention.

[0031] Figure 6 The flowchart of the decryption process provided by the embodiments of the present invention.

[0032] Among them, 1. Positioning graphic; 2. Identification graphic area; 3. Two-dimensional code identification area. Specific implementation manner

[0033] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer, the following further details the present invention in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0034] As Figures 1 to 5 shown, Figure 1 It is a flowchart of an encryption generation method of a combined code. In the embodiments of the present invention, an encryption generation method of a combined code, the method includes steps S100 to step S400:

[0035] Step S100, obtaining public data and data to be encrypted;

[0036] Step S200, generating a standard two-dimensional code based on the public data; generating a BufferedImage layer based on the standard two-dimensional code;

[0037] Step S300, calculating the data to be encrypted to generate a positioning graphic and an identification graphic, compiling the positioning graphic and the identification graphic onto the BufferedImage layer to generate a dot-shaped glyph code, and the distribution of the positioning graphic and the identification graphic on the BufferedImage layer is that every four positioning graphics correspond to one identification graphic;

[0038] Step S400, merging the dot-shaped gold dot code with the standard two-dimensional code to generate a combined code.

[0039] In this embodiment, the combined code includes a positioning pattern 1, an identification pattern area 2, and a QR code identification area 3. To generate the combined code, an open-source QR code plugin (such as zxing) and a custom dot-shaped font code generation algorithm are mainly required. First, a standard QR code generation component is used to convert the data into a QR code BitMatrix. Then, a new BufferedImage layer is generated using the width, height, and RGB mode of the QR code. The BufferedImage layer is an image class with a buffer, and its main function is to load an image into memory, providing functions such as obtaining a drawing object, image scaling, and selecting image smoothness. It is usually used for image size transformation, image grayscaling, setting transparency, etc. On the BufferedImage layer, according to the relationship between the data and the graphics, the custom dot-shaped font code generation algorithm is used to calculate the distribution of the compiled graphics on the layer. Specifically, one identification pattern is drawn in every four positioning patterns 1, and each piece of data corresponds to one identification pattern. These graphics together form a dot-shaped font code. After the data layer is compiled, the layer is merged with the QR code layer, and different styles of combined codes can be generated using embedding or splicing methods. According to different structures of the gold dot codes, different error correction levels of the QR code are required. For example, when the graphics are inside the QR code, since the graphics will cover part of the QR code content, a high error correction level (H level) is required to correctly read the content of the QR code.

[0040] The identification pattern area 2 can be regarded as composed of small squares of x multiplied by x. If the length of each line of content to be stored is y multiplied by y (for example, to generate the character "12345679" with a length of 9, the content length is 3x3), the total number of squares in each line is calculated as y*(x + 1)+1 according to the length of the data to be stored. The side length of each small square should be the width and height of the QR code divided by the calculated number.

[0041] For example, if the graphic designed for storing data is a 3x3 nine-square grid graphic and the length of the data to be stored is 2x2, then the total number of squares in the graphic is 2*(3 + 1)+1 = 9. The entire dot-shaped graphic code should be composed of 9 multiplied by 9, a total of 81 squares. Each identification area consists of 4 positioning points and the central 3x3 graphic area. The positioning points can be a pattern or a graphic. For example, when the identification pattern is composed of dots, the positioning points can be squares to form a distinct contrast. The data set of squares in each line is generated through the custom dot-shaped font code generation algorithm, such as Figure 4, where 1 represents the positioning point, 0 represents no data, and 2 represents the glyph code point. After generating the dataset related to the glyph code, two loops are defined using the x and y axes. The first layer is for(int i = 0; i < the total number of the dataset; i++), and the second layer is for (int j = 0; j < the number of digits in each row; j++). Locate the graphics and positions to be rendered in the layer. On the x-axis, it is 0 + j * width, and on the y-axis, it is 0 + i * width, generating the corresponding graphics with a width of width, where width is the side length of the QR code divided by the number of digits in each row. Merge the generated layers. If the glyph code needs to be embedded in the QR code, the actual x and y axes used are the side length of the QR code divided by 2 minus half of the side length of the glyph code.

[0042] The dot-shaped glyph code solves the security problem of the exposed QR code. A new recognition layer of the dot-shaped glyph code is added to the original standard QR code. The data is calculated through a custom graphic generation algorithm and then the positioning graphic 1 and the recognition graphic are generated. The recognition graphic is given a specific meaning, that is, the data represented in model recognition is defined by different shape arrangements of the dot pattern. The generation is mainly achieved by byte decompilation into an image. The positions of the code points are marked with 0 and 1 characters, where 0 represents empty and 1 represents having a code point. The composition of each column of graphics is completed through the arrangement of 010101. Finally, it is converted into a specific graphic through bytes. The range of each image area to be recognized is determined by the positioning graphic 1, and the image area contains different asymmetric images.

[0043] The dot-shaped glyph code can operate independently or as a supplement to the existing QR code system, and is applicable to various business scenarios including but not limited to product anti-counterfeiting and identity verification. Compared with other glyph code technologies on the market, other glyph codes use microscopic recognition in design. The graphics are precise and cannot use ordinary paper, otherwise it is easy to cause code point diffusion and lead to unrecognizable information. In actual use, relatively precise printing or printing is required to generate physical objects, and the use cost is high. While the dot-shaped glyph code mainly uses graphics for recognition in design, and has good tolerance for the size of the graphics and the deviation of graphic diffusion. Ordinary household printers can also print physical objects and recognize them, reducing the use cost of this encoding and recognition technology of the glyph code.

[0044] The dot-shaped glyph code solves the problem that the original QR code is vulnerable to attacks, and with its powerful functionality, it broadens the application scope of bar code technology, providing a more secure and reliable alternative solution for the market. In terms of use, it is basically the same as the original QR code and has high compatibility with mechanical printing or printing.

[0045] As a preferred embodiment of the present invention, the BufferedImage layer further includes meaningless graphics, and the meaningless graphics correspond to the positioning graphics 1.

[0046] In this embodiment, through the mixed storage of meaningless graphics and encrypted data, the difficulty of cracking and identifying the graphics can be increased, and the parsing and identification of meaningless graphics can be skipped during the identification process, greatly enhancing the information capacity while maintaining a high level of security.

[0047] Compared with traditional two-dimensional codes, the design of dot-shaped glyph codes is more flexible and variable, allowing users to customize their appearance and the amount of information they carry according to their needs. Among them, the shape corresponding to the commodity can be formed by code points, such as animals, people, or brand logos.

[0048] Such as Figure 3 As shown, as a preferred embodiment of the present invention, the recognition graphics are of an asymmetric structure.

[0049] In this embodiment, by adopting an asymmetric graphic design, the dot-shaped glyph code has good viewing angle adaptability and can maintain a high recognition accuracy even at different angles.

[0050] Such as Figure 5 、 Figure 6 As shown, the present invention also provides a decryption method for a combined code, and the method includes:

[0051] Obtain the combined code image data, and generate standard two-dimensional code image data and dot-shaped gold dot code image data based on the combined code image data;

[0052] Identify and decrypt the standard two-dimensional code data, and output the public data;

[0053] Identify and decrypt the positioning graphics 1 and the recognition graphics in the dot-shaped gold dot code image data, and output the encrypted data.

[0054] In this embodiment, during the recognition and decryption process, machine vision recognition (such as opencv) is required, and it is also necessary to construct and train a large image recognition model. Through the data accumulated in the large image recognition model, data decryption of the image is performed to obtain dot-shaped glyph code data. If there is no corresponding image recognition decryption algorithm, only the QR code data can be collected in the plain code, and the dot-shaped image code data remains encrypted. In terms of data security, the data involves two decoding processes. The QR code data and the dot-shaped glyph code data can be used independently or in combination. When used in combination, the two sets of data match each other one by one. If only the QR code data exposed on the outer layer is obtained, this QR code data will not be recognized as a complete piece of data. At the same time, the glyph code supports independent use. Currently, the meanings that the glyph code can represent include: numbers 0-9, lowercase letters a-z, and four special symbols "@", "#", "+", "*".

[0055] During the construction process, it is necessary to perform sample annotation and feature annotation on the large image recognition model. Annotation is to manually label the data that needs to be recognized and distinguished. The deep neural network learns the features of these annotated data and finally realizes the function of autonomous recognition. The annotation tasks include QR code, glyph code region selection, segmentation of the positions of single glyph code characters, and angle classification of the input pictures.

[0056] During recognition, it is necessary to parse the QR code content through a standard QR code parsing component. For the dot-shaped glyph code, it is necessary to first use machine vision to mark the positioning points and recognition areas through annotation, cut each recognition graphic through the positioning points, set the data corresponding to each annotated image, and finally relevant data can be parsed through the accumulated data set.

[0057] QR code, glyph code detection tasks: Three categories are annotated, namely QR code, glyph code, and Datamatrix code. Glyph code segmentation: The number of types of annotation is based on the number of glyph code dictionaries. Image angle classification: Each collected original image is represented by 0, 1, 2, 3, representing 0 degrees, 90 degrees, 180 degrees, and 270 degrees of the original image respectively. It needs to go through a round of training before it can be used for the first time. The subsequent data iteration method is to collect error use case data in the production process and accumulate it to a certain amount of time, and then perform further fine-tuning training on the current model to continuously improve the robustness of the model.

[0058] Object detection: YOLOv5 is a single-stage object detection algorithm. This algorithm adds some new improvement ideas on the basis of YOLOv4, greatly improving its speed and accuracy. The main improvement ideas are as follows:

[0059] Input end: During the model training stage, some improvement ideas are proposed, mainly including Mosaic data augmentation, adaptive anchor box calculation, and adaptive image scaling.

[0060] Base Network: Incorporate some new ideas from other detection algorithms, mainly including: Focus structure and CSP structure;

[0061] Neck Network: In object detection networks, some layers are often inserted between the BackBone and the final Head output layer. In Yolov5, the FPN+PAN structure is added;

[0062] Head Output Layer: The anchor box mechanism of the output layer is the same as that of YOLOv4. The main improvements are the loss function GIOU_Loss during training and DIOU_nms for predicting box screening.

[0063] In this project, the object detection algorithm is used to locate the QR code in the image and the position of the glyph code in the image.

[0064] Keypoint Detection:

[0065] Keypoint Detection is a computer vision technique aimed at locating the positions of specific points on an object or a human body. These points are usually important anatomical or structural features.

[0066] Keypoint Detection is usually based on deep learning models. By training a dataset with annotated keypoint positions, the model learns to automatically detect these keypoints in new images. The process of keypoint detection can be divided into the following steps:

[0067] Data Preprocessing: Include image normalization, data augmentation, etc., to improve the generalization ability of the model.

[0068] Feature Extraction: Extract deep features of the image through a convolutional neural network. These features can well represent the important information in the image.

[0069] Keypoint Prediction: Use a fully connected layer or a convolutional layer to predict the positions of keypoints in the image. Common output forms include regression methods and heatmap methods.

[0070] Regression Method: Directly regress the coordinates of each keypoint.

[0071] Heatmap Method: Generate a probability heatmap for each keypoint and determine the position of the keypoint through the peak of the heatmap.

[0072] Post-Processing: Include non-maximum suppression (NMS), coordinate correction, etc., to further improve the accuracy of keypoint detection.

[0073] In the glyph code, the keypoint detection technology in object detection is used to locate the four vertices of the minimum bounding rectangle of the QR code + glyph code area.

[0074] The mature QR code recognition library (Wechat QR code algorithm) currently on the market is used to identify the exact content of the QR code and assist in locating the QR code.

[0075] Glyph code recognition requires the use of an image classifier based on a glyph code dictionary. The segmented single-character glyph codes are input into the classifier, and the values in the dictionary corresponding to the confidence level of the single-character image are classified. All the results are combined in the order of the image arrangement to form a glyph code recognition module.

[0076] As a preferred embodiment of the present invention, the method further includes adjusting the combined code image data to be horizontal based on a multi-angle classifier.

[0077] In this embodiment, a traditional CNN network, such as Resnet, is used to train a four-angle classifier on the dataset, aiming to convert the input image into an image with the smallest horizontal angle, so as to improve the accuracy of key points and segmentation.

[0078] like Figure 5 、 Figure 6 As shown, as a preferred embodiment of the present invention, the steps of positioning the pattern 1 and identifying the image and decrypting the image, and outputting the encrypted data specifically include:

[0079] Identify the positioning point in the positioning pattern 1 based on the dot-shaped gold dot code image data;

[0080] Segment the recognition graphic area 2 in the image data according to the positioning points;

[0081] Converting the recognition graphic area 2 into a standard rectangular image based on affine transformation;

[0082] Identify and decrypt the identification graphic area 2 and output the encrypted data.

[0083] In this embodiment, an open source machine vision recognition system (such as OpenCV) is used to collect samples of the generated dot-shaped glyph code. A portion of the samples are original images and a portion are real objects. By using real objects and original images, sample examples can be increased, making the initial version of the model more robust. Then, the collected images are annotated, such as Figure 5 , let the machine vision know how to obtain the recognition area, locate the QR code in the image, correct the image according to the QR code position, identify the positioning points of the corrected image, crop the graphic recognition area in the image according to the positioning points, perform feature matching based on each small graphic, and finally return the parsed data. Machine training is a long process. Depending on the different training content, the recognition efficiency and accuracy vary.

[0084] In the field of computer vision, object segmentation refers to the process of subdividing a digital image into multiple image sub-regions (sets of pixels), where the features within the same sub-region have a certain degree of similarity, and the features of different sub-regions show relatively obvious differences.

[0085] The goal of image segmentation is to classify each pixel in the image. Currently, there are mainly two types of image segmentation tasks: semantic segmentation and instance segmentation.

[0086] Semantic segmentation is to assign a class label to each pixel in the image. For example, we can classify the pixels in the image as people, sheep, dogs, grassland, etc.

[0087] Instance segmentation, compared with semantic segmentation, not only needs to distinguish pixels of different classes, but also needs to distinguish different individuals of the same class. It not only requires classifying, but also separating each individual: sheep 1, sheep 2, sheep 3, sheep 4, sheep 5, etc.

[0088] Currently, the tasks of image segmentation mainly focus on semantic segmentation, and the current difficulty also lies in "semantics". The same object expressing a certain semantics does not always appear in the same form, such as having different colors, textures, etc., which poses a great challenge to accurate segmentation. Moreover, judging from the current model performance, there is still a large room for improvement in accuracy. The idea of instance segmentation is mainly object detection + semantic segmentation, that is, using the object detection method to frame different instances in the image, and then using the semantic segmentation method to perform per-pixel labeling within different detection results.

[0089] In the glyph code, image segmentation technology is used to divide the area of the glyph code into individual glyph codes for subsequent recognition.

[0090] Affine transformation means that in geometry, a vector space undergoes a linear transformation and then a translation to transform into another vector space. An affine transformation is geometrically defined as an affine transformation between two vector spaces, consisting of a non-singular linear transformation followed by a translation transformation.

[0091] In the finite-dimensional case, each affine transformation can be given by a matrix A and a vector b, and it can be written as A and an additional column b. An affine transformation corresponds to the multiplication of a matrix and a vector, and the composition of affine transformations corresponds to ordinary matrix multiplication, as long as an extra row is added to the bottom of the matrix, with all elements in this row being 0 except the rightmost one which is 1, and a 1 is added to the bottom of the column vector.

[0092] In the glyph code, affine transformation is used to convert the image of the positions of irregular vertices obtained in key point detection into a standard rectangular image and rotate the image by an angle to improve the accuracy of glyph code segmentation and recognition.

[0093] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for encrypting and generating a combined code, characterized in that, The method includes: Obtaining public data and data to be encrypted; Generating a standard QR code based on the public data; generating a BufferedImage layer based on the standard QR code; Calculating the data to be encrypted to generate positioning graphics and recognition graphics, mapping the positioning graphics and recognition graphics onto the BufferedImage layer to generate a dot gold point code, and the distribution of the positioning graphics and recognition graphics on the BufferedImage layer is such that one recognition graphic corresponds to every four positioning graphics; Merging the dot gold point code with the standard QR code to generate a combined code.

2. The encryption generation method of a combined code according to claim 1, characterized in that The BufferedImage layer further includes meaningless graphics, and the meaningless graphics correspond to the positioning graphics.

3. The encryption generation method of a combined code according to claim 1, characterized in that, The recognition graphic is an asymmetric structure.

4. A method for encrypting and generating a combined code according to claim 1, wherein The merging method of the dot gold point code and the standard QR code is embedding or splicing.

5. A decryption method for a combined code, characterized in that, The method includes: Obtaining combined code image data, and generating standard QR code image data and dot gold point code image data based on the combined code image data; Identifying and decrypting the standard QR code data to output public data; Identifying and decrypting the positioning graphics and recognition images of the dot gold point code image data to output encrypted data.

6. The decryption method of a combined code according to claim 5, characterized in that, It further includes adjusting the combined code image data to be horizontal based on a multi-angle classifier.

7. A decryption method for a combined code according to claim 5, characterized in that The step of identifying and decrypting the positioning graphics and recognition images of the dot gold point code image data to output encrypted data specifically includes: Identifying the positioning points in the positioning graphics of the dot gold point code image data; Dividing the recognition graphic area in the image data according to the positioning points; Converting the recognition graphic area into a standard rectangular image based on affine transformation; Identifying and decrypting the recognition graphic area to output encrypted data.