Two-dimensional code generation and identification method and system based on user-defined graphic structure
By generating QR codes with custom graphic structures and utilizing high-dimensional feature vectors and fuzzy extractor algorithms, the problem of separating the visual appearance of QR codes from data security is solved, achieving efficient recognition and anti-counterfeiting capabilities in actual scanning processes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-10
AI Technical Summary
In existing QR code technology, visual appearance and data security are separated, making it easy to be forged and tampered with. Furthermore, noise and distortion during actual scanning lead to a high recognition failure rate.
A QR code is generated using a custom graphic structure. By obtaining the high-dimensional feature vector of the custom graphic structure, an encrypted key stream is generated. The encrypted data is mapped onto the graphic structure, and a fuzzy extractor algorithm is used to process noise during recognition, thus achieving a security mechanism where what you see is the key.
It achieves cryptographic binding between QR code visual identity and data security, effectively preventing forgery and tampering, improving the robustness and usability of recognition, and ensuring data security.
Smart Images

Figure CN121638294A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer data processing technology, and in particular to a method and system for generating and recognizing QR codes based on a custom graphic structure. Background Technology
[0002] Currently, QR codes (Quick Response Code), as a widely used two-dimensional matrix barcode, have permeated all aspects of information storage, product tracking, mobile payment, marketing, and daily social interaction. Traditional QR codes are mainly composed of a matrix of black and white alternating modules (squares), and their initial design purpose was for efficient machine reading, thus presenting a functional and singular appearance.
[0003] With the increasing demands of marketing and brand promotion, a series of QR code beautification technologies have emerged to improve the visual experience of QR codes and attract users to scan them. These technologies typically involve overlaying artistic images onto the background of standard QR codes, changing the color or shape of data modules, or embedding brand logos in the center of the QR code (usually utilizing the error correction capabilities of QR codes). For example, some research uses algorithms such as neural network style transfer to attempt to generate visually more user-friendly and artistic QR codes while maintaining machine readability. However, the essence of these beautification schemes is usually the overlay or modification of visual layers. Their underlying data encoding, positioning patterns, and error correction mechanisms still rely entirely on the specifications of standard QR codes. This means that aesthetics and functionality are two relatively separate layers in these technologies; the aesthetic graphics themselves do not directly participate in the data functionality or security mechanisms of the QR code.
[0004] At the same time, while QR codes bring great convenience, their inherent openness and ease of generation and copying also pose certain challenges to the field of information security. QR codes are susceptible to copying, tampering, and forgery. For example, an attack method known as QR code phishing attempts to create QR codes containing malicious links and then physically cover legitimate QR codes in public places with them (such as stickers).
[0005] Because QR codes are merely a visual representation of data, users and scanning devices sometimes find it difficult to visually verify the security and authenticity of QR code content without actually accessing the link. Existing anti-spam filters and security software may also face challenges in recognizing and decoding QR codes embedded in emails or web page images (especially those that have been artistically manipulated). Quishing attacks exploit the fact that there is a lack of verifiable strong binding between the visual identity of a QR code (the physical code seen by the user) and its digital content (the encoded data). Users trust the physical location or context in which the QR code is posted, and attackers exploit this physical trust to attempt to replace its digital content.
[0006] To address the aforementioned security issues, the industry has proposed several secure QR code solutions. Some solutions attempt to hide or steganographically embed secret information into the QR code image, or to fuse the QR code with a specific background image. For example, some technologies propose extracting the physical features of the image (such as the embossed effect of high spatial frequency images) and performing secondary encryption with the encrypted text. However, the image features (such as embossing) upon which these solutions rely may not be unique or stable enough, making them vulnerable to copying or counterfeiting in certain situations. Furthermore, CN102831375B proposes a hardware decoding scheme to improve recognition efficiency and security, but its main focus is on the hardware implementation of decoding, without addressing the security issue of the QR code content itself being replaced or forged.
[0007] In summary, the aesthetic QR code solutions in the background technology relatively separate visual identity from data security in terms of mechanism, which leaves room for improvement in their security against certain substitution attacks (such as phishing). Meanwhile, the secure QR code solutions in the background technology are either too complex in mechanism or fail to cryptographically and firmly bind the uniqueness of an arbitrary, user-defined graphic (such as a brand logo or personal hand-drawn signature) to the encryption key of the data it carries.
[0008] Furthermore, a technical challenge to consider in practical applications is that during the scanning process in the physical world, factors such as uneven lighting, tilted shooting angles, distortion of printing media, and camera noise inevitably introduce noise and distortion into the images acquired by the scanning device. This can lead to discrepancies between the scanned image features and the original image features. For security systems that rely on precise feature matching, this discrepancy presents a significant technical challenge and may increase the recognition failure rate.
[0009] Therefore, the technical problem this invention needs to solve is: how to provide a novel QR code technology that deeply binds its visual appearance (such as a unique brand logo, artistic text, or a personal hand-drawn pattern) to its data content at the cryptographic level. In other words, how to implement a QR code mechanism where what you see is the key, so that any tampering or replacement of the QR code's visual appearance (such as a quising attack) will directly lead to decryption failure; and this mechanism must also be able to effectively overcome the noise and distortion introduced during the actual physical scanning process to ensure robustness and usability in practical applications. Summary of the Invention
[0010] To address the issues mentioned in the background section regarding the ease with which QR codes can be forged and tampered with, and the separation of the visual appearance of QR codes from their data security, this invention provides a method and system for generating and recognizing QR codes based on a custom graphic structure.
[0011] In a first aspect, the present invention provides a method for generating and recognizing QR codes based on a custom graphic structure, comprising: Obtain a custom graphic structure, which includes the outline or filled area of a hand-drawn pattern, text, or a third-party pattern; Feature extraction is performed on the custom graphical structure to generate a high-dimensional feature vector; The original data to be stored is encrypted to obtain encrypted data, wherein the encryption process includes: Based on the high-dimensional feature vector, an encryption key stream for encrypting the original data is generated using a preset encryption key generation algorithm; The original data is processed by the encryption key stream to obtain the encrypted data; as well as The encrypted data is mapped to predetermined data points on the custom graphic structure to generate the QR code.
[0012] Optionally, obtaining the custom graphics structure includes: Obtain the user's hand-drawn lines through the canvas interface; or Load a third-party image, and perform binarization thresholding and negative processing on the third-party image to extract its outline as the custom graphic structure.
[0013] Optionally, mapping the encrypted data to predetermined data points on the custom graphical structure includes: The binary 0 value of the encrypted data is mapped to the first visual attribute of the point; and The binary 1 value of the encrypted data is mapped to the second visual attribute of the point, and the first visual attribute and the second visual attribute are distinguishable in terms of color or brightness.
[0014] Optionally, the step of extracting features from the custom graphical structure to generate a high-dimensional feature vector includes: Convert the custom graphical structure into a graphical representation; and The high-dimensional feature vector is generated by aggregating node information in the graph representation using a graph convolutional neural network.
[0015] Optionally, the encryption key generation algorithm includes feeding the high-dimensional feature vector as input into a preset neural network model to generate the encryption key stream.
[0016] Secondly, the present invention provides a QR code recognition method based on a custom graphic structure, comprising: Scan a QR code containing a custom graphic structure to obtain the custom graphic structure and encrypted data mapped on the custom graphic structure; The acquired custom graphic structure is subjected to feature extraction to generate a high-dimensional feature vector; Based on the high-dimensional feature vector, the encryption key stream is regenerated using an algorithm consistent with the encryption key generation algorithm used when the QR code was generated. The acquired encrypted data is inversely processed by the regenerated encryption key stream to decrypt the encrypted data and obtain the original data.
[0017] Optionally, the encryption key generation algorithm further includes: Before feeding the high-dimensional feature vector into the preset neural network model, Obtain a preset transformation matrix; and Perform matrix operations between the high-dimensional feature vector and the transformation matrix to obtain a transformed vector; The preset neural network model takes the transformed vector as input to generate the encryption key stream.
[0018] Optionally, the encryption key generation algorithm includes: Calculate the hash value for the high-dimensional feature vector; Using the hash value as the initial seed, a preset chaotic system is initialized; and The chaotic system is run iteratively, and its output is sampled to generate the encryption key stream.
[0019] Optionally, the encryption key generation algorithm includes: The high-dimensional feature vector is used as fuzzy data input, and a fuzzy extractor algorithm is applied to generate a stable encryption key and auxiliary data. The encryption key stream is generated based on the stable encryption key.
[0020] Thirdly, the present invention provides a QR code generation and recognition system based on a custom graphic structure, comprising: The graph structure acquisition module is used to acquire custom graph structures; The feature extraction module is used to extract features from the custom graphic structure and generate a high-dimensional feature vector. An encryption processing module is used to encrypt the original data to be stored, obtaining encrypted data. The encryption processing module is configured as follows: Based on the high-dimensional feature vector, an encryption key stream for encrypting the original data is generated using a preset encryption key generation algorithm; The original data is processed by the encryption key stream to obtain the encrypted data; The data mapping module is used to map the encrypted data to predetermined data points on the custom graphic structure to generate a QR code; An identification and decryption module is used to perform the identification method according to any one of the second aspects of the claim.
[0021] The present invention has achieved the following beneficial effects: One of the beneficial effects of this invention is that it binds the visual identity and data security of a QR code at the cryptographic level. In this invention, the encryption key stream used to encrypt the data carried by the QR code is dynamically generated based on the unique high-dimensional features (such as its topological structure, key point distribution, and line trends) inherent in the visual carrier of the QR code, namely the custom graphic structure (e.g., a company logo or personal signature). This custom graphic structure possesses uniqueness similar to physically unclonable (PUF) or biometric features.
[0022] The mechanism establishes a secure logical chain: (1) The encrypted key stream is generated from the feature vector of a custom graphic. (2) An attacker (e.g., a quising attacker) cannot obtain or perfectly replicate the original digital graphic used to generate the key. (3) When an attacker replaces a legitimate QR code with a forged QR code (containing malicious data and an incorrect graphic), or even if the user scans a low-quality photo of a legitimate QR code (resulting in a noisy graphic), the recognition system will extract features from this incorrect or noisy graphic during decryption. (4) Incorrect graphic features will result in the generation of a completely incorrect feature vector. (5) Incorrect feature vectors will result in the generation of a completely incorrect encrypted key stream. (6) An incorrect encrypted key stream will cause decryption operations (e.g., XOR) to fail, making it impossible to recover meaningful data.
[0023] Therefore, this invention implements a security model where what you see is the key. When faced with a QR code phishing attack that attempts to replace the QR code of this invention with a malicious QR code, this mechanism helps to invalidate the attacker's decryption attempt. This is because when the scanner is decrypting, it extracts features from the replaced malicious graphic and generates a completely incorrect key stream, causing decryption to fail. The system can then issue a security alert to the user, thereby helping to protect the user's data security.
[0024] Background QR code beautification solutions typically use aesthetically pleasing graphics as a skin or decoration, separating security from aesthetics. This invention uses the aesthetically pleasing, customized graphic itself as part of the security mechanism. This allows businesses or individuals to use their brand logos, hand-drawn designs, signatures, etc., as the core carrier of the QR code. This not only helps achieve good brand recognition and visual appeal but also leverages the inherent uniqueness of the graphic to provide data protection, combining security functions with personalized design.
[0025] This invention recognizes that during real physical scanning, due to factors such as illumination, angle, and printing distortion, the feature vectors extracted from the acquired image (w') may contain noise or bias compared to the original image (w). This bias poses a serious challenge to cryptographic systems that rely on exact matching (such as schemes based on hash and chaotic systems).
[0026] To address this practicality issue, this invention preferably introduces a fuzzy extractor algorithm as a method for key generation. A fuzzy extractor is a cryptographic tool used to process such ambiguous or noisy data (e.g., biometric data).
[0027] Its working principle is as follows: When generating a QR code, it extracts a stable encryption key (R) from the original, clean feature vector (w) and simultaneously generates a set of publicly available auxiliary data (P). During recognition, it can use this publicly available auxiliary data (P) to accurately and reliably reconstruct the original, stable encryption key (R) from the scanned, noisy feature vector (w'). This mechanism helps ensure that the recognition method of this invention has good usability and recognition success rate in the real physical world, helps overcome the limitations of idealized security models, and balances security and practicality.
[0028] This invention does not rely on the rigid black-and-white grid matrix of standard QR codes, but instead flexibly maps encrypted data to predetermined data points on a custom graphic structure. These points can carry binary information through color, brightness, or other visual attributes. This allows data to be distributed and hidden very naturally along the contours of the graphic (e.g., an artistic curve), further enhancing the concealment and artistry of the QR code's information data while maintaining machine readability.
[0029] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0030] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0031] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a QR code generation method based on a custom graphic structure in an embodiment of the present invention; Figure 2 This is a flowchart of a QR code recognition method based on a custom graphic structure in an embodiment of the present invention; Figure 3 This is a schematic diagram of a QR code generation and recognition system based on a custom graphic structure in an embodiment of the present invention; Figure 4 This is a schematic diagram of the user interface of the QR code generation system in an embodiment of the present invention; Figure 5 This is a schematic diagram of the interface for generating the final QR code in an embodiment of the present invention; Figure 6 This is a schematic diagram of the scanning interface of the QR code recognition method in an embodiment of the present invention; Figure 7 This is a schematic diagram showing the result after successful identification and decryption in an embodiment of the present invention; Figure 8 This is a schematic diagram of hand-drawn codes in an embodiment of the present invention. Detailed Implementation
[0032] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0034] In the description of this invention, it should be understood that the structures indicated by the terms system, module, unit, etc., can be hardware entities (such as central processing unit (CPU), graphics processing unit (GPU), application-specific integrated circuit (ASIC) or memory), software functional units (such as program code or functional components stored in memory and executed by the processor), or a combination of hardware and software.
[0035] Example 1: This example refers to the appendix. Figure 1 and attached Figure 2 This invention provides a complete method for generating and recognizing QR codes based on a custom graphic structure. This method is the main process of the invention and includes a complete closed loop of generation and recognition, which supports the core technical solution of the invention.
[0036] See attached document Figure 1 The process of generating a QR code includes the following steps: First, a step is performed to obtain a custom graphic structure. This custom graphic structure is the foundation and visual carrier of the security mechanism of this invention. It is different from the traditional matrix grid. Instead, it can be any pattern drawn by the user through an input device (such as a touchpad, drawing board, or mouse), such as a hand-drawn signature, a specific symbol, or a pre-designed vector graphic or bitmap outline with a specific meaning, such as a corporate logo, the outline of a piece of artistic text, or a filled area.
[0037] Next, feature extraction is performed on the acquired custom graphic structure to generate a high-dimensional feature vector. This step is the core of achieving "what you see is the key." This high-dimensional feature vector is a unique and stable representation of the graphic structure in mathematical space. It captures deep information about the graphic, such as its topological structure, the relative positions of key points (e.g., inflection points, endpoints), the curvature changes of lines, and the shape of closed regions. The dimension of this feature vector is designed to be sufficiently high (e.g., 512 dimensions, 1024 dimensions, or higher) to ensure that the feature vectors corresponding to different graphics (even those that look visually similar) have significant discriminative power in the vector space, thereby guaranteeing the uniqueness and collision resistance of the feature vector.
[0038] Subsequently, the original data to be stored is encrypted to obtain encrypted data. The original data can be any digital information that needs to be securely stored and transmitted, such as a URL, a piece of text, an electronic business card (vCard), payment instructions, or identity authentication information. This encryption process is closely related to the feature extraction process described above, and its security depends on the results of the feature extraction.
[0039] Specifically, the encryption process includes: First, based on the high-dimensional feature vector generated in the previous step, a preset encryption key generation algorithm is used to generate an encryption key stream for encrypting the original data. The input to this algorithm is the high-dimensional feature vector, and the output is a long binary sequence with good pseudo-randomness (i.e., the encryption key stream). The length of this key stream typically needs to match or exceed the length of the original data.
[0040] Then, the original data (also pre-converted to binary form) is processed with the encryption keystream to obtain the encrypted data. In a preferred implementation, this operation can be a bitwise XOR operation. The bitwise XOR operation is self-reversible, meaning that the original data can be recovered by performing the XOR operation again on the encrypted data using the same keystream.
[0041] Finally, the encrypted data obtained in the previous step is mapped to predetermined data points on the custom graphic structure to generate the final visual QR code. These predetermined data points can be defined as a series of discrete coordinate points on the graphic structure (e.g., the outline of the graphic). The system sequentially attaches the binary sequence of the encrypted data (e.g., 01101…) to these points and represents 0 and 1 using specific visual attributes (e.g., color or brightness).
[0042] See attached document Figure 2 The corresponding QR code recognition process includes the following steps: When a user (the recognition device) needs to recognize the QR code, it first scans the QR code with a scanning device (such as a smartphone camera, tablet, or a dedicated industrial barcode scanner) to obtain an image containing a custom graphic structure and encrypted data mapped on it.
[0043] After receiving an image, the system (such as a recognition application running on a smartphone) first separates two pieces of information: first, it extracts the complete shape of the custom graphic through image segmentation and recognition algorithms; second, it reads and locates the various visual attributes mapped on the graphic points and restores them into encrypted data (i.e., the original encrypted binary sequence) according to preset rules.
[0044] Next, the system performs the same feature extraction process on the acquired custom graph structure as it did during generation, in order to generate a high-dimensional feature vector.
[0045] Subsequently, based on this newly generated high-dimensional feature vector, the system regenerates the encryption key stream using an algorithm that is completely identical to the encryption key generation algorithm used when generating the QR code.
[0046] This is where the core security mechanism of the invention is demonstrated. If the user scans a tampered or forged image (such as a malicious sticker commonly used in quising attacks), then in this step, the system extracts features from this forged image. Since the forged image is necessarily different from the original image in terms of deep features, the generated feature vector will be incorrect, which in turn leads to the subsequent generation of a completely incorrect keystream.
[0047] Finally, the system performs an inverse operation (e.g., performs a bitwise XOR operation again) on the acquired encrypted data (read from the bit points) and the regenerated encryption keystream to attempt to decrypt the encrypted data and obtain the original data. If the keystream is correct (i.e., the image has not been tampered with and the scanning noise is within tolerance), decryption will succeed, and the system will obtain and present the original data (e.g., opening a legitimate website address). If the keystream is incorrect (due to image tampering or forgery), decryption will fail, resulting in a string of meaningless gibberish. At this point, the system can issue a security warning to the user, such as indicating that the QR code is invalid or has been tampered with, and advising against access, thereby effectively preventing phishing attacks.
[0048] Example 2: This example details two specific implementation methods for the step of obtaining the custom graphic structure in Example 1.
[0049] The first method is to obtain the user's hand-drawn lines through the drawing board interface.
[0050] In this approach, the QR code generation system (such as a mobile or web application) provides the user with an interactive drawing board user interface (UI). The user (e.g., a signer requiring authentication) can freely draw lines on this board using their finger, a stylus, or a mouse. For example, the user can draw their personal signature, a specific symbol, or a simple pattern.
[0051] During the user's drawing process, the system captures the drawing trajectory in real time and records a series of timestamped coordinate points (e.g., {(x1,y1,t1),(x2,y2,t2),...}). If the input device supports it, the system can also record information such as pressure or pen tilt. After the user finishes drawing, the system connects these discrete coordinate point sequences to form vector lines and uses them as a custom graphic structure.
[0052] Images obtained in this way possess extremely high personal uniqueness and security. Because each person's handwriting, pen speed, and pen-writing habits are unique, this information (especially speed and pressure) constitutes biometric features that are difficult to replicate. In subsequent feature extraction, this dynamic information can be encoded as part of a feature vector, making it impossible even for highly skilled imitators (whose drawings may appear visually similar but differ in dynamic features) to generate the correct feature vector, thus providing extremely high anti-counterfeiting capabilities.
[0053] The second method is to load a third-party image and perform binarization thresholding and negative processing on the third-party image.
[0054] In this method, a user (such as a company that wants to create a custom QR code) can load a third-party bitmap image (e.g., JPEG or PNG format) from local storage (such as a phone's photo album or a computer's hard drive). This image can be an existing, beautifully designed brand logo or a photograph containing a specific pattern.
[0055] Since the original bitmap image may be colored and contain complex gradients, shadows, or backgrounds, the system needs to perform a series of image preprocessing operations to extract a clear and well-defined graphic structure for subsequent feature extraction. This processing may include: Grayscale conversion: First, the system converts the loaded color image into a grayscale image.
[0056] Binarization thresholding: The system sets a global or local brightness threshold (e.g., a threshold of 128 within a brightness range of 0-255). Then, the system iterates through all pixels in the grayscale image, comparing their brightness to this threshold. Pixels with brightness higher than the threshold are set to pure white (e.g., brightness value 255), while pixels with brightness lower than or equal to the threshold are set to pure black (e.g., brightness value 0). This results in a binary image containing only black and white, clearly separating the foreground (e.g., a logo) from the background.
[0057] Negative processing: After standard binarization, foreground objects (such as logos) are typically black, while the background is white. In some applications, to facilitate subsequent feature point sampling or contour tracking using the foreground as a graphic structure, the system can further perform negative processing. This processing converts all black pixels (value 0) to white (value 255) and all white pixels (value 255) to black (value 0).
[0058] Contour extraction: To further simplify the graphic structure, the system can also perform edge detection algorithms (such as the Canny operator) or mathematical morphology operations (such as a combination of erosion and dilation) on the binary image to extract the single-pixel width contour of the target object.
[0059] Finally, the clear outlines or filled regions extracted through the above processing are used as custom graphic structures input for subsequent feature extraction steps.
[0060] Figure 4 This is a schematic diagram of the user interface of the QR code generation system in an embodiment of the present invention. As shown in the figure, the interface includes a graphic display area and an information input area. In the graphic display area, the system acquires and displays a user-defined graphic structure (e.g., the hand-drawn Chinese calligraphy in the figure), which serves as the source data for subsequent feature extraction. In the information input area, the user inputs the original text data to be stored (e.g., "Hand-drawn QR codes are proprietary technology products of the QR code company").
[0061] Example 3: This example details the steps in Example 1 of mapping encrypted data to predetermined data points on the custom graphic structure. This step is the process of visualizing abstract binary encrypted data (e.g., 010110…) and attaching it to the graphic, which determines the final visual appearance of the QR code of this invention.
[0062] First, the system needs to determine the predetermined data points on the custom graphical structure. These points are the smallest units carrying binary information. The definition of these points is flexible and can be designed according to the shape of the graph and the data capacity requirements. For example: If the custom graphic is one or more contour lines (as described in Example 2), the system can take a coordinate point along the contour line, starting from a predefined starting point, and take a coordinate point as a data point according to a fixed arc length (e.g., every 5 pixels).
[0063] If the custom graphic is a filled area (such as a solid logo), the system can arrange data points within that area according to a specific grid (such as a spiral or zigzag pattern).
[0064] The total number of these data points determines the maximum capacity of encrypted data that the QR code can carry.
[0065] Next, the system defines two visually distinguishable attributes: a first visual attribute and a second visual attribute. These two attributes are used to represent binary 0 and 1, respectively.
[0066] The system assigns the binary 0 value of the encrypted data to the first visual attribute and the binary 1 value to the second visual attribute.
[0067] In one specific implementation, this mapping is color-based. For example, the system can define the first visual attribute as blue and the second visual attribute as red. When the encrypted data sequence to be mapped is 010, the system renders the first predetermined data point as blue, the second predetermined data point as red, and the third predetermined data point as blue. During scanning, the recognition system can accurately reconstruct the 010 sequence simply by recognizing the colors.
[0068] In another specific implementation, this mapping is based on brightness. This approach is particularly suitable for monochrome display devices (such as e-ink screens) or monochrome printing scenarios (such as thermal printers). For example, the system can define a first visual attribute as dark (e.g., a brightness value of 30% in a grayscale level) and a second visual attribute as bright (e.g., a brightness value of 90%). When mapping 010, the system sets the first bit to dark, the second bit to bright, and the third bit to dark.
[0069] These two attributes (the first and second visual attributes) must be sufficiently distinguishable, meaning they must differ significantly in color space (e.g., RGB values) or luminance values, to ensure that scanning devices (such as cameras) can accurately read the binary values they represent under different ambient lighting conditions or with slight color deviations. This mapping process cleverly integrates encrypted data into custom graphics, making it part of the graphic texture or color, thus achieving a unity between data transmission and artistic design.
[0070] Figure 5 This is a schematic diagram of the interface for generating the final QR code in an embodiment of the present invention. Figure 4In contrast, this image shows the result after data mapping. The system converts the encrypted binary data into visual attributes (such as the colored noise shown in the image) and maps them to the stroke paths or filled areas of a custom graphic structure (the hand-drawn characters). Simultaneously, auxiliary positioning patterns (a square frame) are generated around the graphic, forming the final visualized QR code. This can be compared to... Figure 4 and Figure 5 This allows for a direct visual understanding of the relationship between the original graphic structure and the QR code that carries the data.
[0071] Example 4: This example details a preferred implementation of the step in Example 1 involving feature extraction from the custom graph structure to generate high-dimensional feature vectors, namely, a method based on Graph Convolutional Network (GCN). Traditional Convolutional Neural Networks (CNNs) excel at processing Euclidean space data (such as pixel grids), but the custom graph structures in this invention (especially hand-drawn lines or irregular contours) are essentially non-Euclidean topological data. GCN is a deep learning model specifically designed for processing such graph structure data; it can capture the topological relationships of the graph, making it highly suitable for feature extraction in this invention.
[0072] The process specifically includes: Step 1: Convert the custom graphic structure into a graphic representation.
[0073] In order for GCN to process, the pixelated graph structure (such as a curve outline) first needs to be converted into a graph data structure. This graph structure consists of nodes and edges.
[0074] The conversion process is as follows: The system first extracts the skeleton of the custom graph structure. Based on this graph skeleton, the system samples keypoints at fixed intervals (e.g., every 5 pixels) and defines these keypoints as nodes of the graph. If two nodes are adjacent on the graph skeleton (e.g., directly connected on the skeleton), an edge is defined between them.
[0075] Define node features: The system assigns an initial node feature vector to each node. This initial feature can be very simple; for example, the most basic is the node's coordinates (x, y) on a two-dimensional plane. In more complex implementations, it can also include pixel statistical features in a small neighborhood around the point, the curvature of the point, and other information.
[0076] After this step, the custom graph is transformed into a graphical representation containing a set of nodes, a set of edges (defining the connection relationships between nodes, i.e., the adjacency matrix), and a set of initial node features (i.e., the feature matrix).
[0077] Step 2: Aggregate the node information in the graph representation using a graph convolutional neural network.
[0078] The graph represents the input to a pre-trained Graph Convolutional Neural Network (GCN) model.
[0079] The core idea of GCN is to aggregate information from neighboring nodes layer by layer. GCN models typically contain multiple graph convolutional layers.
[0080] In the first layer of graph convolution: For each node in the graph (e.g., node A), it observes all its directly connected neighbor nodes (e.g., nodes B, C, D). GCN collects the initial features of these neighbor nodes (B, C, D) (e.g., their (x, y) coordinates) and performs aggregation on these features, for example, by averaging or weighted summation. Then, GCN combines this aggregated neighbor information with node A's own initial features (e.g., through a neural network nonlinear transformation using ReLU as the activation function). This process generates a new, more informative feature representation (A') for node A, which includes not only A's initial information but also information from its first-order neighbors.
[0081] In the second layer of graph convolution: GCN repeats this process, but this time, node A aggregates the new features (B', C', D') output from its neighbors (B, C, D) in the first layer. Since B' already contains information about B's neighbors (e.g., E, F), when A aggregates the information of B', A's new feature (A'') indirectly contains information about its neighbors' neighbors (second-order neighbors).
[0082] In this way, as the GCN layers deepen, each node can capture increasingly larger ranges of neighborhood information and global topology information about the entire graph structure, rather than just local pixel information.
[0083] Step 3: Generate high-dimensional feature vectors.
[0084] After multiple layers (e.g., 3 layers) of graph convolution, each node in the graph has a feature vector containing rich global topological information and local neighborhood structure.
[0085] Finally, to obtain a single feature vector that can represent the entire graph (i.e., the entire custom graph), the system employs a readout operation. A common readout operation is Global Average Pooling. This operation aggregates the feature vectors output by all nodes in the last GCN layer (e.g., summing the feature vectors of all nodes by dimension and then averaging them).
[0086] Ultimately, the output of this aggregation operation is a high-dimensional feature vector with a fixed dimension (e.g., 1024 dimensions). This vector numerically condenses the unique topological structure of the entire custom graph, possessing high uniqueness and stability, and can be used for subsequent encryption key generation.
[0087] Example 5: This example provides a specific implementation of the encryption key generation algorithm in Example 1, namely, using a preset neural network model. This neural network (NN) acts as a deterministic function, mapping high-dimensional feature vectors to a pseudo-random key stream.
[0088] In this implementation, the system pre-trains and stores a neural network model. This model can be a relatively simple multi-layer perceptron (MLP) or a recurrent neural network (RNN). The structure of this neural network model typically includes an input layer, one or more hidden layers, and an output layer.
[0089] Input: The high-dimensional feature vector (e.g., 1024-dimensional) generated in Example 4 will be used as the input to the neural network model and fed into its input layer. The number of neurons in the input layer matches the dimension of the feature vector (e.g., 1024).
[0090] Transformation process: The input vector is then propagated through the hidden layers of the network. Each hidden layer contains a large number of neurons and linearly transforms the output of the previous layer through a series of weight matrices and bias vectors, before being processed by a non-linear activation function (such as ReLU, Sigmoid, or tanh). This process can be understood as performing deep processing, non-linear combination, and remapping of the input features to extract deeper patterns from the features.
[0091] Output: Finally, the data is propagated to the output layer. The number of neurons in the output layer is designed to be equal to the length of the required encryption key stream (e.g., if a 2048-bit key stream is required, the output layer contains 2048 neurons). The neurons in the output layer typically also use an activation function (e.g., the sigmoid function) such that the output value of each neuron is between 0 and 1.
[0092] Keystream generation: The system collects 2048 output values between 0 and 1. Then, a threshold is set (e.g., 0.5), converting all output values above the threshold to binary 1, and all output values below or equal to the threshold to binary 0.
[0093] Ultimately, this long binary sequence (e.g., 2048 bits) generated by the output layer is used as the encryption key stream for encrypting the original data.
[0094] During recognition (as described in Example 6), the recognition module must use a neural network model with the exact same structure and the exact same weight parameters (i.e., a pre-trained model file). Thus, when it is input with the same (or very similar) feature vector, due to the deterministic nature of neural network computation, it can reconstruct a completely consistent encryption key stream, thereby achieving correct decryption.
[0095] Example 6: This example refers to the appendix. Figure 2 This paper describes in detail a QR code recognition method based on a custom graphic structure. This method is the reverse process of the generation method in Embodiment 1, forming a complete recognition and decryption process.
[0096] The first step is to scan a QR code containing a custom graphic structure. The user uses a device equipped with a camera (such as a smartphone or a dedicated scanner) to point at the QR code generated by this embodiment of the invention. The device's camera captures an image of the QR code. Figure 6 This is a schematic diagram of the scanning interface of the QR code recognition method in an embodiment of the present invention. The user uses the camera of a mobile terminal to point at the generated QR code (as shown in the viewfinder in the figure). The scanning device acquires an image in the physical environment, and the system needs to separate the custom graphic structure (hand-drawn lettering) and the color dot information attached to it from the acquired image. Due to the influence of shooting angle and lighting, the acquired graphic may have distortion or noise. Subsequent steps of the present invention (such as the blur extractor described in Embodiment Nine) will be used to process these interferences to ensure the accuracy of key regeneration.
[0097] The second step is data separation and extraction.
[0098] The image processing module first preprocesses the captured image, which may include autofocus, brightness adjustment, perspective correction (to correct distortion caused by tilted shooting), and image noise reduction.
[0099] Then, the system identifies and extracts two key pieces of information from the preprocessed image: Obtaining Custom Graphic Structures: The system uses image segmentation algorithms (such as color-, edge-, or deep learning-based segmentation models) to separate custom graphic structures (such as the outline of a hand-drawn signature or logo) from the image, resulting in a digital copy containing only that graphic.
[0100] Obtaining encrypted data mapped onto the custom graphic structure: The system locates all predetermined data points mapped onto the graphic structure according to preset point definitions (as described in Embodiment 3). Subsequently, the system reads the visual attributes of each point (e.g., determining whether the point is blue or red, bright or dark), and converts it back into a binary sequence of encrypted data according to preset corresponding rules (e.g., blue=0, red=1).
[0101] The third step involves feature extraction from the acquired custom graphic structure to generate a high-dimensional feature vector. The system inputs the custom graphic structure (which may contain scanning noise) acquired in the previous step into the same feature extraction module used during generation (Example 4). This module (e.g., the GCN model) processes the scanned graphic and also generates a high-dimensional feature vector (denoted as w').
[0102] The fourth step is to reconstruct the encrypted key stream.
[0103] Based on this newly generated high-dimensional feature vector (w'), the system regenerates the encryption key stream using an algorithm identical to the encryption key generation algorithm used during QR code generation. For example, if the NN model from Example 5 was used during generation, then an NN model with the same weights must be used here.
[0104] Step 5: Data decryption.
[0105] The system performs an inverse operation on the encrypted data obtained in the second step and the regenerated encryption key stream in the fourth step. If a bitwise XOR operation was used during generation, then this inverse operation is simply another bitwise XOR operation.
[0106] If the scanned QR code is valid, and the difference between the feature vector w' and the original vector w is within the algorithm's tolerance range (especially when combined with Example 9), the reconstructed keystream will be correct. After performing the inverse operation between the correct keystream and the encrypted data, decryption will be successful, yielding the original data. The system can then execute the original data (e.g., display text, open a website address).
[0107] Figure 7 This is a schematic diagram showing the result after successful identification and decryption in an embodiment of the present invention. The system successfully decrypted the encrypted data using a key stream regenerated from the scanned image, restoring and displaying the original text information ("Hand-drawn code is a proprietary technology product of the image company"), verifying the effectiveness of the "what you see is the key" mechanism. (Refer to...) Figure 8 This is a schematic diagram of the hand-drawn code of the present invention.
[0108] Example 7: This example is a security enhancement improvement to Example 5 (NN-based key generation). In Example 5, the key stream is determined only by the feature vectors and the NN model (and its weights). If the NN model (and its weights) is unfortunately leaked by an attacker through reverse engineering or other means, the attacker, once obtaining a legitimate feature vector (in some way), may still be able to generate the correct key stream.
[0109] To increase the difficulty of this attack, this embodiment introduces an additional security factor into the key generation algorithm: a preset transformation matrix. This transformation matrix itself is stored as a secret.
[0110] During the QR code generation stage: Before feeding the high-dimensional feature vector (e.g., 1024-dimensional, denoted as w) generated in Example 4 into the neural network model of Example 5, the system first performs an additional step: Obtain a pre-defined transformation matrix (e.g., a 1024x1024 dimensional matrix, denoted as M). This matrix M can be securely stored locally on the generation device or retrieved from a trusted key management center when needed. The content of M is pre-defined and remains fixed for QR codes within the same security domain.
[0111] The system performs a matrix operation, performing a matrix operation (e.g., matrix multiplication) on the high-dimensional eigenvector w and the transformation matrix M to obtain a transformed vector w_transformed (w_transformed=w*M).
[0112] Then, the preset neural network model (as described in Example 5) takes this transformed vector w_transformed (instead of the original feature vector w) as its input to generate the final encryption key stream.
[0113] During the QR code recognition stage: During identification (Example 6), the identification module must also perform the exact same operation when performing the fourth step of key reconstruction.
[0114] It first extracts a high-dimensional feature vector (denoted as w') from the scanned image.
[0115] Then, it must access the same preset transformation matrix M that was generated (which must also be securely stored on the identification device or obtained from a trusted center).
[0116] It uses the matrix M to perform the same matrix operation on the extracted feature vector w' (w'_transformed=w'*M) to obtain the transformed vector w'_transformed.
[0117] Finally, the transformed vector w'_transformed is fed into the NN model to reconstruct a consistent key stream.
[0118] In this way, the system's security is enhanced by an additional layer. Even if an attacker knows the NN model and successfully extracts the feature vector w', if they do not know the secret transformation matrix M, they still cannot generate the correct transformed vector w'_transformed, and therefore cannot generate the correct key stream, and decryption will still fail.
[0119] Example 8: This example provides a second alternative implementation of the encryption key generation algorithm in Example 1, namely, using a preset chaotic system.
[0120] Chaotic systems (such as one-dimensional logistic maps, tent maps, or high-dimensional Hénon maps) are nonlinear dynamical systems. When their control parameters are within a certain range, the system exhibits a chaotic state, and its output sequence is ergodic, pseudo-random, and extremely sensitive to initial conditions. This extreme sensitivity to initial conditions (i.e., the butterfly effect) is well-suited for cryptographic applications, particularly for generating pseudo-random keystreams closely related to the input (seed).
[0121] The specific steps for this implementation are as follows: Step 1: Calculate the hash value of the high-dimensional feature vector.
[0122] The system first obtains the high-dimensional feature vector (denoted as w) generated in Example 4. This vector is typically high-dimensional (e.g., 1024-dimensional) and contains floating-point numbers. To convert it into a uniformly formatted and fixed-length input suitable as a seed for a chaotic system, the system computes a cryptographic hash value for the feature vector w (first serialized into a byte stream), for example using the SHA-256 algorithm.
[0123] This will produce a fixed-length (e.g., 256-bit) digest (hash value). Due to the avalanche effect of hash algorithms, any tiny change in the feature vector w will cause a drastic change in the generated hash value.
[0124] Step 2: Use the hash value as the initial seed to initialize a preset chaotic system.
[0125] The system uses the 256-bit hash value (or a portion thereof) obtained in the previous step as the initial seed to initialize a pre-defined chaotic system.
[0126] For example, if the pre-defined chaotic system is a Logistic map, the system requires an initial state value (x0) and a control parameter (μ). The system can normalize the first 64 bits of the hash value to the (0, 1) interval through a specific transformation (e.g., dividing by 2 to the power of 64) as the initial state value x0; and use the last 64 bits of the hash value to set the control parameter μ through a specific transformation (ensuring that the value of μ falls within the chaotic region, e.g., [3.57, 4.0]).
[0127] Step 3: Iteratively run the chaotic system and sample its output to generate the encryption key stream.
[0128] After the system initializes the chaotic system using the seed (x0 and μ), it begins to iteratively run the system (for example, performing the iterative calculation x(n+1) = μ*x(n)*(1-x(n))), where μ is the control parameter in the second step, x(n) is the state value of the system in the nth iteration (i.e., the initial state x(0) is x0, which is also set according to the hash value in the second step), and x(n+1) is the state value of the system in the next iteration.
[0129] To eliminate the transient effects of the initial iteration (i.e., the stage before the system enters the chaotic attractor), the system can discard the output values of the first N iterations (e.g., the first 1000 iterations).
[0130] Starting from the (N+1)th iteration, the system samples the output value (a floating-point number) of each iteration. For example, the system can extract the last digit after the decimal point, or the last 8 digits, of the binary representation of each floating-point number x(n) and concatenate them.
[0131] The system continues to iterate and sample until the generated binary sequence reaches the required length of the encryption key stream (e.g., 2048 bits). This sequence is then used as the encryption key stream.
[0132] During the identification phase: During identification (Example 6), the identification module must precisely repeat this process: extract the feature vector w' → calculate its hash value → use the hash value as a seed to initialize the exact same chaotic system (the same mapping equation and parameter setting rules) → discard the iteration with the exact same N value → sample in the exact same way → generate the same key stream.
[0133] This embodiment offers extremely high security but is also highly sensitive to noise. Due to the avalanche effect of hashing and the butterfly effect of chaos, any tiny difference (caused by noise) between the feature vector w' obtained during scanning and the original w will result in drastically different hash values, leading to completely different key streams and decryption failure. Therefore, this embodiment is suitable for scenarios with extremely low noise (e.g., QR codes are transmitted and recognized in a purely digital environment), or (more importantly) it must be used in conjunction with the fuzz extractor of Embodiment Nine, i.e., using the stable key R generated by the fuzz extractor as the input (instead of w) in the first step of this embodiment to calculate the hash value.
[0134] Example 9: This example provides a third alternative implementation of the encryption key generation algorithm, which is also a preferred implementation. This example aims to address the fragility of Examples 5 and 8 when faced with real physical scanning noise. This implementation employs the FuzzyExtractor algorithm.
[0135] A fuzz extractor is an advanced cryptographic tool designed to reliably extract a stable (i.e., noise-free, precisely reproducible), uniformly random (i.e., high-entropy) key from fuzzy, noisy, and non-uniformly distributed source data (such as biometric features like fingerprints, irises, or high-dimensional feature vectors in this invention).
[0136] The fuzzy extractor algorithm consists of two core procedures (stages): a generation procedure and a reproduction procedure.
[0137] During the QR code generation stage: The system first obtains the original, clean, high-dimensional feature vector (denoted as w) generated in Example 4. w is considered fuzzy data because it is not uniformly random and will produce a noisy version (w') during recognition.
[0138] The system takes w as fuzzy data input and calls the Gen program of the fuzz extractor.
[0139] The Gen program performs two operations and outputs two data points: a. It generates (or randomly selects) a stable cryptographic key (denoted as R). R is a highly entropy, nearly uniformly random string of bits, which is well-suited for use as a subsequent cryptographic key.
[0140] b. It calculates an auxiliary data (denoted as P) based on the input w and the generated R.
[0141] In this embodiment, the algorithm principle can be based on an error-correcting code (ECC) scheme. Specifically, the auxiliary data is generated as follows: the system randomly generates a stable encryption key (R), and uses the original feature vector (w) and the stable key (R) to perform operations (e.g., XOR operation) through an error-correcting code encoding function to calculate the auxiliary data (P). The key characteristic of P is that it is itself public information, not revealing enough information about w or R, but it contains enough error-correcting information to recover R from a noisy version (w') of w.
[0142] The system generates the final encrypted keystream based on the stable encryption key R. For example, the keystream can be R itself, or (to obtain a longer keystream) R can be used as a perfect and stable seed for the chaotic system in Embodiment 8 to generate the keystream.
[0143] The system uses this key stream to encrypt the original data, resulting in encrypted data.
[0144] Key step: The system treats this auxiliary data P as public information, and together with the encrypted data obtained in the previous step, maps it to predetermined data points on a custom graphical structure using the method described in Example 3. P is public and does not need to be encrypted; it will be read by the identification terminal along with the encrypted data.
[0145] During the QR code recognition stage: The system scans the QR code and, as described in Example 6, obtains three pieces of information: first, the scanned, noisy custom graphic; second, the encrypted data mapped onto the location; and third, the publicly available auxiliary data P, also mapped onto the location.
[0146] The system performs feature extraction on the scanned (noisy) custom graphic (Example 4) to obtain a high-dimensional feature vector (denoted as w') that is slightly different from the original w.
[0147] The system calls the regeneration (Rep) procedure of the fuzz extractor.
[0148] The system uses this new, noisy vector w' and the publicly available auxiliary data P read from the QR code as input to the regeneration (Rep) procedure.
[0149] The regeneration (Rep) procedure uses the error correction information stored in P to repair the noise in w'. Specifically, the stable encryption key (R) is reconstructed by the system combining the extracted noisy features (w') with the read auxiliary data (P) and applying an error correction code decoding function to recover (reconstruct) the original, stable encryption key (R).
[0150] The correctness of the fuzz extractor guarantees that as long as the difference between w' and the original w (e.g., measured by Hamming distance or other metrics) is within a preset fault tolerance threshold t (i.e., the noise is not so great as to be unrepairable), the regeneration process can accurately and 100% reconstruct the original, stable encryption key R.
[0151] Based on this successfully reconstructed R, the system generates an encrypted key stream that is exactly the same as when it was generated.
[0152] Finally, the system uses this reconstructed keystream to perform the inverse operation (decryption) on the read encrypted data, thus successfully restoring the original data.
[0153] This embodiment perfectly solves the problem of inconsistent feature vectors caused by physical scanning noise by introducing a fuzz extractor, so that the present invention still has a high recognition success rate and robustness in real-world applications (even in poor lighting or blurry printing conditions).
[0154] Example 10: This example provides a QR code generation and recognition system based on a custom graphic structure. (Refer to the attached document for details.) Figure 3 The system is a hardware or software carrier for implementing the method described in any of the above embodiments. The system can be a software application installed on a server, personal computer, smartphone, or tablet, or it can be a dedicated hardware device integrating a processing unit and a scanning unit.
[0155] The system includes the following functional modules: Graphical structure acquisition module 10: This module is used to perform the functions described in Embodiment 2. This module is configured to acquire custom graphic structures. For example, it could be a canvas interface program that calls the touchscreen driver and rendering engine to capture the user's hand-drawn lines; or it could be an image loader that calls the file system and image processing libraries (such as OpenCV) to load third-party images and perform binarization thresholding and negative processing on them to extract their contours or filled areas.
[0156] Feature extraction module 20: This module is used to perform the functions described in Embodiment 4. This module (e.g., a TensorFlow or PyTorch software library loaded with GCN model weights, or a dedicated AI coprocessor) is configured to: receive the output (graph data) of the graph structure acquisition module 10, convert it into a graph representation (nodes and edges), and run a graph convolutional neural network (GCN) model to aggregate node information and finally output a high-dimensional feature vector.
[0157] Encryption processing module 30: This module is configured to encrypt the raw data to be stored, resulting in encrypted data. Internally, this module is further configured as follows: Key generation: Based on the high-dimensional feature vector output by the feature extraction module 20, an encrypted key stream for encrypting the original data is generated through a preset encryption key generation algorithm. This algorithm can be any one of the following: Embodiment 5 (feeding into a preset neural network model), Embodiment 7 (performing matrix operations with the transformation matrix before feeding into the NN), Embodiment 8 (calculating hash values and initializing a chaotic system), or Embodiment 9 (applying a fuzzy extractor algorithm to generate stable encryption keys and auxiliary data).
[0158] Data processing: Perform operations (e.g., bitwise XOR) between the original data and the encryption key stream generated in the previous step to obtain encrypted data.
[0159] Data mapping module 40: This module is used to perform the functions described in Embodiment 3. The module is configured to: receive the output of the encryption processing module 30 (encrypted data, and auxiliary data P in the case of Embodiment 9), determine predetermined data points on a custom graphic structure, and finally convert these binary data into a first visual attribute (e.g., binary 0) and a second visual attribute (e.g., binary 1) of the points, and finally render or output them as a visual QR code on a display device.
[0160] Identification and decryption module 50: This module is used to perform the identification method as described in any of the preceding claims. This module (e.g., an application running on a scanning device) is configured to: Scan and Separate: By calling the camera module, scan the QR code to obtain a custom graphic structure and encrypted data mapped on it (as well as possible auxiliary data P).
[0161] Repeat the process: Invoke the key generation functions of the feature extraction module 20 and the encryption processing module 30 (consistent with the generation process). That is, extract the high-dimensional feature vector of the acquired (noisy) graph structure, and regenerate the encryption key stream based on the vector (and auxiliary data P).
[0162] Decryption: Perform the inverse operation between the acquired encrypted data and the regenerated encryption key stream to decrypt the encrypted data and obtain the original data.
[0163] Through the collaborative work of the aforementioned modules (10, 20, 30, 40, 50), the system fully realizes a closed loop from encryption generation based on graphic features to decryption and recognition based on graphic features.
[0164] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a two-dimensional code based on a self-defined graphic structure, characterized in that, The method comprises: obtaining a custom graphical structure, the custom graphical structure comprising a hand-drawn pattern, a text, or a contour or a filled area of a third-party pattern; performing feature extraction on the custom graphical structure to generate a high-dimensional feature vector; performing encryption processing on original data to be stored to obtain encrypted data, wherein the encryption processing comprises: generating, based on the high-dimensional feature vector, an encryption key stream for encrypting the original data by a preset encryption key generation algorithm; and performing operation on the original data and the encryption key stream to obtain the encrypted data; and mapping the encrypted data to predetermined data point positions on the custom graphical structure to generate the two-dimensional code. The obtaining of the custom graphical structure comprises:
2. The method of claim 1, wherein, obtaining lines drawn by a user through a drawing board interface; or loading a third-party picture and performing binary threshold processing and negative processing on the third-party picture to extract a contour thereof as the custom graphical structure. The mapping of the encrypted data to the predetermined data point positions on the custom graphical structure comprises:
3. The method according to claim 1 or 2, characterized in that, corresponding binary 0 values of the encrypted data to a first visual attribute of the point positions; and corresponding binary 1 values of the encrypted data to a second visual attribute of the point positions, the first visual attribute and the second visual attribute being distinguishable in color or brightness. The feature extraction on the custom graphical structure to generate the high-dimensional feature vector comprises:
4. The method of claim 1, wherein, converting the custom graphical structure into a graph representation; and aggregating node information in the graph representation by a graph convolutional neural network to generate the high-dimensional feature vector. The encryption key generation algorithm comprises feeding the high-dimensional feature vector as input into a preset neural network model to generate the encryption key stream.
5. The method of claim 1, wherein, The method comprises:
6. A two-dimensional code recognition method based on a self-defined graph structure, characterized in that, scanning a two-dimensional code containing a custom graphical structure to obtain the custom graphical structure and encrypted data mapped on the custom graphical structure; performing feature extraction on the obtained custom graphical structure to generate a high-dimensional feature vector; regenerating an encryption key stream based on the high-dimensional feature vector by an algorithm consistent with an encryption key generation algorithm used when the two-dimensional code is generated; performing inverse operation on the obtained encrypted data and the regenerated encryption key stream to decrypt the encrypted data to obtain original data. The encryption key generation algorithm further comprises:
7. The method according to claim 5 or 6, characterized in that, before feeding the high-dimensional feature vector into the preset neural network model, obtaining a preset transformation matrix; and performing matrix operation on the high-dimensional feature vector and the transformation matrix to obtain a transformed vector; wherein the preset neural network model takes the transformed vector as input to generate the encryption key stream. The encryption key generation algorithm comprises:
8. The method of claim 1 or 6, wherein, calculating a hash value of the high-dimensional feature vector; initializing a preset chaotic system using the hash value as an initial seed; and iteratively running the chaotic system and sampling its output to generate the encryption key stream. The encryption key generation algorithm comprises:
9. The method according to claim 1 or 6, characterized in that, applying a fuzzy extractor algorithm to the high-dimensional feature vector as fuzzy data input to generate a stable encryption key and an auxiliary data; and The encryption key stream is generated based on the stable encryption key.
10. A two-dimensional code generation and recognition system based on a custom graphical structure, characterized by, The method comprises the steps of: a graph structure acquisition module, configured to acquire a custom graph structure; a feature extraction module, configured to perform feature extraction on the custom graph structure to generate a high-dimensional feature vector; an encryption processing module, configured to perform encryption processing on original data to be stored to obtain encrypted data, and the encryption processing module is configured to: generate an encryption key stream for encrypting the original data based on the high-dimensional feature vector through a preset encryption key generation algorithm; perform operation on the original data and the encryption key stream to obtain the encrypted data; a data mapping module, configured to map the encrypted data to a predetermined data point on the custom graph structure to generate a two-dimensional code; an identification and decryption module, configured to perform the identification method of any one of claims 6 to 9.
Citation Information
Patent Citations
Image signal processor with two-dimensional code identification and two-dimensional code identification method
CN102831375B
Two-dimension code coding and decoding method and device based on local color verification
CN102916804A
Binary two-dimensional code image encryption and decryption method and device
CN106651734A
QR code embedded novel two-dimensional code encoding and anti-counterfeiting application method
CN111639734A
Information encryption and decryption method based on two-dimensional code
CN112134687A