Secondary check code generation and check scheme for anti-counterfeiting code
By extracting information from the anti-counterfeiting code and combining product information for Galois domain calculation and chaotic encryption, a verification code ciphertext with high randomness and reductibility is generated, which solves the problem of the limitations of the existing anti-counterfeiting code and verification code scheme functions, and realizes more powerful anti-counterfeiting and verification functions.
Patent Information
- Application Number
- CN202411610296.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-03-21
AI Technical Summary
The existing anti-counterfeiting code and verification code schemes have functional limitations, and they cannot have functions such as anti-counterfeiting verification, traceability and warehousing management, and the verification code cannot be restored with the anti-counterfeiting code, and lacks the ability to guide users to actively use it.
A secondary verification code generation and verification method for anti-counterfeiting code is proposed. By extracting information from the anti-counterfeiting code as a verification base, combining it with product information, reversible calculation and chaotic encryption on the Galois field are carried out to generate a verification code ciphertext with high randomness and reductibility.
It realizes the ability to partially restore the anti-counterfeiting code without exposing the verification code, enhances the functionality and cracking resistance of the verification code, and solves the problem that the verification code cannot carry information and consumer verification difficulties.
Smart Images

Figure CN119670048A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a method, device, computer equipment and storage medium for generating and verifying a secondary verification code for an anti-counterfeiting code. Background Art
[0002] In traditional anti-counterfeiting code solutions, most of them do not have a secondary verification function, that is, the only anti-counterfeiting code value cannot simultaneously have functions such as anti-counterfeiting verification, traceability, and warehouse management. Against this background, some anti-counterfeiting codes have auxiliary verification codes, that is, one product corresponds to two codes, the anti-counterfeiting code and the verification code, which are responsible for different functions respectively, greatly enhancing the ability of a single anti-counterfeiting code.
[0003] At present, all the existing solutions on the market use random check codes (such as Figure 3 As shown in the figure, the check code with random lines is added, such as Figure 4 The verification code with random dots added as shown in the figure does not have the ability to carry information and cannot be restored to the anti-counterfeiting code. In addition, some verification codes with random patterns do not have the ability to carry information and require consumers to actively verify. Consumers need to compare every detail before they can verify, and perfect and reliable verification cannot be achieved.
[0004] Therefore, the existing verification code scheme also has certain functional limitations, and has the following problems: 1) After the anti-counterfeiting code is partially destroyed or changed, the verification code becomes invalid, reducing the credibility of anti-counterfeiting; 2) The verification code only has an auxiliary function of verification, and a large number of data bits are wasted; 3) If the verification code has a strong regularity, it is easy to be cracked in batches; 4) If the verification code is completely random, it will lose some functions; 5) There is a lack of ability to guide users to actively use the verification code for secondary verification.
[0005] In summary, the use of digital strings with information in anti-counterfeiting codes will cause regularity in carrying and have no anti-counterfeiting effect. Therefore, most anti-counterfeiting codes with actual anti-counterfeiting functions on the market are randomly generated. Even if they are randomly generated, since the annual production of anti-counterfeiting labels is tens of billions, counterfeiters can easily collide with anti-counterfeiting codes by mass copying to achieve alternative counterfeiting purposes, which will hit the products, anti-counterfeiting companies and related credibility.
[0006] The verification code that appears later corresponds to the anti-counterfeiting code one by one. The function of the verification code is actually to verify the authenticity of the anti-counterfeiting code. However, if the verification code wants to truly achieve the verification purpose, it can only be generated randomly.
[0007] In summary, due to their own functional limitations, if you want to achieve the purpose of verification, you will face the problem that the anti-counterfeiting code and verification code cannot carry information and it is difficult for consumers to verify; if you want to carry information and conduct a benign verification, its anti-counterfeiting ability will decrease. Summary of the invention
[0008] In order to overcome the shortcomings of the prior art, the embodiments of the present invention provide a method, device, computer equipment and storage medium for generating and verifying a secondary verification code for an anti-counterfeiting code, aiming at not sacrificing anti-counterfeiting security, that is, not exposing the verification code and not exposing the corresponding relationship with the anti-counterfeiting code, and proposing a secondary verification code that can be partially restored to the anti-counterfeiting code, so that it has more capabilities (carrying information, anti-cracking, verification code can be exposed, etc.) in addition to random string verification, and at the same time solves the problem of perfect verification of the verification code.
[0009] A method for generating a secondary verification code for an anti-counterfeiting code, comprising:
[0010] Extracting information of a second preset number of digits from the anti-counterfeiting code having the first preset number of digits as a verification base, and combining the verification base with the auxiliary code containing the commodity information to obtain a primary verification code;
[0011] Selecting a Galois field and a preset reversible matrix to perform a reversible operation on the primary check code, and performing plain code conversion on the result of the reversible operation to obtain a primary check code plain code having a third preset number of bits;
[0012] The primary check code plaintext is reversibly encrypted using a preset chaotic formula to obtain a check code ciphertext; wherein the check code ciphertext includes at least part of the information of the anti-counterfeiting code and part of the information of the auxiliary code; the second preset number of digits and the third preset number of digits are both smaller than the first preset number of digits.
[0013] A secondary verification code verification method for an anti-counterfeiting code, the verification method is applied in the cloud and is used to verify the verification code ciphertext obtained by the secondary verification code generation method for the anti-counterfeiting code as described above, comprising:
[0014] The verification code ciphertext is received, and an inverse operation is performed on the verification code ciphertext to obtain partial information of the anti-counterfeiting code or partial information of the auxiliary code.
[0015] A secondary verification code generation device for an anti-counterfeiting code, comprising:
[0016] A verification code generation module, used to extract information of a second preset number of digits from the anti-counterfeiting code having the first preset number of digits as a verification base, and combine the verification base with an auxiliary code containing commodity information to obtain a primary verification code;
[0017] A check code inverse operation module, used for selecting a Galois field and a preset reversible matrix to perform a reversible operation on the primary check code, and performing plain code conversion on the result of the reversible operation to obtain a primary check code plain code having a third preset number of bits;
[0018] The verification code encryption module is used to reversibly encrypt the primary verification code plaintext using a preset chaotic formula to obtain a verification code ciphertext; wherein the verification code ciphertext at least includes partial information of the anti-counterfeiting code and partial information of the auxiliary code; the second preset number of digits and the third preset number of digits are both smaller than the first preset number of digits.
[0019] A secondary verification code verification device for an anti-counterfeiting code, the verification device is applied in the cloud and is used to verify the verification code ciphertext obtained by the secondary verification code generation device for the anti-counterfeiting code as described above, comprising:
[0020] The restoration module is used to receive the verification code ciphertext and perform an inverse operation on the verification code ciphertext to obtain partial information of the anti-counterfeiting code or partial information of the auxiliary code.
[0021] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the secondary verification code generation and verification method for the anti-counterfeiting code are implemented.
[0022] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the secondary verification code generation and verification method for the anti-counterfeiting code are implemented.
[0023] The above-mentioned secondary verification code generation and verification method, device, computer equipment and storage medium for anti-counterfeiting codes have three major characteristics: first, without exposing the original verification code, it can form a corresponding restoration relationship with the anti-counterfeiting code, which is convenient for active verification; second, other information corresponding to the anti-counterfeiting code is integrated in the verification code generation process; third, the encrypted verification code and its length are highly random and reversible.
[0024] Specifically, compared with the solution of obtaining the check code by the traditional hash and pseudo-random number generator, the technical solution controls the size of the coding matrix on the Galois field to limit the length of the check code, constructs the algorithm of the coding matrix and the decoding matrix and the transformation process, and generates a check code with specific functional information; the check code of the specific length can be partially restored with the anti-counterfeiting code (the restoration method is encrypted), and the process has the following advantages:
[0025] 1) Efficient transformation compression: Through transformation on the Galois field, the check code is equivalent to an efficient information compression;
[0026] 2) Partial restoration capability: The verification code and the anti-counterfeiting code have partial restoration capabilities, so that after the anti-counterfeiting code information is lost, the product information can still be partially restored;
[0027] 3) Flexibility: By controlling the coding matrix and transformation algorithm, the verification code can contain simple information related to the product, such as the batch, number of anti-counterfeiting code digits, customer number, etc.
[0028] At the same time, the verification code ciphertext obtained by this technical solution has the following characteristics:
[0029] 1) Initial value sensitivity: Extremely sensitive to initial conditions, so that a slight change will lead to a huge difference in the results;
[0030] 2) Pseudo-randomness: despite being deterministic, their output sequences behave like random numbers;
[0031] 3) Unpredictability under big data: Due to their complexity, it is impossible to predict the patterns of verification codes and anti-counterfeiting codes by purchasing and studying them in large quantities.
[0032] In addition, the encrypted verification password can be directly displayed to the user, which is convenient for guiding the user to actively use the verification code for active verification. The user can send the verification code to the remote server or cloud by unlocking the UI interface to complete the active verification process. This solution has the following advantages:
[0033] 1) Using the verification password without exposing the real verification code greatly increases the difficulty of fraud;
[0034] 2) Various verification methods and strong scalability;
[0035] 3) It is interesting, guiding and interactive, which can improve the brand image of the product and enhance user favorability.
[0036] In summary, the present invention proposes a scheme in which an anti-counterfeiting code and a verification code can carry information, have the characteristics of random distribution, and can be mutually associated, confirmed, and partially restored.
[0037] In addition, regarding the use of the verification code, consumers are required to actively verify it, otherwise the functions and definitions of the verification code and the anti-counterfeiting code will overlap. Therefore, passive verification is used in the market, such as Ai Siyun already has solutions such as highlight position and code-in-code. The present invention proposes a technical solution that allows consumers to actively verify without exposing the value of the verification code. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0039] Figure 1 is a flow chart of a method for generating a secondary verification code for an anti-counterfeiting code in one embodiment of the present invention;
[0040] Figure 2 This is a schematic diagram of a user actively verifying through an unlock UI interface in one embodiment of the present invention;
[0041] Figure 3 It is a schematic diagram of a calibration method in which random lines are added in the prior art;
[0042] Figure 4 It is a schematic diagram of a verification method of adding random points in the prior art. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] In one embodiment, a method for generating a secondary verification code for an anti-counterfeiting code is provided, and its flow chart is as follows: Figure 1 As shown, the steps include:
[0045] S1, extracting information of a second preset number of digits from an anti-counterfeiting code having a first preset number of digits as a verification base, combining the verification base with an auxiliary code containing commodity information to obtain a primary verification code.
[0046] The anti-counterfeiting code corresponds to the product one by one, so that one product has one code. The anti-counterfeiting code can include information such as customer number, product batch, etc. The auxiliary code is other information related to the product information, such as the code of the product distribution route, etc. The first preset number of digits and the second preset number of digits are 18 digits and 3 digits respectively, but in actual application, they are not limited to this and can be flexibly selected.
[0047] S2, selecting a Galois field and a preset reversible matrix to perform a reversible operation on the primary check code, and performing plain code conversion on the result of the reversible operation to obtain a primary check code plain code having a third preset number of bits.
[0048] The transformation on the Galois field is equivalent to an efficient information compression of the primary check code. By encoding and transforming the preset reversible matrix, the primary check code can have simple information including batch, anti-counterfeiting code digits, customer number, etc. The plain code conversion is used to convert the result of the reversible operation into the primary check code plain code, wherein the third preset digit is preferably 12 digits, but not limited to this; the plain code conversion method can be flexible and diverse, such as bit-by-bit zero padding, etc.
[0049] S3, using a preset chaotic formula to reversibly encrypt the primary check code plaintext to obtain a check code ciphertext; wherein the check code ciphertext includes at least part of the information of the anti-counterfeiting code and part of the information of the auxiliary code.
[0050] Chaotic encryption usually involves complex dynamic systems, and typical preset chaotic formulas include Logistic mapping, Lorenz equation, etc. The check code ciphertext is obtained through a reversible encryption method (such as permutation encryption) mixed with chaotic formulas. At this time, the check code ciphertext has randomness, encryption, and restoration, and contains specific information (partial information of the anti-counterfeiting code and / or partial information of the auxiliary code). Therefore, the check code ciphertext can be fully displayed to consumers without exposing any original information and the corresponding relationship with the anti-counterfeiting code.
[0051] For ease of understanding, an 18-digit anti-counterfeiting code is used as an example. Suppose the 18-digit anti-counterfeiting code is "123223323423523623", where the first three digits are the customer number, the next three digits are the product batch, and the remaining digits represent other information.
[0052] Step 1: Extract the customer number "123" as the verification base, and add the product distribution route number "456" (i.e. the auxiliary code) to obtain the primary verification code "123456".
[0053] Step 2: Perform matrix reversible operation on the Galois field. Assume that the Galois field is GF(101) and the reversible matrix is a 3X3 matrix Calculate the result vector
[0054] Step 3: Convert the result vector R into plain code to obtain a 12-digit check code plain code. Specifically, expand each number in the result vector to two digits, fill in zeros in front of the numbers that are less than two digits, and then splice them together. After splicing, the 6-digit number "027517" is obtained. If more anti-counterfeiting code information is extracted in step 1 or more auxiliary codes are added, the number of digits obtained at this time will be longer. Now in order to reach 12 digits, you can fill in random numbers, such as 027517839204. If the filled random number is "839204", the final 12-digit check code plain code is "027517839204".
[0055] Step 4: Use a chaotic system for reversible encryption. Specifically, it includes: 1) defining a permutation rule (generated based on a certain chaotic sequence, such as Logistic mapping, Lorenz equation, etc.), assuming that the original position is: 123456789101112, and the permuted position is: 591123721064811. 2) Applying the permutation rule. The check code plaintext "027517839204" is permuted according to the permutation rule to obtain the encrypted 12-digit check code ciphertext: "190478227530". At this time, the 12-digit check code ciphertext contains part of the original anti-counterfeiting code information, part of the newly added shipping information, and is encrypted. It is random and can be publicly displayed.
[0056] It can be understood that the process of restoring the check code ciphertext to obtain the customer code "123" and the distribution route number "456" is the inverse operation of the above operation, namely, including: decryption, permutation, encryption and inverse matrix operation, and the process will not be repeated here.
[0057] In this embodiment, the matrix selection, the selection of the Galois field, and the chaotic encryption method are more complex and secure, which are simplified examples, but are not limited to these in practical applications.
[0058] 1) Verification code base: In this example, the customer number is extracted from the 18-digit anti-counterfeiting code and the distribution route number is added. In actual production, the number of digits of the customer number, the generation method, and the added data information are all mapped multiple times, and the number of digits is not equal.
[0059] 2) Matrix operation: In this example, a reversible matrix is used on GF(101) to operate the serial number and generate a 6-digit result. If the result is less than 12 digits, a random number is filled to obtain a 12-digit check code. In actual production, the matrix can be changed, and the random number generation has the functions of digit limit, check and restoration.
[0060] 3) Encryption: Use an encryption method mixed with a chaotic formula (permutation encryption in the example) to reversibly encrypt the 12-bit check code plaintext to generate a 12-bit ciphertext. In actual production, the chaotic encryption system is directly used, rather than simply citing the chaotic sequence generation formula.
[0061] 4) Restoration: The 18-digit anti-counterfeiting code and 12-digit verification password in this example are both public to consumers. Since the process has a discrete degree (i.e. each information part is independently mapped and encrypted), they have a certain mutual verification and restoration capability.
[0062] Furthermore, after obtaining the verification code ciphertext, the method further includes the following steps:
[0063] S4, mapping the verification code ciphertext to an unlocking UI interface, the unlocking UI interface is used to send the verification code ciphertext to the cloud for verification after the user triggers the unlocking UI interface.
[0064] Specifically, the ciphertext based on the verification code can be directly displayed to the user, with complete verification functions, and can generate data with specific requirements through a mathematical linear programming model with custom variable rules. Figure 2 In the unlocking UI interface shown, the data of the mobile phone sliding unlocking pattern (i.e., digital nine-square grid unlocking) is converted into a planning formula by adding rules such as "each data point is only allowed to pass through once" and "crossing data points must pass through the intermediate data points". Different mobile phone unlocking data is generated, and the front-end UI displays the mobile phone unlocking screen to guide the user to complete the active verification process.
[0065] Alternatively, the coordinates of a specific location are generated based on the verification code ciphertext, and by adding rules such as "coordinate point quantity limit" and "coordinate point spacing limit", they are converted into a planning formula to generate different coordinate data. At the same time, the front-end UI displays the product image, and the user completes the active verification process by clicking on different locations.
[0066] A secondary verification code verification method for an anti-counterfeiting code is provided. The verification method is applied on a cloud or remote server and is used to verify the verification code ciphertext obtained by the above-mentioned verification code generation method, and comprises the following steps:
[0067] S5: receiving the verification code ciphertext, and performing an inverse operation on the verification code ciphertext to obtain partial information of the anti-counterfeiting code or partial information of the auxiliary code.
[0068] Specifically, when the user scans the QR code, an unlocking UI interface will appear. When the user slides to unlock, the data of the path and landing point (the verification code ciphertext) will be transmitted back to the cloud, and then decoded, decrypted, converted, and restored to the 12-digit verification code plain text in the cloud, thereby obtaining partial information of the anti-counterfeiting code or partial information of the auxiliary code.
[0069] Provided is a secondary verification code generation device for an anti-counterfeiting code, and a corresponding secondary verification code verification device for an anti-counterfeiting code. The generation device comprises:
[0070] A verification code generation module is used to extract information of a second preset number of digits from the anti-counterfeiting code having the first preset number of digits as a verification base, and combine the verification base with the auxiliary code containing the commodity information to obtain a primary verification code;
[0071] A check code inverse operation module is used to select a Galois field and a preset reversible matrix to perform a reversible operation on the primary check code, and to convert the result of the reversible operation into a plain code to obtain a primary check code plain code having a third preset number of bits;
[0072] The check code encryption module is used to reversibly encrypt the primary check code plain text using a preset chaotic formula to obtain the check code ciphertext; wherein the check code ciphertext at least includes part of the information of the anti-counterfeiting code and part of the information of the auxiliary code; the second preset number of digits and the third preset number of digits are both smaller than the first preset number of digits.
[0073] The calibration device comprises:
[0074] The restoration module is used to receive the verification code ciphertext and perform an inverse operation on the verification code ciphertext to obtain partial information of the anti-counterfeiting code or partial information of the auxiliary code.
[0075] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the secondary verification code generation and verification method for the anti-counterfeiting code in the above-mentioned embodiment are implemented. To avoid repetition, they are not described here.
[0076] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the secondary verification code generation and verification method for the anti-counterfeiting code in the above method embodiment is implemented. To avoid repetition, it will not be repeated here.
[0077] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for generating a secondary verification code for an anti-counterfeiting code, characterized in that: include: Extracting information of a second preset number of digits from the anti-counterfeiting code having the first preset number of digits as a verification base, and combining the verification base with the auxiliary code containing the commodity information to obtain a primary verification code; Selecting a Galois field and a preset reversible matrix to perform a reversible operation on the primary check code, and performing plain code conversion on the result of the reversible operation to obtain a primary check code plain code having a third preset number of bits; The primary check code plaintext is reversibly encrypted using a preset chaotic formula to obtain a check code ciphertext; wherein the check code ciphertext includes at least part of the information of the anti-counterfeiting code and part of the information of the auxiliary code; the second preset number of digits and the third preset number of digits are both smaller than the first preset number of digits.
2. The method for generating a secondary verification code for an anti-counterfeiting code according to claim 1, characterized in that: The first preset number of bits is 18 bits, the second preset number of bits is 3 bits, and the third preset number of bits is 12 bits.
3. The method for generating a secondary verification code for an anti-counterfeiting code according to claim 2, characterized in that: The preset chaos formula includes Logistic mapping or Lorenz equation.
4. The method for generating a secondary verification code for an anti-counterfeiting code according to claim 1, characterized in that: The preset reversible matrix is a 3X3 matrix.
5. The method for generating a secondary verification code for an anti-counterfeiting code according to any one of claims 1 to 4, characterized in that: After obtaining the verification code ciphertext, the method further includes: The verification code ciphertext is mapped to an unlocking UI interface, and the unlocking UI interface is used to send the verification code ciphertext to the cloud for verification after the user triggers the unlocking UI interface.
6. A secondary verification code verification method for an anti-counterfeiting code, characterized in that: The verification method is applied in the cloud and is used to verify the verification code ciphertext obtained by the secondary verification code generation method for the anti-counterfeiting code as claimed in claim 5, including: The verification code ciphertext is received, and an inverse operation is performed on the verification code ciphertext to obtain partial information of the anti-counterfeiting code or partial information of the auxiliary code.
7. A secondary verification code generation device for an anti-counterfeiting code, characterized in that: include: A verification code generation module, used to extract information of a second preset number of digits from the anti-counterfeiting code having the first preset number of digits as a verification base, and combine the verification base with an auxiliary code containing commodity information to obtain a primary verification code; A check code inverse operation module, used for selecting a Galois field and a preset reversible matrix to perform a reversible operation on the primary check code, and performing plain code conversion on the result of the reversible operation to obtain a primary check code plain code having a third preset number of bits; The verification code encryption module is used to reversibly encrypt the primary verification code plaintext using a preset chaotic formula to obtain a verification code ciphertext; wherein the verification code ciphertext at least includes partial information of the anti-counterfeiting code and partial information of the auxiliary code; the second preset number of digits and the third preset number of digits are both smaller than the first preset number of digits.
8. A secondary verification code verification device for anti-counterfeiting codes, characterized in that: The verification device is applied in the cloud and is used to verify the verification code ciphertext obtained by the secondary verification code generation device for the anti-counterfeiting code as claimed in claim 7, including: The restoration module is used to receive the verification code ciphertext and perform an inverse operation on the verification code ciphertext to obtain partial information of the anti-counterfeiting code or partial information of the auxiliary code.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for generating a secondary verification code for an anti-counterfeiting code as described in any one of claims 1 to 5 are implemented, or when the processor executes the computer program, the steps of the method for verifying a secondary verification code for an anti-counterfeiting code as described in claim 6 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the steps of the method for generating a secondary verification code for an anti-counterfeiting code as described in any one of claims 1 to 5 are implemented, or when the computer program is executed by the processor, the steps of the method for verifying a secondary verification code for an anti-counterfeiting code as described in claim 6 are implemented.