Anti-counterfeiting two-dimensional code generation method based on dynamic encryption

By embedding encrypted data and anti-counterfeiting characteristics in the QR code and dynamically adjusting the encryption parameters according to the failure rate and information entropy, the problem of encrypted information being unable to be embedded in the data structure is solved, and the encryption effectiveness and data security of the QR code are improved.

CN119940386AInactive Publication Date: 2025-05-06北京捷润科技有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510421433.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-05-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, since some data have a specific structure, errors occur during conversion, resulting in mismatch of the original correct data format after transmission, resulting in the problem that encrypted information cannot be embedded.

Method used

By using an encryption algorithm to encrypt the encrypted information, embed the encrypted data and anti-counterfeiting features into the original QR code, the key is generated according to the encryption algorithm, and the key and anti-counterfeiting features are regularly updated. At the same time, according to the failure rate of embedding the information to be encrypted into the original QR code, the storage capacity of the data blocks of the encrypted data is adjusted, and the update time interval of the key is adjusted according to the information entropy of the encrypted data.

Benefits of technology

By increasing the storage capacity of the data blocks of encrypted data, more error correction information can be accommodated, thereby improving the ability to restore the original data when data errors occur, and reducing the probability that encrypted information cannot be embedded due to data errors. By reducing the update time interval of the key, the security of encrypted data can be enhanced and the security of the overall data can be improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119940386A_ABST
    Figure CN119940386A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of two-dimensional codes, in particular to an anti-counterfeiting two-dimensional code generation method based on dynamic encryption, which comprises the following steps: encrypting information to be encrypted by using an encryption algorithm to output encrypted data, and embedding the encrypted data and anti-counterfeiting features into an original two-dimensional code to output a finished product two-dimensional code; generating a secret key according to the encryption algorithm, and regularly updating the secret key and the anti-counterfeiting feature respectively; determining the encryption validity of the two-dimensional code based on the failure rate of embedding the to-be-encrypted information into the original two-dimensional code; if the encryption validity does not meet the requirement, the storage capacity of the data block of the encrypted data is adjusted, or the reliability of two-dimensional code encryption is determined based on the information entropy of the encrypted data; and if the reliability does not meet the requirement, adjusting the updating time interval of the secret key, or adjusting the generation rate of the two-dimensional code based on the loss rate of the encrypted data. According to the invention, the encryption effectiveness of the two-dimensional code is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of two-dimensional codes, and in particular to a method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption. Background Art

[0002] In today's era of rapid digital development, QR codes, as an efficient way of data storage and identification, have been widely used in various fields, such as commercial marketing, logistics management, ticketing systems, food safety traceability, etc. It has the advantages of large information capacity, fast reading speed, strong error correction ability, etc., and can quickly and accurately transmit various information. However, with the widespread use of QR codes, the problem of QR code anti-counterfeiting has become increasingly prominent.

[0003] In order to solve the problem of QR code anti-counterfeiting, people have adopted a variety of anti-counterfeiting technologies. Among them, some simple anti-counterfeiting methods are to add watermarks, anti-counterfeiting marks, etc. to the QR code, but these methods are easy to imitate and crack, and the anti-counterfeiting effect is limited. Some methods also use encryption technology to encrypt the information in the QR code, but the existing encryption methods may have problems such as insufficient encryption strength and poor key management.

[0004] Chinese Patent Publication No.: CN115796221A discloses a method for generating an anti-counterfeiting two-dimensional code for intelligent anti-counterfeiting white cardboard, comprising the following steps: adding anti-counterfeiting information elements in a directional manner into the paper to form an anti-counterfeiting element pattern of a preset size; based on the anti-counterfeiting element pattern, collecting the position of the information element in a specified area; generating an initial random digital number according to the position of the information element, encrypting the initial random digital number using a multiple encryption technology to obtain encrypted data; generating an anti-counterfeiting two-dimensional code based on the encrypted data. It can be seen that the method for generating an anti-counterfeiting two-dimensional code for intelligent anti-counterfeiting white cardboard has the problem that errors occur during conversion due to the specific structure of some data, resulting in the mismatch of the originally correct data format after transmission, thereby causing the encrypted information to be unable to be embedded. Summary of the invention

[0005] To this end, the present invention provides an anti-counterfeiting two-dimensional code generation method based on dynamic encryption, which is used to overcome the problem in the prior art that errors occur during conversion due to the specific structure of certain data, resulting in the mismatch of the originally correct data format after transmission, thereby causing the encrypted information to be unable to be embedded.

[0006] To achieve the above-mentioned purpose, the present invention provides a method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption, comprising: using an encryption algorithm to encrypt information to be encrypted to output encrypted data, embedding the encrypted data and anti-counterfeiting features into an original two-dimensional code to output a finished two-dimensional code; generating a key according to the encryption algorithm, and regularly updating the key and the anti-counterfeiting features respectively; obtaining a failure rate of embedding the information to be encrypted into the original two-dimensional code; determining the encryption validity of the two-dimensional code based on the failure rate of embedding the information to be encrypted into the original two-dimensional code; if the encryption validity does not meet the requirements, adjusting the storage capacity of the data block of the encrypted data, or determining the reliability of the two-dimensional code encryption based on the information entropy of the encrypted data; if the reliability does not meet the requirements, adjusting the key update time interval, or adjusting the generation rate of the two-dimensional code based on the loss rate of the encrypted data.

[0007] Further, determining the encryption validity of the QR code includes:

[0008] Comparing the failure rate of embedding the information to be encrypted into the original QR code with a preset first failure rate;

[0009] If the failure rate of embedding the information to be encrypted into the original two-dimensional code is greater than the preset first failure rate, it is determined that the encryption validity of the two-dimensional code does not meet the requirements.

[0010] Further, determining the reliability of the QR code encryption includes:

[0011] Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with the preset first failure rate and the preset second failure rate respectively;

[0012] If the failure rate of embedding the information to be encrypted into the original QR code is greater than the preset first failure rate and less than or equal to the preset second failure rate, it is preliminarily determined that the reliability of the QR code encryption does not meet the requirements, and whether the reliability of the QR code encryption meets the requirements is determined based on the information entropy of the encrypted data.

[0013] Furthermore, the storage capacity of the data block of the encrypted data is adjusted, including:

[0014] Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with the preset second failure rate;

[0015] If the failure rate of embedding the information to be encrypted into the original two-dimensional code is greater than a preset second failure rate, the storage capacity of the data block of the encrypted data is increased.

[0016] Furthermore, the increase in the storage capacity of the data block of the encrypted data is determined by the difference between the failure rate of embedding the information to be encrypted into the original two-dimensional code and a preset second failure rate.

[0017] Further, adjusting the update time interval of the key includes:

[0018] Comparing the information entropy of the encrypted data with the preset first information entropy and the preset second information entropy respectively;

[0019] If the information entropy of the encrypted data is less than or equal to the preset second information entropy, it is determined that the reliability of the QR code encryption does not meet the requirements;

[0020] If the information entropy of the encrypted data is greater than the preset first information entropy and less than or equal to the preset second information entropy, reducing the key update time interval;

[0021] If the information entropy of the encrypted data is less than or equal to the preset first information entropy, it is preliminarily determined that the network security risk does not meet the requirements, and whether the network security risk meets the requirements is determined based on the loss rate of the encrypted data.

[0022] Furthermore, the reduction range of the key update time interval is determined by the difference between the information entropy of the encrypted data and a preset first information entropy.

[0023] Furthermore, the generation rate of the two-dimensional code is adjusted, including:

[0024] Compare the loss rate of encrypted data with the preset loss rate;

[0025] If the loss rate of the encrypted data is greater than the preset loss rate, it is determined that the network security risk does not meet the requirements, and the generation rate of the QR code is reduced.

[0026] Furthermore, the loss rate of the encrypted data is the ratio of the amount of lost encrypted data to the total amount of encrypted data.

[0027] Furthermore, the reduction range of the generation rate of the two-dimensional code is determined by the difference between the loss rate of the encrypted data and the preset loss rate.

[0028] Compared with the prior art, the invention has the beneficial effect that the method of the invention adjusts the storage capacity of the data block of the encrypted data according to the failure rate of embedding the information to be encrypted into the original two-dimensional code. Since some data may have a specific structure, errors may occur during conversion, resulting in the mismatch of the originally correct data format after transmission, thereby causing the encrypted information to fail to be embedded. By increasing the storage capacity of the data block of the encrypted data, more error correction information can be accommodated, thereby improving the ability to restore the original data when an error occurs in the data, and reducing the probability that the encrypted information cannot be embedded due to data errors. The update time interval of the key is adjusted according to the information entropy of the encrypted data. Since sufficient random access is not introduced when generating the key or encrypting the data, the encryption time interval of the encrypted data is increased. If there are random factors, the encrypted data may show a certain regularity, resulting in insufficient encryption strength. By reducing the key update time interval, the defect of insufficient random factors can be compensated to a certain extent, making the encrypted data safer, thereby enhancing the security of the overall data. The generation rate of the QR code is adjusted according to the loss rate of the encrypted data. Since it may be attacked by malicious software in the network and damage the system, thus affecting the normal generation and use of the QR code, by reducing the generation rate of the QR code, the system can have more time to encrypt, verify and other operations on each QR code, ensuring that the generated QR code has the correct anti-counterfeiting encryption information and readability, improving the generation quality of the QR code, and improving the encryption effectiveness of the QR code.

[0029] Furthermore, the method of the present invention adjusts the storage capacity of the data block of the encrypted data by setting a preset first failure rate and a preset second failure rate. Since some data may have a specific structure, errors may occur during conversion, resulting in the original correct data format not matching after transmission, which results in the inability to embed the encrypted information. By increasing the storage capacity of the data block of the encrypted data, more error correction information can be accommodated, thereby improving the ability to recover the original data when an error occurs in the data, reducing the probability of the inability to embed the encrypted information due to data errors, and further improving the encryption effectiveness of the QR code.

[0030] Furthermore, the method of the present invention adjusts the key update time interval by setting a preset first information entropy and a preset second information entropy. Since sufficient random factors are not introduced when generating keys or encrypting data, the encrypted data may show a certain regularity, resulting in insufficient encryption strength. By reducing the key update time interval, the defect of insufficient random factors can be compensated to a certain extent, making the encrypted data more secure, thereby enhancing the overall data security and further improving the encryption effectiveness of the QR code.

[0031] Furthermore, the method described in the present invention adjusts the generation rate of the QR code by setting a preset loss rate. Since the system may be attacked by malicious software in the network and damaged, thereby affecting the normal generation and use of the QR code, by reducing the generation rate of the QR code, the system can have more time to encrypt, verify and other operations on each QR code, ensuring that the generated QR code has the correct anti-counterfeiting encryption information and readability, thereby improving the generation quality of the QR code and further improving the encryption effectiveness of the QR code. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 The overall flow chart of the method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to an embodiment of the present invention;

[0033] Figure 2 A logic flow chart of a process of adjusting the storage capacity of a data block of encrypted data in a method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to an embodiment of the present invention;

[0034] Figure 3 A logic flow chart of a process for adjusting the update time interval of a key in a method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to an embodiment of the present invention;

[0035] Figure 4 The present invention is a logic flow chart of a process for adjusting the generation rate of a two-dimensional code in a method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0037] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0038] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.

[0039] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0040] See also Figure 1 , Figure 2 , Figure 3 as well as Figure 4 As shown, they are respectively an overall flow chart of the anti-counterfeiting two-dimensional code generation method based on dynamic encryption according to an embodiment of the present invention, a logic flow chart of the process of adjusting the storage capacity of the data block of the encrypted data, a logic flow chart of the process of adjusting the update time interval of the key, and a logic flow chart of the process of adjusting the generation rate of the two-dimensional code. The present invention provides an anti-counterfeiting two-dimensional code generation method based on dynamic encryption, comprising:

[0041] Step S1, encrypting the information to be encrypted using an encryption algorithm to output encrypted data, and embedding the encrypted data and the anti-counterfeiting feature into the original two-dimensional code to output a finished two-dimensional code;

[0042] Step S2, generating a key according to the encryption algorithm, and regularly updating the key and the anti-counterfeiting feature respectively;

[0043] Step S3, obtaining the failure rate of embedding the information to be encrypted into the original QR code;

[0044] Step S4, determining the encryption validity of the two-dimensional code based on the failure rate of embedding the information to be encrypted into the original two-dimensional code;

[0045] Step S5, if the encryption validity does not meet the requirement, adjusting the storage capacity of the data block of the encrypted data, or determining the reliability of the QR code encryption based on the information entropy of the encrypted data;

[0046] Step S6: If the reliability does not meet the requirement, the key update time interval is adjusted, or the QR code generation rate is adjusted based on the loss rate of encrypted data.

[0047] Specifically, encryption algorithms include AES, DES, and RSA.

[0048] Specifically, the information to be encrypted includes product serial number, anti-counterfeiting identification information, and the source of product raw materials.

[0049] Specifically, the encrypted data includes the encrypted product serial number, encrypted anti-counterfeiting identification information, and encrypted product raw material sources.

[0050] Specifically, anti-counterfeiting features include hidden information, watermarks, and specific colors.

[0051] Specifically, the original QR code is a QR code with a blank QR code frame, no product information, and no anti-counterfeiting features.

[0052] Specifically, finished product QR codes include QR codes, PDF417 codes and data matrix codes.

[0053] In implementation, the method of the present invention adjusts the storage capacity of the data block of the encrypted data according to the failure rate of embedding the information to be encrypted into the original two-dimensional code. Since some data may have a specific structure, errors may occur during conversion, resulting in the mismatch of the originally correct data format after transmission, which results in the inability to embed the encrypted information. By increasing the storage capacity of the data block of the encrypted data, more error correction information can be accommodated, thereby improving the ability to restore the original data when an error occurs in the data, and reducing the probability that the encrypted information cannot be embedded due to data errors. The key update time interval is adjusted according to the information entropy of the encrypted data. Since sufficient random factors are not introduced when generating keys or encrypting data, the encryption The encrypted data may show a certain regularity, resulting in insufficient encryption strength. By reducing the key update time interval, the defect of insufficient random factors can be compensated to a certain extent, making the encrypted data more secure, thereby enhancing the overall data security. The generation rate of the QR code is adjusted according to the loss rate of the encrypted data. Since it may be attacked by malicious software in the network and damage the system, thus affecting the normal generation and use of the QR code, by reducing the generation rate of the QR code, the system can have more sufficient time to encrypt, verify and other operations on each QR code, ensuring that the generated QR code has the correct anti-counterfeiting encryption information and readability, improving the generation quality of the QR code, and improving the encryption effectiveness of the QR code.

[0054] Specifically, determining the encryption validity of the two-dimensional code includes:

[0055] Obtain the failure rate of embedding the information to be encrypted into the original QR code;

[0056] Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with a preset first failure rate;

[0057] If the failure rate of embedding the information to be encrypted into the original two-dimensional code is greater than the preset first failure rate, it is determined that the encryption validity of the two-dimensional code does not meet the requirements.

[0058] Specifically, determining the reliability of the QR code encryption includes:

[0059] Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with the preset first failure rate and the preset second failure rate respectively;

[0060] If the failure rate of embedding the information to be encrypted into the original QR code is greater than the preset first failure rate and less than or equal to the preset second failure rate, it is preliminarily determined that the reliability of the QR code encryption does not meet the requirements, and whether the reliability of the QR code encryption meets the requirements is determined based on the information entropy of the encrypted data.

[0061] It can be understood that the three intervals divided by the preset first failure rate and the preset second failure rate correspond to three situations respectively:

[0062] The first interval is that the failure rate of embedding the information to be encrypted into the original two-dimensional code is less than or equal to the preset first failure rate, and the corresponding situation is: determining that the encryption validity of the two-dimensional code meets the requirements;

[0063] The second interval is when the failure rate of embedding the information to be encrypted into the original QR code is greater than the preset first failure rate and less than or equal to the preset second failure rate. The corresponding situation is: since there is not enough random factor introduced when generating the key or encrypting the data, the encrypted data may show a certain regularity, resulting in insufficient encryption strength;

[0064] The third interval is that the failure rate of embedding the encrypted information into the original QR code is greater than the preset second failure rate. The corresponding situation is: since some data may have a specific structure, errors occur during conversion, resulting in the original correct data format not matching after transmission, resulting in the inability to embed the encrypted information.

[0065] In implementation, the preset first failure rate is generally selected in the range of [0.5%, 1.5%], and the preset second failure rate is generally selected in the range of [2%, 3%].

[0066] Preferably, the preferred embodiment of the preset first failure rate is 1%, and the preferred embodiment of the preset second failure rate is 2.5%.

[0067] Specifically, the failure rate of embedding the information to be encrypted into the original two-dimensional code is the ratio of the number of times the information to be encrypted fails to be embedded into the two-dimensional code to the total number of times the information to be encrypted is embedded into the two-dimensional code.

[0068] Specifically, the failure to embed the information to be encrypted into the QR code means that when the encrypted information is embedded into the QR code, an error occurs in conversion, resulting in that the information to be encrypted is not embedded into the QR code.

[0069] In implementation, the method of the present invention determines the encryption validity of the QR code by setting a preset first failure rate and a preset second failure rate, thereby reducing the impact of the decreased encryption stability of the QR code due to inaccurate determination of the encryption validity of the QR code, and further improving the encryption validity of the QR code.

[0070] Specifically, adjusting the storage capacity of the data block of the encrypted data includes:

[0071] Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with the preset second failure rate;

[0072] If the failure rate of embedding the information to be encrypted into the original two-dimensional code is greater than a preset second failure rate, the storage capacity of the data block of the encrypted data is increased.

[0073] Specifically, the increase in the storage capacity of the data block of the encrypted data is determined by the difference between the failure rate of embedding the information to be encrypted into the original two-dimensional code and a preset second failure rate.

[0074] Specifically, when the difference between the failure rate of embedding the information to be encrypted in the original two-dimensional code and the preset second failure rate is within 0.5%, the storage capacity of the data block of the encrypted data is increased to 1.1 times of the original value; when the difference between the failure rate of embedding the information to be encrypted in the original two-dimensional code and the preset second failure rate exceeds 0.5%, on the basis of being increased to 1.1 times of the original value, the storage capacity of the data block of the encrypted data is increased by 50Byte for every 0.5% exceeding it. For example, the difference between the failure rate of embedding the information to be encrypted in the original two-dimensional code and the preset second failure rate is 1.5%, the current storage capacity of the data block of the encrypted data is 2000Byte, and the increased storage capacity of the data block of the encrypted data is 2000×1.1+50×2=2300Byte.

[0075] In implementation, the method of the present invention adjusts the storage capacity of the data block of the encrypted data by setting a preset first failure rate and a preset second failure rate. Since some data may have a specific structure, errors may occur during conversion, resulting in the original correct data format not matching after transmission, which results in the inability to embed the encrypted information. By increasing the storage capacity of the data block of the encrypted data, more error correction information can be accommodated, thereby improving the ability to recover the original data when an error occurs in the data, reducing the probability of the inability to embed the encrypted information due to data errors, and further improving the encryption effectiveness of the QR code.

[0076] Specifically, adjusting the update time interval of the key includes:

[0077] Get the information entropy of encrypted data;

[0078] Comparing the information entropy of the encrypted data with a preset first information entropy and a preset second information entropy respectively;

[0079] If the information entropy of the encrypted data is less than or equal to the preset second information entropy, it is determined that the reliability of the QR code encryption does not meet the requirements;

[0080] If the information entropy of the encrypted data is greater than the preset first information entropy and less than or equal to the preset second information entropy, reducing the key update time interval;

[0081] If the information entropy of the encrypted data is less than or equal to the preset first information entropy, it is preliminarily determined that the network security risk does not meet the requirements, and whether the network security risk meets the requirements is determined based on the loss rate of the encrypted data.

[0082] It can be understood that the three intervals divided by the preset first information entropy and the preset second information entropy correspond to three situations respectively:

[0083] The first interval is that the information entropy of the encrypted data is less than or equal to the preset first information entropy, and the corresponding situation is: due to the possibility of being attacked by malicious software in the network, the system is damaged, thereby affecting the normal generation and use of the QR code;

[0084] The second interval is when the information entropy of the encrypted data is greater than the preset first information entropy and less than or equal to the preset second information entropy. The corresponding situation is: since there is not enough random factor introduced when generating the key or encrypting the data, the encrypted data may show a certain regularity, resulting in insufficient encryption strength;

[0085] The third interval is that the information entropy of the encrypted data is greater than the preset second information entropy, and the corresponding situation is: determining that the reliability of the QR code encryption meets the requirements.

[0086] In implementation, the preset first information entropy is generally selected in the range of [6 bit, 8 bit], and the preset second information entropy is generally selected in the range of [9 bit, 11 bit].

[0087] Preferably, the preferred embodiment of the preset first information entropy is 7 bits, and the preferred embodiment of the preset second information entropy is 10 bits.

[0088] Specifically, the information entropy of encrypted data is an indicator used to measure the uncertainty or randomness contained in the encrypted data.

[0089] In implementation, the method of the present invention determines the reliability of QR code encryption by setting a preset first information entropy and a preset second information entropy, thereby reducing the impact of the decrease in the encryption effectiveness of the QR code due to inaccurate determination of the reliability of the QR code encryption, and further improving the encryption effectiveness of the QR code.

[0090] Specifically, the reduction range of the key update time interval is determined by the difference between the information entropy of the encrypted data and the preset first information entropy.

[0091] Specifically, when the difference between the information entropy of the encrypted data and the preset first information entropy is within 2 bits, the key update time interval is reduced to 0.9 times the original time interval; when the difference between the information entropy of the encrypted data and the preset first information entropy exceeds 2 bits, on the basis of being reduced to 0.9 times the original time interval, the key update time interval is reduced by 0.5h for every bit exceeding 1 bit. For example, the difference between the information entropy of the encrypted data and the preset first information entropy is 4 bits, the current key update time interval is 10h, and the reduced key update time interval is 10×0.9-0.5×2=8h.

[0092] In implementation, the method of the present invention adjusts the key update time interval by setting a preset first information entropy and a preset second information entropy. Since sufficient random factors are not introduced when generating keys or encrypting data, the encrypted data may show a certain regularity, resulting in insufficient encryption strength. By reducing the key update time interval, the defect of insufficient random factors can be compensated to a certain extent, making the encrypted data more secure, thereby enhancing the overall data security and further improving the encryption effectiveness of the QR code.

[0093] Specifically, adjusting the generation rate of the two-dimensional code includes:

[0094] The amount of lost encrypted data and the total amount of encrypted data are obtained respectively, and the loss rate of encrypted data is calculated;

[0095] Comparing the loss rate of the encrypted data with a preset loss rate;

[0096] If the loss rate of the encrypted data is greater than the preset loss rate, it is determined that the network security risk does not meet the requirements, and the generation rate of the QR code is reduced.

[0097] It can be understood that the two intervals divided by the preset loss rate correspond to two situations:

[0098] The first interval is that the loss rate of encrypted data is less than or equal to the preset loss rate, and the corresponding situation is: it is determined that the network security risk meets the requirements;

[0099] The second interval is when the loss rate of encrypted data is greater than the preset loss rate, and the corresponding situation is: due to the possibility of being attacked by malicious software in the network, the system is damaged, thereby affecting the normal generation and use of the QR code.

[0100] In practice, the preset loss rate is generally selected in the range of [2%, 4%].

[0101] Preferably, the preferred embodiment of the preset loss rate is 3%.

[0102] In implementation, the method of the present invention determines network security risks by setting a preset loss rate, thereby reducing the impact of decreased encryption effectiveness of the QR code due to inaccurate determination of network security risks, and further improving the encryption effectiveness of the QR code.

[0103] Specifically, the loss rate of the encrypted data is the ratio of the amount of lost encrypted data to the total amount of encrypted data.

[0104] Specifically, the reduction range of the generation rate of the two-dimensional code is determined by the difference between the loss rate of the encrypted data and the preset loss rate.

[0105] Specifically, when the difference between the loss rate of encrypted data and the preset loss rate is within 2%, the generation rate of the QR code is reduced to 0.9 times the original rate; when the difference between the loss rate of encrypted data and the preset loss rate exceeds 2%, on the basis of being reduced to 0.9 times the original rate, the generation rate of the QR code is reduced by 1 / second for every 1% exceeding it. For example, the difference between the loss rate of encrypted data and the preset loss rate is 4%, the current generation rate of the QR code is 10 / second, and the reduced generation rate of the QR code is 10×0.9-1×2=7 / second.

[0106] In implementation, the method of the present invention adjusts the generation rate of the QR code by setting a preset loss rate. Since the system may be attacked by malicious software in the network and damaged, thereby affecting the normal generation and use of the QR code, by reducing the generation rate of the QR code, the system can have more sufficient time to encrypt, verify and other operations on each QR code, ensuring that the generated QR code has the correct anti-counterfeiting encryption information and readability, improving the generation quality of the QR code, and further improving the encryption effectiveness of the QR code.

[0107] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption, characterized in that: include: Encrypting the information to be encrypted using an encryption algorithm to output encrypted data, and embedding the encrypted data and the anti-counterfeiting feature into the original two-dimensional code to output a finished two-dimensional code; generating a key according to the encryption algorithm, and regularly updating the key and the anti-counterfeiting feature respectively; Obtain the failure rate of embedding the information to be encrypted into the original QR code; Determining the encryption validity of the QR code based on a failure rate of embedding the information to be encrypted into the original QR code; If the encryption validity does not meet the requirements, the storage capacity of the data block of the encrypted data is adjusted, or the reliability of the QR code encryption is determined based on the information entropy of the encrypted data; If the reliability does not meet the requirement, the update time interval of the key is adjusted, or the generation rate of the QR code is adjusted based on the loss rate of the encrypted data.

2. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 1, characterized in that: Determining the encryption validity of the QR code includes: Comparing the failure rate of embedding the information to be encrypted into the original QR code with a preset first failure rate; If the failure rate of embedding the information to be encrypted into the original two-dimensional code is greater than the preset first failure rate, it is determined that the encryption validity of the two-dimensional code does not meet the requirements.

3. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 2, characterized in that: Determining the reliability of the QR code encryption includes: Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with the preset first failure rate and the preset second failure rate respectively; If the failure rate of embedding the information to be encrypted into the original QR code is greater than the preset first failure rate and less than or equal to the preset second failure rate, it is preliminarily determined that the reliability of the QR code encryption does not meet the requirements, and whether the reliability of the QR code encryption meets the requirements is determined based on the information entropy of the encrypted data.

4. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 3, characterized in that: Adjusting the storage capacity of the data block of the encrypted data includes: Comparing the failure rate of embedding the information to be encrypted into the original two-dimensional code with the preset second failure rate; If the failure rate of embedding the information to be encrypted into the original two-dimensional code is greater than a preset second failure rate, the storage capacity of the data block of the encrypted data is increased.

5. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 4, characterized in that: The increase in the storage capacity of the data block of the encrypted data is determined by the difference between the failure rate of embedding the information to be encrypted into the original two-dimensional code and a preset second failure rate.

6. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 5, characterized in that: The updating time interval of the key is adjusted, including: Comparing the information entropy of the encrypted data with the preset first information entropy and the preset second information entropy respectively; If the information entropy of the encrypted data is less than or equal to the preset second information entropy, it is determined that the reliability of the QR code encryption does not meet the requirements; If the information entropy of the encrypted data is greater than the preset first information entropy and less than or equal to the preset second information entropy, reducing the key update time interval; If the information entropy of the encrypted data is less than or equal to the preset first information entropy, it is preliminarily determined that the network security risk does not meet the requirements, and whether the network security risk meets the requirements is determined based on the loss rate of the encrypted data.

7. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 6, characterized in that: The reduction range of the key update time interval is determined by the difference between the information entropy of the encrypted data and the preset first information entropy.

8. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 7, characterized in that: The generation rate of the two-dimensional code is adjusted, including: Compare the loss rate of encrypted data with the preset loss rate; If the loss rate of the encrypted data is greater than the preset loss rate, it is determined that the network security risk does not meet the requirements, and the generation rate of the QR code is reduced.

9. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 8, characterized in that: The loss rate of the encrypted data is the ratio of the amount of lost encrypted data to the total amount of encrypted data.

10. The method for generating an anti-counterfeiting two-dimensional code based on dynamic encryption according to claim 9, characterized in that: The reduction range of the generation rate of the two-dimensional code is determined by the difference between the loss rate of the encrypted data and the preset loss rate.

Citation Information

Patent Citations

  • Anti-counterfeiting two-dimensional code generation method for intelligent anti-counterfeiting white cardboard

    CN115796221A

  • Method And System For Using Downgraded Flash Die For Cache Applications

    CN107204207A

  • Encryption timing method based on an offline dynamic two-dimensional code

    CN109376818A

  • Cloud-based EMM encryption method and system

    CN119155065A

  • Two-dimensional code generation method based on anti-counterfeiting encryption technology

    CN119180293A