A two-dimensional code generation and checking method based on hierarchical embedding of redundant error correction code bits

CN122819286APending Publication Date: 2026-09-25CHINA COMMERCE NETWORKS (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610961237.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

现有的查验机制多依赖于一票否决式的离散硬校验,在面临上述工业高噪声时误判率与漏判率居高不下,无法在复杂的物理环境下闭环、精准地逆向反演并锁定正确的嵌入模式

Benefits of technology

(1)本发明实现了公开信息与内控信息的分级隐蔽埋入,在不影响标准二维码正常扫码的前提下,提升了隐写数据的安全性与可靠性。通过固定嵌入规则与随机嵌入规则相结合的双规则架构,既解决了单一固定规则易被逆向破解、防伪安全性不足的问题,又避免了单一随机规则数据稳定性差、扫码识别率低的缺陷;结合码元改动率与视觉干扰值加权筛选最优嵌入模式,在安全性与识别可靠性之间取得最优平衡。同时将嵌入参数经扰码处理后分段存入补齐码字区域,无需占用数据码位,大幅提升了印刷形变、局部磨损工况下的数据保存稳定性,可直接适配多领域的产品防伪与溯源需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122819286A_ABST
    Figure CN122819286A_ABST
Patent Text Reader

Abstract

The application relates to a two-dimensional code generation and checking method based on hierarchical embedding of redundant error correction code bits, and belongs to the technical field of two-dimensional code coding and anti-fake technology. The method comprises the following steps: dividing multiple source information into public information and internal control embedded information, coding to generate a main code word sequence and an embedded sub-code word sequence; configuring a fixed rule and constructing a random embedding rule, combining to form multiple alternative embedding modes, calculating the code symbol change rate under the alternative embedding modes, generating a target embedding mode, and constructing an integrated code word; converting the integrated code word into a multi-format code picture file, and generating an anti-fake two-dimensional code through print after checking and calling a request through a hierarchical permission resource storage architecture; a terminal matching double-path checking channels, a general channel calling native error correction isolation embedded code symbol to analyze public information, and a special channel weighting and scoring the analysis results of each rule, reversely identifying the target embedding mode to restore internal control information. The method realizes low-interference embedding of hidden information and full-link interception prevention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of QR code encoding and anti-counterfeiting technology, specifically relating to a method for generating and verifying QR codes based on hierarchical embedding of redundant error correction code points. Background Technology

[0002] QR codes, as data carriers for supply chain management and product anti-counterfeiting traceability, are widely used in industrial production and commercial distribution. To achieve high-density data traceability, sensitive internal control data is typically embedded in the matrix structure of standard QR codes. However, existing anti-counterfeiting QR code generation and verification architectures have the following shortcomings in practical engineering implementation: First, modifications to encoding and decoding rules lead to a lack of standard compatibility, and the entire distribution chain of QR code assets is vulnerable to interception and leakage. Traditional QR code steganography typically requires structural modifications to standard encoding rules or large-scale pixel-level fine-tuning, which disrupts the original error correction balance, causing common standard scanning clients to frequently refuse to read, report errors, or decode garbled characters. More critically, in industrial high-resolution raw code image file generation and distribution networks, the system typically distributes the entire code image file containing steganographic information across the network to the inkjet printing equipment on various production lines. Due to the lack of logical and physical isolation of data assets, this transmission chain is extremely vulnerable to hacking or interception by personnel within the contract manufacturer, resulting in the complete cloning and low-cost replication of high-resolution raw inkjet files, rendering subsequent physical layer anti-counterfeiting defenses completely ineffective.

[0003] Secondly, the verification algorithm lacks the ability to combat high noise interference at the physical layer, making it unable to achieve high-confidence reverse closed-loop recognition. In commodity circulation and industrial inspection sites, anti-counterfeiting QR code images are often subject to nonlinear interference at the physical layer. Ink bleeding at the coding site, nonlinear printing deformation of the carrier surface, and environmental reflections and lens distortion generated during dedicated terminal inspection can all cause serious deviations in the physical characteristics of the embedded code elements. Existing verification mechanisms mostly rely on discrete hard verification with a veto power, resulting in high false positive and false negative rates when faced with the aforementioned high noise in industrial environments. They are unable to achieve closed-loop, accurate reverse inversion, and lock in the correct embedding pattern in complex physical environments.

[0004] In summary, how to achieve end-to-end anti-interception of QR code assets while ensuring seamless compatibility with standard QR code scanning, and how to achieve high-confidence reverse identification of steganographic information in high-noise industrial environments, are technical shortcomings that conventional QR code encoding and decoding systems have not yet overcome in terms of architecture. Summary of the Invention

[0005] To address the aforementioned problems in the existing technology, this invention provides a method for generating and verifying QR codes based on hierarchical embedding of redundant error correction code points. The objective of this invention can be achieved through the following technical solutions: S1: Obtain multi-source information to be encoded, divide it into public information and internal control embedded information according to the public security level, encode and perform error correction calculation on the public information based on the QR code standard encoding rules to generate the main codeword sequence; perform cyclic redundancy check encoding on the internal control embedded information to generate the embedded sub-codeword sequence; S2: Configure fixed embedding rules and construct random embedding rules to form multiple alternative embedding modes; map the embedded subcode sequence to the redundant error correction code points of the main code sequence, calculate the code element modification rate under different alternative embedding modes, generate a target embedding mode that meets the preset conditions, and write the identifier and data length of the target embedding mode into the code padding area to construct the integrated code. S3: Convert the integrated codeword into a multi-format code image file, build a hierarchical permission resource storage architecture and verify the retrieval request of the multi-format code image file, distribute the verified multi-format code image file to the inkjet printing device, drive the inkjet printing device to print the multi-format code image file on the carrier surface, and generate an anti-counterfeiting QR code. S4: The verification terminal acquires the anti-counterfeiting QR code image and matches the dual-path verification channel. Under the general scanning channel, it calls the native error correction logic to isolate the embedded code elements and parses and outputs public information. Under the dedicated verification channel, it traverses the fixed embedding rules and random embedding rules, performs weighted scoring calculation on the parsing results of different embedding rules, and reversely identifies the target embedding pattern to extract the embedded sub-code word sequence and restore the internal control embedded information.

[0006] Specifically, the encoding and error correction calculation process includes: The public information to be encoded is formatted and converted, and mapped into a sequence of original data codewords based on the standard QR code encoding rules. Error correction operations are performed on the original data codeword sequence according to preset error correction level parameters to generate a corresponding number of error correction codewords, forming an error correction codeword sequence. The original data codeword sequence and the error correction codeword sequence are combined and arranged according to standard arrangement rules to construct the complete main codeword sequence.

[0007] Specifically, the cyclic redundancy check (CRC) code includes: The internal control embedded information to be encoded is compressed and formatted to generate a fixed-length internal control data codeword sequence that meets the encoding requirements. The internal control data codeword sequence is then subjected to a check operation according to the cyclic redundancy check rule to generate a corresponding number of check codewords, forming a check codeword sequence. The internal control data codeword sequence and the check codeword sequence are then concatenated and combined according to a preset format to construct the complete embedded sub-codeword sequence.

[0008] Specifically, the configuration fixed embedding rules include: Based on the distribution characteristics of redundant error correction bits in the main codeword sequence and the type of internal control embedded information, multiple sets of candidate fixed embedding rules are divided, and each set of candidate fixed embedding rules corresponds to a fixed mapping relationship of a specific type of data. For each group of candidate fixed embedding rules, code distribution uniformity verification and printing anti-interference capability evaluation are performed to select fixed embedding rules that meet the preset dispersion conditions and preset anti-printing deformation requirements. The selected fixed embedding rules are categorized and numbered according to data type to form a hierarchical configuration of fixed embedding rules.

[0009] Specifically, the process of constructing the random embedding rules includes: Extract the feature segments of the main codeword sequence, perform hash operation to obtain a hash value of fixed length, and convert it into a reproducible random seed parameter; Using the random seed parameters as initial input, a pseudo-random sequence generation algorithm generates multiple sets of random mapping relationships for corresponding redundant error correction code bits; For each group of random mapping relationships, code distribution uniformity verification and printing anti-interference capability evaluation are performed respectively. Random embedding rules that meet the usability requirements are selected and numbered according to the generation order to form random embedding rules that match the fixed embedding rules.

[0010] Specifically, the calculation process of the symbol modification rate includes: The embedded subcodeword sequence is mapped to the redundant error-correcting code points of the main codeword sequence and converted into a candidate matrix; Each candidate matrix is ​​compared bit by bit with the original reference matrix without embedded information, and the ratio of the number of different color symbols to the total number of symbols is taken as the symbol modification rate. The number of different colored symbols in the position detection graphic region of the candidate matrix is ​​obtained as the visual interference value; the symbol modification rate and the visual interference value are weighted to calculate the comprehensive coefficient, and the candidate embedding modes with the comprehensive coefficient lower than the preset threshold are selected as the target embedding modes.

[0011] Specifically, the construction process of the integrated codeword includes: The identifier of the target embedding mode is concatenated with the data length in binary to generate a metadata stream. A state scrambling operation is performed on the metadata stream using a preset feature polynomial to output a scrambling feature bit stream. The overlap-filling byte after the data terminator is located in the main codeword sequence, and each overlap-filling byte is divided into a high-order bit segment and a low-order bit segment. The low-order bit segment of each overlap-filling byte is state-replaced using the scrambling feature bit stream, while keeping the high-order bit segment values ​​unchanged, to reconstruct the target padding byte. The main codeword sequence containing the target padding byte is combined with the redundant error-correcting code points to construct the integrated codeword.

[0012] Specifically, the process of building the hierarchical permission-based resource storage architecture includes: The pre-defined data storage center is logically isolated into a public data storage area and a controlled encrypted storage area; The multi-format code image file is split into public image data for regular display and printing configuration files for controlling printing; The publicly available image data is stored in the publicly available data storage area. The printed configuration file is encrypted and encapsulated using an encryption key that matches a preset permission label. The encrypted and encapsulated printed configuration file is then stored in the controlled encrypted storage area.

[0013] Specifically, the verification of the request to retrieve multi-format code image files includes: Receive the retrieval request for the multi-format code image file and extract the security access token carried in the retrieval request; The access level corresponding to the security access token is compared with the preset security threshold corresponding to the controlled encrypted storage area. When the access level is higher than or equal to the preset security threshold, the corresponding decryption key is called to decrypt and restore the printed configuration file. The decrypted and restored printed configuration file is then reconstructed with the corresponding public image data to obtain a multi-format code image file that passes the verification.

[0014] Specifically, the matching dual-path verification channel includes: Parse the metadata in the verification request to identify the operating environment identifier of the current verification terminal; When the operating environment is identified as a general QR code scanning client, the general QR code scanning channel is activated to load the anti-counterfeiting QR code image; When the operating environment is identified as a dedicated verification client, the dedicated verification channel is activated, and the fixed embedding rule and the random embedding rule are loaded synchronously.

[0015] Specifically, the native error correction logic includes: The anti-counterfeiting QR code image is subjected to grid sampling to extract the main codeword bitstream containing different color code elements; The built-in Reed-Solomon decoder is invoked to perform syntactic operations on the main codeword bitstream to obtain the position of the erroneous codeword that has a numerical deviation. The error code position is reversed and corrected using an error correction polynomial to remove the interference of the embedded code on the original data; the corrected main codeword bitstream is then reverse-decoded according to the QR code standard encoding rules to parse and output the public information.

[0016] Specifically, the weighted score calculation includes: Extract the symbol signal contrast and waveform matching coefficient from the parsing results corresponding to each embedding rule, and use the symbol signal contrast as the sharpness score and the waveform matching coefficient as the matching degree score; weight the preset weight parameters with the sharpness score and the matching degree score respectively to calculate the comprehensive score corresponding to the embedding rule; sort the multiple comprehensive scores numerically, and reverse-confirm the candidate embedding mode corresponding to the embedding rule with the highest comprehensive score as the target embedding mode.

[0017] The beneficial effects of this invention are as follows: (1) This invention achieves hierarchical concealment of public and internal control information, improving the security and reliability of steganographic data without affecting the normal scanning of standard QR codes. Through a dual-rule architecture combining fixed and random embedding rules, it solves the problems of easy reverse engineering and insufficient anti-counterfeiting security of single fixed rules, while avoiding the defects of poor data stability and low scanning recognition rate of single random rules. By combining the code element modification rate and visual interference value to select the optimal embedding mode, the optimal balance between security and recognition reliability is achieved. At the same time, the embedding parameters are stored in segments in the code word filling area after scrambling, without occupying data code positions, which greatly improves the data preservation stability under printing deformation and local wear conditions, and can be directly adapted to the anti-counterfeiting and traceability needs of products in multiple fields.

[0018] (2) This invention uses a multi-format code image deconstruction and hierarchical permission storage architecture to split the complete code image file into public image data for regular display and printing configuration files for controlling printing, and logically isolates them in public data storage area and controlled encrypted storage area. This architecture eliminates the structural defects caused by conventional plaintext full image distribution, which makes high-value original assets easy to be intercepted and cloned throughout the entire chain. Combined with secure access token verification and data reorganization mechanism, it realizes authentication and flow tracing in the process of printing configuration file distribution. At the same time, the system is configured with an adaptive flow split dual-path verification channel, which enables general clients to smoothly read public information without changing the native error correction logic, while dedicated clients reverse identify the target embedding pattern through basic rule base traversal and weighted scoring, extract internal control information to complete anti-counterfeiting verification, and realize the independent isolation of public dissemination attributes and internal control anti-counterfeiting attributes on a unified code image carrier. Attached Figure Description

[0019] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.

[0020] Figure 1 This is a flowchart illustrating a QR code generation and verification method based on hierarchical embedding of redundant error correction code points according to the present invention. Figure 2 This is an architecture diagram of a QR code generation and verification method based on hierarchical embedding of redundant error correction code points, as described in this invention. Detailed Implementation

[0021] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided.

[0022] Please see Figures 1-2 A method for generating and verifying QR codes based on hierarchical embedding of redundant error correction code points, comprising: S1: Obtain multi-source information to be encoded, divide it into public information and internal control embedded information according to the public security level, encode and perform error correction calculation on the public information based on the QR code standard encoding rules to generate the main codeword sequence; perform cyclic redundancy check encoding on the internal control embedded information to generate the embedded sub-codeword sequence; S2: Configure fixed embedding rules and construct random embedding rules to form multiple alternative embedding modes; map the embedded subcode sequence to the redundant error correction code points of the main code sequence, calculate the code element modification rate under different alternative embedding modes, generate a target embedding mode that meets the preset conditions, and write the identifier and data length of the target embedding mode into the code padding area to construct the integrated code. S3: Convert the integrated codeword into a multi-format code image file, build a hierarchical permission resource storage architecture and verify the retrieval request of the multi-format code image file, distribute the verified multi-format code image file to the inkjet printing device, drive the inkjet printing device to print the multi-format code image file on the carrier surface, and generate an anti-counterfeiting QR code. S4: The verification terminal acquires the anti-counterfeiting QR code image and matches the dual-path verification channel. Under the general scanning channel, it calls the native error correction logic to isolate the embedded code elements and parses and outputs public information. Under the dedicated verification channel, it traverses the fixed embedding rules and random embedding rules, performs weighted scoring calculation on the parsing results of different embedding rules, and reversely identifies the target embedding pattern to extract the embedded sub-code word sequence and restore the internal control embedded information.

[0023] Specifically, the encoding and error correction calculation process includes: The public information to be encoded is formatted and converted, and mapped into a sequence of original data codewords based on the standard QR code encoding rules. Error correction operations are performed on the original data codeword sequence according to preset error correction level parameters to generate a corresponding number of error correction codewords, forming an error correction codeword sequence. The original data codeword sequence and the error correction codeword sequence are combined and arranged according to standard arrangement rules to construct the complete main codeword sequence.

[0024] Specifically, the cyclic redundancy check (CRC) code includes: The internal control embedded information to be encoded is compressed and formatted to generate a fixed-length internal control data codeword sequence that meets the encoding requirements. The internal control data codeword sequence is then subjected to a check operation according to the cyclic redundancy check rule to generate a corresponding number of check codewords, forming a check codeword sequence. The internal control data codeword sequence and the check codeword sequence are then concatenated and combined according to a preset format to construct the complete embedded sub-codeword sequence.

[0025] Specifically, the configuration fixed embedding rules include: Based on the distribution characteristics of redundant error correction bits in the main codeword sequence and the type of internal control embedded information, multiple sets of candidate fixed embedding rules are divided, and each set of candidate fixed embedding rules corresponds to a fixed mapping relationship of a specific type of data. For each group of candidate fixed embedding rules, code distribution uniformity verification and printing anti-interference capability evaluation are performed to select fixed embedding rules that meet the preset dispersion conditions and preset anti-printing deformation requirements. The selected fixed embedding rules are categorized and numbered according to data type to form a hierarchical configuration of fixed embedding rules.

[0026] Specifically, the process of constructing the random embedding rules includes: Extract the feature segments of the main codeword sequence, perform hash operation to obtain a hash value of fixed length, and convert it into a reproducible random seed parameter; Using the random seed parameters as initial input, a pseudo-random sequence generation algorithm generates multiple sets of random mapping relationships for corresponding redundant error correction code bits; For each group of random mapping relationships, code distribution uniformity verification and printing anti-interference capability evaluation are performed respectively. Random embedding rules that meet the availability requirements are selected and numbered according to the generation order to form random embedding rules that match the fixed embedding rules.

[0027] Specifically, the calculation process of the symbol modification rate includes: The embedded subcodeword sequence is mapped to the redundant error-correcting code points of the main codeword sequence and converted into a candidate matrix; Each candidate matrix is ​​compared bit by bit with the original reference matrix without embedded information, and the ratio of the number of different color symbols to the total number of symbols is taken as the symbol modification rate. The number of different colored symbols in the position detection graphic region of the candidate matrix is ​​obtained as the visual interference value; the symbol modification rate and the visual interference value are weighted to obtain a comprehensive coefficient, and candidate embedding modes with a comprehensive coefficient lower than a preset threshold are selected as the target embedding mode.

[0028] Specifically, the construction process of the integrated codeword includes: The identifier of the target embedding mode is concatenated with the data length in binary to generate a metadata stream. A state scrambling operation is performed on the metadata stream using a preset feature polynomial to output a scrambling feature bit stream. The overlap-filling byte after the data terminator is located in the main codeword sequence, and each overlap-filling byte is divided into a high-order bit segment and a low-order bit segment. The low-order bit segment of each overlap-filling byte is state-replaced using the scrambling feature bit stream, while keeping the high-order bit segment values ​​unchanged, to reconstruct the target padding byte. The main codeword sequence containing the target padding byte is combined with the redundant error-correcting code points to construct the integrated codeword.

[0029] Specifically, the process of building the hierarchical permission-based resource storage architecture includes: The pre-defined data storage center is logically isolated into a public data storage area and a controlled encrypted storage area; The multi-format code image file is split into public image data for regular display and printing configuration files for controlling printing; The publicly available image data is stored in the publicly available data storage area. The printed configuration file is encrypted and encapsulated using an encryption key that matches a preset permission label. The encrypted and encapsulated printed configuration file is then stored in the controlled encrypted storage area.

[0030] Specifically, the verification of the request to retrieve multi-format code image files includes: Receive the retrieval request for the multi-format code image file and extract the security access token carried in the retrieval request; The access level corresponding to the security access token is compared with the preset security threshold corresponding to the controlled encrypted storage area. When the access level is higher than or equal to the preset security threshold, the corresponding decryption key is called to decrypt and restore the printed configuration file. The decrypted and restored printed configuration file is then reconstructed with the corresponding public image data to obtain a multi-format code image file that passes the verification.

[0031] Specifically, the matching dual-path verification channel includes: Parse the metadata in the verification request to identify the operating environment identifier of the current verification terminal; When the operating environment is identified as a general QR code scanning client, the general QR code scanning channel is activated to load the anti-counterfeiting QR code image; When the operating environment is identified as a dedicated verification client, the dedicated verification channel is activated, and the fixed embedding rule and the random embedding rule are loaded simultaneously.

[0032] Specifically, the native error correction logic includes: The anti-counterfeiting QR code image is subjected to grid sampling to extract the main codeword bitstream containing different color code elements; The built-in Reed-Solomon decoder is invoked to perform syntactic operations on the main codeword bitstream to obtain the position of the erroneous codeword that has a numerical deviation. The error code position is reversed and corrected using an error correction polynomial to remove the interference of the embedded code on the original data; the corrected main codeword bitstream is then reverse-decoded according to the QR code standard encoding rules to parse and output the public information.

[0033] Specifically, the weighted score calculation includes: Extract the symbol signal contrast and waveform matching coefficient from the parsing results corresponding to each embedding rule, and use the symbol signal contrast as the sharpness score and the waveform matching coefficient as the matching degree score; weight the preset weight parameters with the sharpness score and the matching degree score respectively to calculate the comprehensive score corresponding to the embedding rule; sort the multiple comprehensive scores numerically, and reverse-confirm the candidate embedding mode corresponding to the embedding rule with the highest comprehensive score as the target embedding mode.

[0034] Example 1: Generation of main codeword sequence and embedded sub-codeword sequence, and configuration of fixed embedding rules and construction of random embedding rules to form multiple alternative embedding modes. This embodiment specifically relates to the data initialization and encoding preparation stage of an anti-counterfeiting QR code.

[0035] The system first acquires multi-source information to be encoded, classifying it into public information and internal control embedded information according to their public and private classification levels. The public information to be encoded undergoes format regularization and data conversion, mapping it into a raw data codeword sequence based on QR code standard encoding rules. Error correction operations are performed on the raw data codeword sequence according to preset error correction level parameters, generating a corresponding number of error correction codewords to form an error correction codeword sequence. The raw data codeword sequence and the error correction codeword sequence are then combined and arranged according to standard arrangement rules to construct the complete main codeword sequence S. main .

[0036] Simultaneously, the embedded internal control information is cyclically redundantly checked and encoded to generate an embedded sub-codeword sequence: the embedded internal control information to be encoded is compressed and formatted to generate a fixed-length internal control data codeword sequence that meets the encoding requirements; a check operation is performed on the internal control data codeword sequence according to the cyclic redundancy check rule to generate a corresponding number of check codewords, forming a check codeword sequence; the internal control data codeword sequence and the check codeword sequence are concatenated and combined according to a preset format to construct the complete embedded sub-codeword sequence S. sub .

[0037] Next, the system configures fixed embedding rules and constructs random embedding rules through the following process, combining them to form multiple alternative embedding patterns: Configure fixed embedding rules: based on the main codeword sequence S main The distribution characteristics of the redundant error correction code points and the type of the internal control embedded information are divided into multiple groups of candidate fixed embedding rules. Each group of candidate fixed embedding rules corresponds to a fixed mapping relationship R for a specific type of data. fix For each group of candidate fixed embedding rules, code distribution uniformity verification and printing anti-interference capability evaluation are performed. Fixed embedding rules that meet the preset dispersion conditions and preset anti-printing deformation requirements are selected and classified and numbered according to data type to form a hierarchical configuration of fixed embedding rules.

[0038] Construct random embedding rules: Extract the main codeword sequence S main The feature segment is hashed to obtain a fixed-length hash value, which is then converted into a reproducible random seed parameter Seed. rand Using the aforementioned random seed parameters as initial input, a pseudo-random sequence generation algorithm is used to generate multiple sets of random mapping relationships R corresponding to redundant error-correcting code points. randFor each group of random mapping relationships, code distribution uniformity verification and printing anti-interference capability evaluation are performed respectively. Random embedding rules that meet the availability requirements are selected and numbered according to the generation order to form random embedding rules that match the fixed embedding rules.

[0039] The system cross-maps and combines the fixed embedding rules configured in the above-mentioned hierarchical configuration with the corresponding random embedding rules, and discretly constructs a set of multiple candidate embedding patterns M={M1,M2,...,M...} in the system memory, containing N candidate combination schemes. N}

[0040] Numerical constraints and filtering: The system performs a multi-factor joint screening operation, calling the preset adaptive multi-factor evaluation formula: CC i =ω1·CR i +ω2VI i , The comprehensive coefficient CC corresponding to each of the candidate embedding modes was calculated. i Among them, CR i : Represents the symbol modification rate in the i-th group of candidate embedding modes. Its physical meaning is the percentage loss rate of the number of different-color symbols (i.e. black-and-white reverse symbols) in the candidate matrix after the redundant error correction code bits of the embedded sub-codeword sequence are mapped to the main codeword sequence and converted into a candidate matrix, compared with the original reference matrix that does not embed any information.

[0041] VI i : Represents the visual interference value in the i-th candidate embedding mode. Its physical meaning is specifically limited to the absolute number of dissimilar code elements in the "position detection graphic area" that plays a decisive role in the reading and positioning of conventional barcode scanners in the candidate matrix, used to rigidly constrain the visual noise of the core functional area. ω1: Represents the preset code element modification rate weight parameter, used to adjust the system's sensitivity to the area of ​​code element modification in the entire image; ω2: Represents the preset visual interference value weight parameter, where ω1+ω2=1, and ω1 and ω2 can be adjusted according to printing accuracy and anti-counterfeiting level requirements. The system traverses the entire candidate embedding mode set and filters out those that meet the CC i <T cc (T) cc The alternative embedding modes are set as the upper limit of the preset interference threshold, and the comprehensive coefficient CC is used. i The group of candidate embedding patterns with the smallest numerical value is positively selected as the target embedding pattern M. target .

[0042] Example 2: Calculating the symbol modification rate under different alternative embedding modes and constructing integrated codewords In this embodiment, after generating multiple alternative embedding modes, the codeword modification rate calculation, multi-factor screening, and integrated codeword encapsulation generation stages are performed.

[0043] The system executes the calculation process of the symbol modification rate: the embedded subcodeword sequence S sub Mapped to the main codeword sequence S main Redundant error-correcting code points are converted into candidate matrix Mat. cand_i (where i∈[1,N]). The candidate matrices Mat... cand_i Compared with the original baseline matrix Mat that does not embed embedded information base Perform a bit-by-bit comparison to determine the number of different color code elements C. diff With the total number of symbols C total The ratio of the two values ​​is used as the symbol change rate CR. i =C diff / C total .

[0044] Simultaneously, obtain the candidate matrix Mat cand_i The number of different colored symbols within the centrally located graphic region is used as the visual interference value VI. i The symbol modification rate CR i With the visual interference value VI i The weighted calculation yields the comprehensive coefficient CC. i The system filters out entries with a comprehensive coefficient lower than a preset threshold T. cc The candidate embedding modes are selected, and a target embedding mode M that meets the preset conditions is generated and selected. target .

[0045] Subsequently, the system executes the construction process of the integrated codeword: the identifier ID of the target embedding pattern is... mode With the data length L data Perform binary concatenation to generate a metadata stream. meta The metadata stream is subjected to state scrambling operation using a preset characteristic polynomial (a primitive polynomial commonly used in this field), and an obfuscated feature bit stream is output. scram In the main codeword sequence S main The interleaving and alignment bytes after the data terminator are located, and each interleaving and alignment byte is divided into a high-order bit segment (high K1 bits) and a low-order bit segment (low K2 bits). This is then processed through the obfuscated feature bit stream. scram The low-order bit segments of each of the aforementioned padding bytes are state-replaced while the high-order bit segments remain unchanged, reconstructing the target padding byte; the main codeword sequence containing the target padding byte is combined with the redundant error correction code points to construct the integrated codeword CW. integrated .

[0046] Example 3: Building a hierarchical permission-based resource storage architecture and generating anti-counterfeiting QR codes In this embodiment, the data assets after the integrated codewords are converted into multi-format code image files are subject to controlled storage, authentication and distribution, and industrial printing.

[0047] The system will integrate the codeword CW integrated The data is converted into multi-format code image files containing bitmaps or vector graphics of different resolutions. During this process, the system executes the construction process of the hierarchical permission resource storage architecture: logically isolating the preset data storage center into a public data storage area and a controlled encrypted storage area; and splitting the multi-format code image files into public image data (Img) for regular display. pub With the printing configuration file Config used to control printing print The publicly available image data Img pub Stored in the public data storage area, using an encryption key K that matches a preset permission tag. enc For the printed configuration file Config print The printed configuration file is encrypted and encapsulated, and then stored in the controlled encrypted storage area.

[0048] On the distribution chain, the production line control terminal verifies the retrieval requests for multi-format code image files: it receives the retrieval request and extracts the security access token carried in the retrieval request. sec Compare the access level L corresponding to the security access token. token The preset security threshold T corresponding to the controlled encrypted storage area threshold When the access level is higher than or equal to the preset security threshold, the corresponding decryption key K is invoked. dec The printing configuration file is decrypted and restored, and the decrypted and restored printing configuration file is recombined with the corresponding public image data to obtain a multi-format code image file that has passed verification. The file is then distributed to the inkjet printer, which drives the inkjet printer to print the multi-format code image file onto the surface of the carrier to generate an anti-counterfeiting QR code.

[0049] Example 4: Acquiring anti-counterfeiting QR code images and matching dual-path verification channels In this embodiment, when the inspection terminal faces a high-noise carrier such as printing deformation and surface wear, it performs an inspection stage of dual-path split demodulation and reverse extraction of steganographic information.

[0050] The process by which the verification terminal acquires the anti-counterfeiting QR code image and executes the matching dual-path verification channel involves: parsing the metadata of the anti-counterfeiting QR code image and identifying the current verification terminal's operating environment identifier (Env). id .

[0051] When the operating environment is identified as a general QR code scanning client, the general QR code scanning channel is activated to load the anti-counterfeiting QR code image, and the native error correction logic is invoked: the anti-counterfeiting QR code image is subjected to grid sampling to extract the main codeword bitstream containing different colored code elements; the built-in Reed-Solomon decoder is invoked to perform syntactic operations on the main codeword bitstream to obtain the position of the erroneous code element with numerical deviation; the error correction polynomial is used to reverse and correct the position of the erroneous code element to remove the interference of the embedded code element on the original data; the corrected main codeword bitstream is reverse-decoded according to the QR code standard encoding rules to parse and output the public information.

[0052] When the operating environment is identified as a dedicated verification client, the dedicated verification channel is activated, and the fixed embedding rule and the random embedding rule are loaded simultaneously.

[0053] The terminal iterates through fixed and random embedding rules under a dedicated verification channel and performs the weighted scoring calculation: extracting the symbol signal contrast and waveform matching coefficient from the parsing results corresponding to each embedding rule, and using the symbol signal contrast as the sharpness score S. contrast The waveform matching coefficient is used as the matching score S. wave The preset weight parameters are weighted and fused with the clarity score and the matching score respectively to calculate the comprehensive score corresponding to each embedding rule: Score j =α·S contrast_j +βS wave_j , Where α+β=1, and the weighting parameter can be adjusted according to printing accuracy and anti-counterfeiting level requirements, Score j This represents the scalar score output by weighting and multiplying the clarity and matching scores when traversing to the j-th group of embedding rules; S contrast_j S represents the sharpness score of the j-th group; wave_j This represents the matching score of the j-th group. The comprehensive scores of multiple groups are numerically sorted, and the candidate embedding pattern corresponding to the embedding rule with the highest comprehensive score is reverse-converted to confirm the target embedding pattern M. target Then, the embedded subcode sequence is extracted and the internal control embedded information is restored by using the code point mapping relationship corresponding to the target embedding mode.

[0054] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for generating and verifying QR codes based on hierarchical embedding of redundant error correction code points, characterized in that, include: S1: Obtain multi-source information to be encoded, divide it into public information and internal control embedded information according to the public security level, encode and perform error correction calculation on the public information based on the QR code standard encoding rules to generate the main codeword sequence; perform cyclic redundancy check encoding on the internal control embedded information to generate the embedded sub-codeword sequence; S2: Configure fixed embedding rules and construct random embedding rules to form multiple alternative embedding modes; map the embedded subcode sequence to the redundant error correction code points of the main code sequence, calculate the code element modification rate under different alternative embedding modes, generate a target embedding mode that meets the preset conditions, and write the identifier and data length of the target embedding mode into the code padding area to construct the integrated code. S3: Convert the integrated codeword into a multi-format code image file, build a hierarchical permission resource storage architecture and verify the retrieval request of the multi-format code image file, distribute the verified multi-format code image file to the inkjet printing device, drive the inkjet printing device to print the multi-format code image file on the carrier surface, and generate an anti-counterfeiting QR code. S4: The verification terminal obtains the anti-counterfeiting QR code image and matches the dual-path verification channel. Under the general scanning channel, it calls the native error correction logic to isolate the embedded code elements and parses and outputs public information. Under the dedicated verification channel, fixed embedding rules and random embedding rules are traversed, and the parsing results of different embedding rules are weighted and scored. The target embedding pattern is then identified in reverse to extract the embedded subcode sequence and restore the internal control embedded information.

2. The method according to claim 1, characterized in that, The encoding and error correction calculation process specifically includes: The public information to be encoded is formatted and converted, and mapped into a sequence of original data codewords based on the standard QR code encoding rules. Error correction operations are performed on the original data codeword sequence according to preset error correction level parameters to generate a corresponding number of error correction codewords, forming an error correction codeword sequence. The original data codeword sequence and the error correction codeword sequence are combined and arranged according to standard arrangement rules to construct the complete main codeword sequence.

3. The method according to claim 1, characterized in that, The cyclic redundancy check encoding specifically includes: The internal control embedded information to be encoded is compressed and formatted to generate a fixed-length internal control data codeword sequence that meets the encoding requirements. The internal control data codeword sequence is then subjected to a check operation according to the cyclic redundancy check rule to generate a corresponding number of check codewords, forming a check codeword sequence. The internal control data codeword sequence and the check codeword sequence are then concatenated and combined according to a preset format to construct the complete embedded sub-codeword sequence.

4. The method according to claim 1, characterized in that, The specific configuration of the fixed embedding rules includes: Based on the distribution characteristics of redundant error correction bits in the main codeword sequence and the type of internal control embedded information, multiple sets of candidate fixed embedding rules are divided, and each set of candidate fixed embedding rules corresponds to a fixed mapping relationship of a specific type of data. For each group of candidate fixed embedding rules, code distribution uniformity verification and printing anti-interference capability evaluation are performed to select fixed embedding rules that meet the preset dispersion conditions and preset anti-printing deformation requirements. The selected fixed embedding rules are categorized and numbered according to data type to form a hierarchical configuration of fixed embedding rules.

5. The method according to claim 1, characterized in that, The process of constructing the random embedding rules specifically includes: Extract the feature segments of the main codeword sequence, perform hash operation to obtain a hash value of fixed length, and convert it into a reproducible random seed parameter; Using the random seed parameters as initial input, a pseudo-random sequence generation algorithm generates multiple sets of random mapping relationships for corresponding redundant error correction code bits; For each group of random mapping relationships, code distribution uniformity verification and printing anti-interference capability evaluation are performed respectively. Random embedding rules that meet the usability requirements are selected and numbered according to the generation order to form random embedding rules that match the fixed embedding rules.

6. The method according to claim 1, characterized in that, The calculation process of the symbol modification rate specifically includes: The embedded subcodeword sequence is mapped to the redundant error-correcting code points of the main codeword sequence and converted into a candidate matrix; Each candidate matrix is ​​compared bit by bit with the original reference matrix without embedded information, and the ratio of the number of different color symbols to the total number of symbols is taken as the symbol modification rate. The number of different colored symbols in the position detection graphic region of the candidate matrix is ​​obtained as the visual interference value; the symbol modification rate and the visual interference value are weighted to calculate the comprehensive coefficient, and the candidate embedding modes with the comprehensive coefficient lower than the preset threshold are selected as the target embedding modes.

7. The method according to claim 1, characterized in that, The process of constructing the integrated codeword specifically includes: The identifier of the target embedding mode is concatenated with the data length in binary to generate a metadata stream. A state scrambling operation is performed on the metadata stream using a preset feature polynomial to output a scrambling feature bit stream. The overlap-filling byte after the data terminator is located in the main codeword sequence, and each overlap-filling byte is divided into a high-order bit segment and a low-order bit segment. The low-order bit segment of each overlap-filling byte is state-replaced using the scrambling feature bit stream, while keeping the high-order bit segment values ​​unchanged, to reconstruct the target padding byte. The main codeword sequence containing the target padding byte is combined with the redundant error-correcting code points to construct the integrated codeword.

8. The method according to claim 1, characterized in that, The process of building the hierarchical permission-based resource storage architecture specifically includes: The pre-defined data storage center is logically isolated into a public data storage area and a controlled encrypted storage area; The multi-format code image file is split into public image data for regular display and printing configuration files for controlling printing; The publicly available image data is stored in the publicly available data storage area. The printed configuration file is encrypted and encapsulated using an encryption key that matches a preset permission label. The encrypted and encapsulated printed configuration file is then stored in the controlled encrypted storage area.

9. The method according to claim 8, characterized in that, The verification of the request to retrieve multi-format code image files specifically includes: Receive the retrieval request for the multi-format code image file and extract the security access token carried in the retrieval request; The access level corresponding to the security access token is compared with the preset security threshold corresponding to the controlled encrypted storage area. When the access level is higher than or equal to the preset security threshold, the corresponding decryption key is called to decrypt and restore the printed configuration file. The decrypted and restored printed configuration file is then reconstructed with the corresponding public image data to obtain a multi-format code image file that passes the verification.

10. The method according to claim 1, characterized in that, The matching dual-path verification channel specifically includes: Parse the metadata in the verification request to identify the operating environment identifier of the current verification terminal; When the operating environment is identified as a general QR code scanning client, the general QR code scanning channel is activated to load the anti-counterfeiting QR code image; When the operating environment is identified as a dedicated verification client, the dedicated verification channel is activated, and the fixed embedding rule and the random embedding rule are loaded synchronously.

11. The method according to claim 1, characterized in that, The native error correction logic specifically includes: The anti-counterfeiting QR code image is subjected to grid sampling to extract the main codeword bitstream containing different color code elements; The built-in Reed-Solomon decoder is invoked to perform syntactic operations on the main codeword bitstream to obtain the position of the erroneous code element where the numerical deviation occurs. The error code positions are reversed and corrected using an error correction polynomial. The corrected main codeword bitstream is then decoded in reverse according to the QR code standard encoding rules to parse and output the public information.

12. The method according to claim 1, characterized in that, The weighted score calculation specifically includes: Extract the symbol signal contrast and waveform matching coefficient from the parsing results corresponding to each embedding rule, and use the symbol signal contrast as the sharpness score and the waveform matching coefficient as the matching degree score; weight the preset weight parameters with the sharpness score and the matching degree score respectively to calculate the comprehensive score corresponding to the embedding rule; sort the multiple comprehensive scores numerically, and reverse-confirm the candidate embedding mode corresponding to the embedding rule with the highest comprehensive score as the target embedding mode.