Two-dimensional code intelligent verification method based on member account security
By using timestamp encryption and short string splicing technology to dynamically generate and refresh QR codes in the intelligent verification method of member accounts, the problem of static QR codes being easily used maliciously is solved, which significantly improves the problem of static QR codes being easily used. The security of membership code and the protection effect of merchant losses.
Patent Information
- Application Number
- CN202411563396.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Static QR codes are easily screenshot and maliciously used in member identity recognition and asset recognition scenarios, resulting in merchants and service providers facing economic losses and management chaos.
Using the intelligent verification method of QR code based on member account security, the initial QR code is generated by obtaining the account information of member users, and the time stamp is obtained in real time for encryption to generate short strings, splicing and generating new display QR codes, and refreshing regularly To improve safety.
Effectively prevent QR codes from being screenshotted, improve the security of member code reading, reduce the risk of economic losses for merchants, eliminate wool-fleeing behavior, and ensure marketing activities and member service order.
Smart Images

Figure CN119442208A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of two-dimensional code verification, and in particular to a two-dimensional code intelligent verification method based on member account security. Background Art
[0002] In current business activities, QR codes are favored for their convenience, efficiency and wide application scenarios. Whether in marketing promotion, online and offline integration, etc., QR codes play an important role and become an important bridge connecting consumers and enterprises, online and offline.
[0003] However, although static QR codes have been widely used in commercial activities, their inherent defects cannot be ignored. Once a static QR code is generated and made public, it is easy for someone with ulterior motives to take a screenshot and use it maliciously, causing economic losses and management chaos to merchants and service providers. For example, in scenarios involving member identity identification and member asset identification, if a static QR code is used for information verification and anti-counterfeiting, there is a risk of being used by others. Summary of the invention
[0004] The purpose of the present invention is to provide a QR code intelligent verification method based on member account security to solve the above technical problems.
[0005] The purpose of the present invention can be achieved through the following technical solutions:
[0006] A QR code intelligent verification method based on member account security includes the following steps:
[0007] Step S1: Obtain the account information of the member user, and generate an initial QR code according to the account information; set a time interval threshold T, obtain the current timestamp in real time according to the time interval threshold T, encrypt the timestamp, and generate a short string;
[0008] Obtain the two-dimensional code characters of the initial two-dimensional code, recorded as the initial two-dimensional code characters; concatenate the initial two-dimensional code characters and the short character string to obtain a new character string, and generate a new two-dimensional code according to the new character string, recorded as the display two-dimensional code; the display two-dimensional code is refreshed every T time;
[0009] Step S2: The member user presents the display QR code. When the scanning device scans, the scanning device continuously obtains n display QR codes to obtain a QR code group, where n≥2; the QR code group is parsed and decrypted to obtain n timestamps and an initial QR code, and the time difference Ct between the n timestamps is obtained;
[0010] Step S3: verify the time difference Ct to obtain a verification result; and determine whether to upload the initial QR code based on the verification result.
[0011] As a further solution of the present invention: the generation process of the initial two-dimensional code includes:
[0012] The account information includes a user name, a user ID and a number, and text information is generated according to the account information; the text information is formatted and converted into a character string; QR code parameters are set, and the QR code parameters include size, margin, foreground color and background color; and an initial QR code is generated according to the QR code parameters using a QR code generation tool.
[0013] As a further solution of the present invention: the setting range of the time interval threshold T is (0, 1].
[0014] As a further solution of the present invention: the process of encrypting the timestamp includes:
[0015] The encryption process is based on a symmetric encryption algorithm; a random number is obtained, and the random number is a digital combination of any 4 numbers between [0,9]; the timestamp is converted into bytes, a key is generated according to the random number, and the timestamp is encrypted by the key to obtain a short string.
[0016] As a further solution of the present invention: the process of splicing the initial two-dimensional code characters and the short character string includes:
[0017] A separator is set, and the selection range of the separator includes space, comma and colon; the separator is placed after the initial two-dimensional code character, and the short character string is added after the separator to obtain a new character string.
[0018] As a further solution of the present invention: the process of obtaining the time difference Ct includes:
[0019] Sort the n timestamps in chronological order to obtain the set {t1, t2, ..., t n}, where t1 represents the first timestamp, then the time difference is obtained Where i∈[2,n] and t is a positive integer.
[0020] As a further solution of the present invention: the process of verifying the time difference Ct includes:
[0021] According to the time interval threshold T, an error threshold range (0, nT+ε] is set, where ε is a preset fault tolerance threshold; if the time difference Ct belongs to the error threshold range, the verification result is recorded as normal; if the time difference Ct does not belong to the error threshold range, the verification result is recorded as abnormal.
[0022] As a further solution of the present invention: according to the verification result, the process of determining whether to upload the initial QR code includes:
[0023] If the verification result is normal, upload the initial QR code to the server; if the verification result is abnormal, prompt the member user that the QR code is abnormal.
[0024] Beneficial effects of the present invention:
[0025] The present invention adopts client resources to generate dynamic QR codes, which effectively avoids occupying server resources and affecting system performance; by continuously scanning and identifying at least two QR codes, and through key encryption, random number and time stamp and other verification mechanisms, it can ensure that the identified QR codes are active and valid, which can effectively prevent the QR code from being screenshotted and used, significantly improve the security of member code reading, and effectively curb malicious collection behavior; reduce the economic loss risk of merchants, effectively put an end to the wool-pulling behavior, and ensure normal marketing activities and member service order; by obtaining the timestamp in real time and encrypting it to generate a short character string, and then splicing it with the initial QR code characters to generate a new display QR code, this method increases the dynamic and unpredictable nature of the QR code content, thereby improving the security of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The present invention will be further described below in conjunction with the accompanying drawings.
[0027] Figure 1 It is a flow chart of a QR code intelligent verification method based on member account security of the present invention. DETAILED DESCRIPTION
[0028] 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 only 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.
[0029] See also Figure 1 As shown, the present invention is a QR code intelligent verification method based on member account security, comprising the following steps:
[0030] Step S1: Obtain the account information of the member user, and generate an initial QR code according to the account information; set a time interval threshold T, obtain the current timestamp in real time according to the time interval threshold T, encrypt the timestamp, and generate a short string;
[0031] Obtain the two-dimensional code characters of the initial two-dimensional code, recorded as the initial two-dimensional code characters; concatenate the initial two-dimensional code characters and the short character string to obtain a new character string, and generate a new two-dimensional code according to the new character string, recorded as the display two-dimensional code; the display two-dimensional code is refreshed every T time;
[0032] It should be noted that the device used by the member user to present the QR code is the client, and the server used by the merchant to connect the client and the scanning device is the server; the server generates an initial QR code based on the member user's account information, and the timestamp is obtained in real time by the member user's client and encrypted; at the same time, the client obtains the QR code characters of the initial QR code from the server, and then concatenates the QR code characters with the short character string to obtain a new character string; the client resources are used to generate dynamic QR codes, which effectively avoids occupying server resources and affecting system performance;
[0033] It is worth noting that the timestamp is a numerical value representing a specific moment, such as a Unix timestamp or a UTC date and time;
[0034] As a preferred embodiment of the present invention, the process of generating the initial two-dimensional code includes:
[0035] The account information includes a user name, a user ID and a number, and text information is generated according to the account information; the text information is formatted to convert the text information into a string; QR code parameters are set, and the QR code parameters include size, margin, foreground color and background color; using a QR code generation tool, an initial QR code is generated according to the QR code parameters;
[0036] It is worth noting that before generating text information, it is necessary to clearly identify the type of information contained in the QR code to be generated, such as text, URL, etc.; format the information into a string or data structure suitable for generating a QR code; for example, for a URL, ensure that its format is correct; for text, consider whether it needs to be encoded to adapt to the encoding rules of the QR code; set the size and margin of the QR code according to actual needs. A larger size can improve the scanning recognition rate, but it will also take up more space;
[0037] It should be noted that before generating a QR code, some key QR code parameters need to be set; among the QR code parameters, size refers to the size of the specified QR code, which affects the readability and scanning difficulty of the QR code; margin refers to the width of the blank area around the QR code, which helps to improve the recognition rate of the scanning device; foreground color is the color of the QR code, usually black or dark to ensure sufficient contrast; background color is the background color of the QR code, usually white or light, also to improve contrast and readability; use a professional QR code generation tool to generate an initial QR code according to the above-set parameters and the converted string information; the QR code generation tools include QR Code Generator, QR CodeMonkey and GoQR.me;
[0038] As a preferred embodiment of the present invention, the setting range of the time interval threshold T is (0, 1];
[0039] As a preferred embodiment of the present invention, the process of encrypting the timestamp includes:
[0040] The encryption process is based on a symmetric encryption algorithm; obtaining a random number, which is a digital combination of any four numbers between [0, 9]; converting the timestamp into bytes, generating a key according to the random number, and encrypting the timestamp with the key to obtain a short string;
[0041] It should be noted that the symmetric encryption algorithm has a small amount of calculation, a fast speed, and a high security strength, such as the RSA algorithm; the process of encrypting the timestamp with the key includes byte replacement, row shift, and column mixing;
[0042] As a preferred embodiment of the present invention, the process of splicing the initial two-dimensional code characters and the short character string includes:
[0043] Set a separator, the selection range of the separator includes space, comma and colon; place the separator after the initial QR code character, and add the short string to the separator to obtain a new string;
[0044] It should be noted that, first, a suitable separator needs to be selected to distinguish the initial QR code characters from the short string to be added; the optional separators include space, comma and colon; this step is to ensure that when scanning the QR code, it is possible to correctly identify which part is the original QR code information and which part is the newly added information; the selected separator is placed after the initial QR code characters; then, the short string is added after this separator to form a complete new string; the new string contains all the necessary information, retaining the original QR code information and adding new data; use the newly generated string to create a new QR code; this new QR code contains two parts of information: one part is the original QR code information, and the other part is the short string obtained by encrypting the timestamp; when the member user scans this new QR code, not only can the original information be read, but also additional security verification information can be obtained; every certain time interval T, obtain the current timestamp, encrypt the timestamp, generate a new short string, repeat the above splicing process, and obtain a new display QR code; the display QR code will be updated in real time to improve security and prevent replay attacks;
[0045] Step S2: The member user presents the display QR code. When the scanning device scans, the scanning device continuously obtains n display QR codes to obtain a QR code group, where n≥2; the QR code group is parsed and decrypted to obtain n timestamps and an initial QR code, and the time difference Ct between the n timestamps is obtained;
[0046] It is understandable that the member user presents their display QR code to the scanning device; this QR code is dynamically generated and contains encrypted timestamp information and other relevant data; when scanning, the scanning device does not obtain only one QR code, but continuously obtains at least two (n≥2) display QR codes; this is done to perform time difference analysis and verification to increase security; from the multiple scans obtained continuously, the scanning device will obtain a QR code group; the QR code group contains multiple QR codes, each of which contains different timestamps and initial QR code information; the scanning device parses and decrypts each QR code in the QR code group to obtain the corresponding plaintext information; this information includes timestamps and initial QR code characters; by comparing the multiple timestamps parsed, the time difference between them is calculated;
[0047] As a preferred embodiment of the present invention, the process of obtaining the time difference Ct includes:
[0048] Sort the n timestamps in chronological order to obtain the set {t1, t2, ..., t n}, where t1 represents the first timestamp, then the time difference is obtained Where i∈[2,n] and t is a positive integer;
[0049] It can be understood that the calculation process of the time difference Ct is to sort a group of timestamps and calculate the sum of the absolute differences between adjacent timestamps;
[0050] Step S3: Verify the time difference Ct to obtain a verification result; and determine whether to upload the initial QR code according to the verification result;
[0051] It is worth noting that the process of encrypting the displayed QR code occurs on the server side. In addition, the server side verifies the decrypted data. If the time is within the valid range and the data verification code is correct, the operation of uploading the initial QR code is allowed; otherwise, the upload is rejected and an exception is prompted;
[0052] As a preferred embodiment of the present invention, the process of verifying the time difference Ct includes:
[0053] According to the time interval threshold T, an error threshold range (0, nT+ε] is set, where ε is a preset fault tolerance threshold; if the time difference Ct belongs to the error threshold range, the verification result is recorded as normal; if the time difference Ct does not belong to the error threshold range, the verification result is recorded as abnormal;
[0054] It should be noted that the preset fault tolerance threshold ε is a parameter obtained based on experiments, which is used to allow a certain time deviation; the calculated time difference Ct is compared with the set error threshold range. If Ct falls within this range, that is, 0<Ct≤nT+ε, the time difference is considered normal; if Ct exceeds this range, that is, Ct is not within (0, nT+ε], the time difference is considered abnormal;
[0055] As a preferred embodiment of the present invention, the process of determining whether to upload the initial QR code according to the verification result includes:
[0056] If the verification result is normal, upload the initial QR code to the server; if the verification result is abnormal, prompt the member user that the QR code is abnormal;
[0057] It is understandable that the time difference Ct is first verified to determine whether it is within a preset error threshold; the verification process ensures that the QR code is used within a reasonable time interval, which helps prevent replay attacks and other potential security risks; if the verification result is normal, the initial QR code is uploaded to the server, which usually means that the member user's QR code has passed the security check and subsequent operations or transactions can continue; if the verification result is abnormal, the member user is prompted that the QR code is abnormal, which may mean that the QR code has been tampered with, expired, or there are other security issues, and the user needs to regenerate or scan the QR code.
[0058] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.
Claims
1. A QR code intelligent verification method based on member account security, characterized in that: The following steps are involved: Step S1: Obtain the account information of the member user and generate an initial QR code according to the account information; Set a time interval threshold T, obtain a current timestamp in real time according to the time interval threshold T, encrypt the timestamp, and generate a short string; Obtaining the two-dimensional code characters of the initial two-dimensional code, recorded as the initial two-dimensional code characters; The initial two-dimensional code characters and the short character string are concatenated to obtain a new character string, and a new two-dimensional code is generated according to the new character string, which is recorded as a display two-dimensional code; the display two-dimensional code is refreshed every T time; Step S2: The member user presents the display QR code. When the scanning device scans, the scanning device continuously obtains n display QR codes to obtain a QR code group, where n≥2; the QR code group is parsed and decrypted to obtain n timestamps and an initial QR code, and the time difference Ct between the n timestamps is obtained; Step S3: verify the time difference Ct to obtain a verification result; and determine whether to upload the initial QR code based on the verification result.
2. A QR code intelligent verification method based on member account security according to claim 1, characterized in that: In step S1, the process of generating the initial two-dimensional code includes: The account information includes a user name, a user ID and a number, and text information is generated according to the account information; the text information is formatted and converted into a character string; QR code parameters are set, and the QR code parameters include size, margin, foreground color and background color; and an initial QR code is generated according to the QR code parameters using a QR code generation tool.
3. A QR code intelligent verification method based on member account security according to claim 1, characterized in that: In step S1, the setting range of the time interval threshold T is (0, 1].
4. A QR code intelligent verification method based on member account security according to claim 1, characterized in that: In step S1, the process of encrypting the timestamp includes: The encryption process is based on a symmetric encryption algorithm; a random number is obtained, and the random number is a digital combination of any 4 numbers between [0,9]; the timestamp is converted into bytes, a key is generated according to the random number, and the timestamp is encrypted by the key to obtain a short string.
5. According to claim 1, a QR code intelligent verification method based on member account security is characterized in that: In step S1, the process of concatenating the initial two-dimensional code characters and the short character string includes: A separator is set, and the selection range of the separator includes space, comma and colon; the separator is placed after the initial two-dimensional code character, and the short character string is added after the separator to obtain a new character string.
6. A QR code intelligent verification method based on member account security according to claim 1, characterized in that: In step S2, the process of obtaining the time difference Ct includes: Sort the n timestamps in chronological order to obtain the set {t1, t2, ..., t n }, where t1 represents the first timestamp, then the time difference is obtained Where i∈[2,n] and t is a positive integer.
7. A QR code intelligent verification method based on member account security according to claim 1, characterized in that: In step S3, the process of verifying the time difference Ct includes: According to the time interval threshold T, an error threshold range (0, nT+ε] is set, where ε is a preset fault tolerance threshold; if the time difference Ct belongs to the error threshold range, the verification result is recorded as normal; if the time difference Ct does not belong to the error threshold range, the verification result is recorded as abnormal.
8. A QR code intelligent verification method based on member account security according to claim 1, characterized in that: In step S3, according to the verification result, the process of determining whether to upload the initial QR code includes: If the verification result is normal, upload the initial QR code to the server; if the verification result is abnormal, prompt the member user that the QR code is abnormal.
Citation Information
Patent Citations
Two-dimensional code dynamic encryption and decryption algorithm
CN105426765A
Two-dimensional code security verification method
CN107808286A
A novel dynamic two-dimensional code anti-counterfeiting solution
CN109726578A
QR two-dimensional code data security encryption method and decryption method
CN115021918A
Encryption generation method, system and equipment of dynamic two-dimensional code and medium
CN118333083A