Login verification method, device, equipment and storage medium based on coordinate offset
Through the login verification method based on coordinate offset, the user's latitude and longitude information and step number information are used to generate login tokens, which solves the problem that traditional token generation methods are easily cracked and improves the security of user login verification.
Patent Information
- Application Number
- CN202211124857.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2042-09-15
AI Technical Summary
In the prior art, when generating tokens, the user login account is easily cracked, resulting in low security of account password information.
The login verification method based on coordinate offset is adopted to obtain the user's latitude and longitude information and step number information, determine the user's offset, and generate a login token based on the user's login information.
It improves the randomness and incrackability of login tokens, enhances the security of user login verification, and avoids the risk of account password information being leaked in traditional methods.
Smart Images

Figure CN115589308B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology and security, and particularly to a login verification method based on coordinate offset, a login verification device based on coordinate offset, a corresponding electronic device, and a corresponding computer storage medium. Background Art
[0002] With the development of the mobile Internet, the user volume of mobile terminals / clients has been increasing day by day. In the face of the huge user volume, the access pressure borne by the server needs to be centralized, and it is necessary to solve the pressure problem that the database needs to be accessed to verify the account password every time the client requests the server.
[0003] Currently, the above problems can be solved by introducing the generation of Tokens. A Token is a string generated by the server, which can be used as a token for the client to make requests. Usually, after the server generates a Token, it returns it to the client so that the client can perform login verification based on the token when logging in. In the traditional token generation method, tokens are usually generated based on the user's login account. In this token generation method, after obtaining the decrypted ciphertext, it is easy to crack and obtain the user's account password information, and the security of the encrypted data is low. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a login verification method based on coordinate offset, a login verification device based on coordinate offset, a corresponding electronic device, and a corresponding computer storage medium that overcome the above problems or at least partially solve the above problems.
[0005] Embodiments of the present invention disclose a login verification method based on coordinate offset, which is applied to a server. The method includes:
[0006] Obtain user data information, and determine a user offset according to the user data information; the user offset is used to represent the coordinate offset of the user during the update time interval;
[0007] Obtain user login information, and generate a login token according to the user login information and the user offset;
[0008] Perform login verification according to the generated login token.
[0009] Optionally, the user data information includes the longitude and latitude information and step information of the user; the determining of the user offset according to the user data information includes:
[0010] Determine the user offset distance according to the longitude and latitude information of the user;
[0011] Determine the user offset based on the user offset distance and the step count information.
[0012] Optionally, the longitude and latitude information of the user includes the first longitude and latitude where the user is located at the current moment and the second longitude and latitude where the user was located at the previous moment before the distance update time interval, and the step count information includes the first number of exercise steps counted at the current moment and the second number of exercise steps counted at the previous moment before the update time interval;
[0013] The determining of the user offset distance according to the longitude and latitude where the user is located includes:
[0014] Construct a plane rectangular coordinate system with the second longitude and latitude as the origin;
[0015] In the plane rectangular coordinate system, use the first longitude and latitude and the second longitude and latitude to calculate the first user offset distance of the user from the previous moment before the distance update time interval to the current moment;
[0016] Randomly select any moment within the time period from the previous moment before the distance update time interval to the current moment, and use the first user offset distance, the current moment, and the randomly selected moment to calculate the second user offset distance of the user from the randomly selected moment to the previous moment before the distance update time interval.
[0017] Optionally, the user offset distance includes the second user offset distance from any moment selected within the time period from the previous moment before the distance update time interval to the current moment to the current moment;
[0018] The determining of the user offset based on the user offset distance and the step count information includes:
[0019] Use the first number of exercise steps counted at the current moment and the second number of exercise steps counted at the previous moment before the update time interval to calculate the third number of exercise steps of the user from the previous moment before the distance update time interval to the current moment;
[0020] Obtain the vertical coordinate point of the corresponding coordinate point of the first longitude and latitude in the plane coordinate system, and determine the chord value of the angle of the triangle formed in the plane rectangular coordinate system according to the vertical coordinate point;
[0021] Determine the user offset according to the first number of exercise steps, the second user offset distance, the third number of exercise steps, and the chord value of the angle of the formed triangle.
[0022] Optionally, the chord values of the angles include the sine value of the first angle, the cosine value of the second angle, and the tangent value of the third angle; determining the user offset according to the second user offset distance, the third number of movement steps, and the chord values of the angles of the formed triangle includes:
[0023] Calculate the user offset by using the sum of the product of the first number of movement steps and the sine value of the first angle, the product of the third number of movement steps and the cosine value of the second angle, and the product of the second user offset distance and the tangent value of the third angle.
[0024] Optionally, generating a login token according to the user login information and the user offset includes:
[0025] Obtain the user login account, user login password, the movement direction where the user is located at the current moment, and the current moment in the user login information;
[0026] Convert the current moment to the current time in milliseconds, and splice the user login account, user login password, the movement direction where the user is located at the current moment, the current time in milliseconds, and the user offset to obtain the encrypted content;
[0027] Encrypt the encrypted content according to a preset encryption method to generate a login token.
[0028] Optionally, the login token uses the update time interval as the login validity period; performing login verification according to the generated login token includes:
[0029] Within the login validity period, if the login request sent by the user terminal carries the generated login token, the login verification passes.
[0030] An embodiment of the present invention also discloses a login verification device based on coordinate offset, which is applied to a server. The device includes:
[0031] A user offset determination module, configured to obtain user data information and determine a user offset according to the user data information; the user offset is used to represent the coordinate offset of the user during the update time interval;
[0032] A token generation module, configured to obtain user login information and generate a login token according to the user login information and the user offset;
[0033] A login verification module, configured to perform login verification according to the generated login token.
[0034] Optionally, the user data information includes the longitude and latitude information and the number of steps information where the user is located; the user offset determination module includes:
[0035] A user offset distance determination sub-module, configured to determine a user offset distance according to the longitude and latitude information of the user;
[0036] A user offset determination sub-module, configured to determine a user offset according to the user offset distance and the step information.
[0037] Optionally, the longitude and latitude information of the user includes the first longitude and latitude where the user is located at the current moment and the second longitude and latitude where the user was located at the previous moment before the distance update time interval, and the step information includes the first number of movement steps counted at the current moment and the second number of movement steps counted at the previous moment before the update time interval;
[0038] The user offset distance determination sub-module includes:
[0039] A coordinate system construction unit, configured to construct a plane rectangular coordinate system with the second longitude and latitude as the origin;
[0040] A first user offset distance determination unit, configured to calculate, in the plane rectangular coordinate system, a first user offset distance of the user from the previous moment before the distance update time interval to the current moment by using the first longitude and latitude and the second longitude and latitude;
[0041] A second user offset distance determination unit, configured to randomly select any moment within the time period from the previous moment before the distance update time interval to the current moment, and calculate a second user offset distance of the user from the selected moment to the previous moment before the distance update time interval by using the first user offset distance, the current moment, and the selected moment.
[0042] Optionally, the user offset distance includes a second user offset distance from any moment selected within the time period from the previous moment before the distance update time interval to the current moment to the current moment;
[0043] The user offset determination sub-module includes:
[0044] A third number of movement steps determination unit, configured to calculate a third number of movement steps of the user from the previous moment before the distance update time interval to the current moment by using the first number of movement steps counted at the current moment and the second number of movement steps counted at the previous moment before the update time interval;
[0045] An angle chord value determination unit, configured to obtain a vertical coordinate point of the coordinate point corresponding to the first longitude and latitude in the plane coordinate system, and determine an angle chord value of a triangle formed in the plane rectangular coordinate system according to the vertical coordinate point;
[0046] A user offset determination unit, configured to determine a user offset according to the first number of movement steps, the second user offset distance, the third number of movement steps, and the chord value of the angle of the formed triangle.
[0047] Optionally, the chord value of the angle includes a first angle sine value, a second angle cosine value, and a third angle tangent value; the user offset determination unit includes:
[0048] A user offset determination subunit, configured to calculate the user offset by using the sum of the product of the first number of movement steps and the first angle sine value, the product of the third number of movement steps and the second angle cosine value, and the product of the second user offset distance and the third angle tangent value.
[0049] Optionally, the token generation module includes:
[0050] A user login information acquisition sub-module, configured to acquire the user login account, the user login password, the movement direction where the user is located at the current moment, and the current moment in the user login information;
[0051] An encrypted content generation sub-module, configured to convert the current moment into the current time millisecond value, and splice the user login account, the user login password, the movement direction where the user is located at the current moment, the current time millisecond value, and the user offset to obtain encrypted content;
[0052] A token generation sub-module, configured to encrypt the encrypted content according to a preset encryption method to generate a login token.
[0053] Optionally, the login token uses the update time interval as the login validity period; the login verification module includes:
[0054] A login verification sub-module, configured to, within the login validity period, if the login request sent by the user terminal carries the generated login token, the login verification passes.
[0055] An embodiment of the present invention also discloses an electronic device, including: a processor, a memory, and a computer program stored on the memory and capable of running on the processor, where when the computer program is executed by the processor, any one of the coordinate-offset-based login verification methods is implemented.
[0056] An embodiment of the present invention also discloses a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any one of the coordinate-offset-based login verification methods is implemented.
[0057] The embodiments of the present invention have the following advantages:
[0058] In an embodiment of the present invention, the server can obtain user data information, determine a user offset based on the obtained user data information, and the determined user offset can be used to represent the coordinate offset of the user during the update time interval. At this time, a login token can be generated by encryption based on the user login information and the user offset representing the coordinate offset for login verification of the user terminal. The data used to generate the login token is related to the user data information, ensuring the randomness of the generated login token, the uncertainty of the user data information based on which the user coordinate offset is determined, and also ensuring the uncrackability of the encrypted data, thereby improving the security of user login verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is a flowchart of the steps of an embodiment of a login verification method based on coordinate offset of the present invention;
[0060] Figure 2 is a flowchart of the steps of another embodiment of a login verification method based on coordinate offset of the present invention;
[0061] Figure 3 is a schematic diagram of the process of generating a token provided by an embodiment of the present invention;
[0062] Figure 4 is a schematic diagram of the implementation of obtaining user data information provided by an embodiment of the present invention;
[0063] Figure 5 is an application scenario diagram of login verification based on coordinate offset provided by an embodiment of the present invention;
[0064] Figure 6 is a structural block diagram of an embodiment of a login verification device based on coordinate offset of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0065] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0066] With the development of the mobile Internet, in the information age, the value of user personal information and enterprise asset data is relatively high. Ensuring the security of user login accounts is of utmost importance for the development of Internet products, which requires Internet products to consider the security of user login accounts and ensure high security of user login accounts. To ensure the security of user login accounts, a generated login token Token is usually introduced for login verification when the user logs in using the user login account at the user terminal.
[0067] One of the core ideas of the embodiments of the present invention is to use the user offset representing the user coordinate offset as the relevant data for generating the login token. The data used to generate the login token is related to the user data information, which can ensure the randomness of the generated login token and increase the difficulty of cracking the login token. Moreover, the user data information may include the longitude and latitude information and step information of the user. Based on the different daily travel modes of the user and the uncertainty of data such as steps and locations, the uncrackability of the encrypted data can be ensured, and the security of user login verification can be improved. Further, based on the process of generating the login token by the user through a series of algorithms, the login token can be periodically updated according to the set update time interval. While enhancing the security of the login token, it can also ensure the non-repeatability of the generated login token. And even if the encrypted ciphertext is obtained by various means, the user's account password information cannot be cracked through traditional encryption methods on the market, increasing the randomness and cracking difficulty of the encrypted data, and significantly improving the security of the encrypted data. In addition, in order not to violate the user's personal privacy, the user data information used in the process of generating the login token is mainly collected based on the update time interval, that is, only the data at the current moment and the data used at the last moment of data update are obtained, and the user data information is not recorded in real time. Moreover, the token generation algorithm proposed in the embodiments of the present invention can reduce the generation cost of the login token and save system resources.
[0068] Refer to Figure 1 , which shows the step flowchart of an embodiment of the login verification method based on coordinate offset of the present invention, applied to the server side, and specifically may include the following steps:
[0069] Step 101, obtain user data information and determine the user offset according to the user data information;
[0070] In the embodiments of the present invention, the data used to generate the login token is related to the user data information, which can ensure the randomness of the generated login token and increase the difficulty of cracking the login token. At this time, the user offset representing the user coordinate offset can be used as the relevant data for generating the login token. Based on the different daily travel modes of the user in the user coordinate offset and the uncertainty of data such as steps and locations, the uncrackability of the encrypted data can be ensured, and the security of user login verification can be improved.
[0071] In an embodiment of the present invention, the user offset representing the user coordinate offset can be determined through the obtained user data information. The obtained user data information may be data related to the user coordinate offset, such as the longitude and latitude information and step information of the user, so as to determine the user offset based on the data related to the coordinate offset.
[0072] Among them, the determined user offset can be used to represent the coordinate offset of the user during the update time interval. Then, in the acquired user data information, the acquired longitude and latitude information may include the first longitude and latitude where the user is located at the current moment and the moment before the duration of the current distance from the update time interval, that is, the second longitude and latitude where the user was located at the previous moment. The acquired step information may include the first number of exercise steps counted at the current moment and the moment before the duration of the current distance from the update time interval, that is, the second number of exercise steps counted at the previous moment. That is, when calculating the user offset using the user data information, the user data information used is the data related to the user's coordinate offset at the current moment and the moment before the duration of the current distance from the update time interval, that is, the previous moment.
[0073] It should be noted that in order not to infringe on the user's personal privacy, the user data information used in the process of generating the login token is mainly collected based on the update time interval. That is, only the data at the current moment and the data used at the previous data update moment are acquired, and the user data information is not recorded in real time. Moreover, the collection behavior of the user data information based on the update time interval is carried out with the user's knowledge and permission.
[0074] In addition, the update time interval can not only refer to the time interval for collecting user data information, but also refer to the update time of the subsequently generated login token, and can also refer to the login validity period of the generated login token. For the specific setting of the update time interval, it can be mainly set based on the actual business situation, and the embodiments of the present invention do not limit this.
[0075] Step 102, obtain user login information, and generate a login token according to the user login information and the user offset;
[0076] After obtaining the user offset generated based on the information related to the user's offset position, in addition to using the user offset representing the coordinate offset of the user during the update time interval as the relevant data for generating the login token, the user login information can also be obtained, and the user login information and the user offset are used as the relevant data for generating the login token at the same time.
[0077] Among them, the acquired user login information may include, in addition to the user login account and user login password that are conventionally required when the user terminal logs in, other data that also belongs to the data related to the user's coordinate offset, such as the movement direction where the user is located at the current moment, the current moment, etc., so as to further ensure the uncrackability of the encrypted data based on the uncertainty of these data and improve the security of user login verification.
[0078] In practical applications, in the process of encrypting and generating a login token based on user login information and user offset, it can be generated by splicing the user login information with the determined user offset and encrypting the spliced content.
[0079] In a preferred embodiment, the generated login token has a login validity period set to be the same as the update time interval. At this time, the generated login token can be updated based on the update time interval, and the login token that is not within the login validity period becomes invalid. Exemplarily, assuming that the set update time interval is one hour, then the generated login token will be updated every hour. Specifically, user data information can be re-collected every hour, and a login token can be re-generated according to the re-collected user data information.
[0080] Step 103, perform login verification according to the generated login token.
[0081] After generating the login token, the user side can be logged in and verified according to the generated login token. Since the data used to generate the login token is related to the user data information, it ensures the randomness of the generated login token, the uncertainty of the user data information based on the determined user coordinate offset, and also ensures the uncrackability of the encrypted data, improving the security of user login verification.
[0082] In practical applications, after the server generates the login token, it can cache the generated login token and return the login token to the user side. At this time, when the user side logs in with the user login account and user login password, the sent login request usually can carry the login token generated by the server. When the server receives the login request, it can determine whether the login request carries a login token and whether the carried login token is within the login validity period, that is, whether the carried login token is consistent with the cached login token by the server. At this time, within the login validity period, if the login request sent by the user side carries the generated login token, it is determined that the current login verification of the user side passes.
[0083] In the embodiment of the present invention, the server can obtain user data information and determine the user offset according to the obtained user data information. The determined user offset can be used to represent the coordinate offset of the user during the update time interval. At this time, a login token can be encrypted and generated according to the user login information and the user offset used to represent the coordinate offset for logging in and verifying the user side. The data used to generate the login token is related to the user data information, which ensures the randomness of the generated login token, the uncertainty of the user data information based on the determined user coordinate offset, and also ensures the uncrackability of the encrypted data, improving the security of user login verification.
[0084] Reference Figure 2 , a step flowchart of another login verification method based on coordinate offset according to the present invention is shown, which is applied to the server side and may specifically include the following steps:
[0085] Step 201, determine the user offset distance according to the longitude and latitude information where the user is located;
[0086] In the embodiments of the present invention, the data used to generate the login token is related to the user data information, which can ensure the randomness of the generated login token and increase the difficulty of cracking the login token. At this time, the user offset representing the user's coordinate offset can be used as the relevant data for generating the login token. Based on the different daily travel modes of the user in the user coordinate offset and the uncertainty of data such as the number of steps and locations, the uncrackability of the encrypted data is ensured, and the security of user login verification is improved.
[0087] Specifically, referring to Figure 3 , a schematic diagram of the process of generating a token provided by the embodiments of the present invention is shown. The user offset representing the coordinate offset can be determined through the obtained user data information. The obtained user data information can be data related to the user coordinate offset, such as the longitude and latitude information of the user, the number of steps information, etc., so as to determine the user offset based on the data related to the coordinate offset.
[0088] The determined user offset can be used to represent the user's coordinate offset during the update time interval. Then, among the obtained user data information, the obtained longitude and latitude information may include the first longitude and latitude where the user is located at the current moment and the moment before the duration of the current distance update time interval, that is, the second longitude and latitude where the user was located at the previous moment, and the obtained number of steps information may include the first number of exercise steps counted at the current moment and the moment before the duration of the current distance update time interval, that is, the second number of exercise steps counted at the previous moment. That is, when calculating the user offset using the user data information, the user data information used is the data related to the user coordinate offset at the current moment and the moment before the duration of the current distance update time interval, that is, the previous moment.
[0089] It should be noted that in order not to infringe on the user's personal privacy, the user data information used in the process of generating the login token is mainly collected based on the update time interval, that is, only the data at the current moment and the data used at the previous moment of data update are obtained, and the user data information is not recorded in real time, and the collection behavior of the user data information based on the update time interval is carried out with the user's knowledge and permission.
[0090] To determine the user offset, first, the user offset distance related to the user location offset can be determined, and the user offset distance during the time period from the current moment to the moment before the current distance update time interval, that is, the previous moment, can be calculated. Specifically, the longitude and latitude information of the user's location can be obtained and determined through the first longitude and latitude where the user is located at the current moment and the second longitude and latitude where the user was located at the moment before the current distance update time interval, that is, the previous moment.
[0091] Specifically, as Figure 4 shown, a plane rectangular coordinate system can be constructed with the corresponding coordinate point of the second longitude and latitude as the origin. At this time, in the plane rectangular coordinate system, using the first longitude and latitude and the second longitude and latitude, the first user offset distance of the user from the moment before the current distance update time interval, that is, the previous moment, to the current moment can be calculated. At this time, to avoid the situation where the user movement distances overlap, randomness can be increased based on any randomly selected moment to increase the hashability of the subsequent generated login token. Specifically, it can be manifested as randomly selecting any moment within the time period from the moment before the current distance update time interval, that is, the previous moment, to the current moment, and using the first user offset distance, the current moment, and the randomly selected moment to calculate the second user offset distance of the user from the randomly selected moment to the previous moment.
[0092] Exemplarily, assume that the current position of the user, that is, the coordinate point corresponding to the first longitude and latitude where the user is located at the current moment t1 is point a, and its first longitude and latitude are (x1, y1), and the previous moment is t2. Assume that the set update time interval is one hour, and t2 can be manifested as the moment one hour before the current time. At this moment, the coordinate point corresponding to the second longitude and latitude where the user is located can be point b, and its second longitude and latitude are (x2, y2). Then, a plane rectangular coordinate system can be constructed with point b as the origin, and then the vertical coordinate point of point a in the plane rectangular coordinate system, that is, point c, can be taken to form a right triangle to determine the first user offset distance during the time period from t2 to t1, which is √(x1 2 +y1 2 ).
[0093] At this time, any moment t3 can be randomly selected within the time interval from t2 to t1. Assume that the user moves at a uniform speed during this time. Then, the second user offset distance of the user during the time period from t2 to t3 can be manifested as (t3 - t2) / (t1 - t2) * √(x1 2 +y1 2 ).
[0094] It should be noted that if the positions of the first longitude and latitude obtained by the user at time t1 and the second longitude and latitude obtained by the user at time t2 have not changed, the central position of the city or region where the user is located can be used as point b, that is, as the origin of the constructed plane rectangular coordinate system.
[0095] Step 202: Determine the user offset according to the user offset distance and step information.
[0096] As Figure 3 shown, in order to determine the user offset, in addition to calculating the user offset distance, the step information can also be processed to determine the user offset based on the processed data and the user offset distance.
[0097] Specifically, the first number of movement steps counted at the current moment and the second number of movement steps counted at the previous moment can be used to calculate the third number of movement steps of the user from the previous moment to the current moment. Exemplarily, assume that the first number of movement steps counted at the current moment t1 is Z1, the previous moment is t2, and assume that the set update time interval is one hour. t2 can be represented as the moment one hour before the current time. The second number of movement steps counted at this moment is Z2. At this time, the first number of movement steps Z1 can be subtracted from the second number of movement steps Z2 to calculate the third number of movement steps, that is, (Z1 - Z2).
[0098] Among them, the initial moment for counting the number of movement steps can be 00:00 in the early morning, that is, the number of movement steps is counted starting from the early morning to obtain the first number of movement steps Z1 counted at the current moment t1 and the second number of movement steps Z2 counted at the previous moment t2. It should be noted that the user's travel mode may be by car during the time period from t2 to t1. At this time, the first number of movement steps Z1 and the second number of movement steps Z2 have not changed. When determining the user offset subsequently, the second number of movement steps Z2 can be directly used without calculating the third number of movement steps. It should be noted that the embodiments of the present invention do not obtain the specific travel mode of the user, but focus on reflecting the relevant data of the user's point offset.
[0099] As Figure 4 shown, the vertical coordinate point c of the corresponding coordinate point (i.e., point a) of the first longitude and latitude in the plane coordinate system can also be obtained. Point c can form a right triangle with point a and point b. At this time, the chord value of the angle of the triangle formed in the plane rectangular coordinate system can be determined according to the vertical coordinate point, so as to determine the user offset according to the first number of movement steps, the second user offset distance, the third number of movement steps, and the chord value of the angle of the formed triangle.
[0100] It should be noted that the vertical coordinate point c of point a obtained in the plane coordinate system can not only be shown as Figure 4The vertical coordinate point c (x1, 0) of point a shown is perpendicular to the horizontal axis, and it can also be expressed as the vertical coordinate point c (0, y1) of point a perpendicular to the vertical axis.
[0101] The angular chord values of the formed triangle can include the sine value of the first angle, the cosine value of the second angle, and the tangent value of the third angle. Taking the vertical coordinate point c (x1, 0) of point a perpendicular to the horizontal axis as an example, as Figure 4 shown, the formed right triangle is △ABC. At this time, ∠abc can be denoted as ∠d, ∠acb can be denoted as ∠f, and ∠bac can be denoted as ∠e. Then the sine value of the first angle can be expressed as the sine value of ∠d (i.e., sin∠d), the cosine value of the second angle can be expressed as the cosine value of ∠f (i.e., cos∠f), and the tangent value of the third angle can be expressed as the tangent value of ∠e (i.e., tan∠e).
[0102] Among them, the first angle ∠d can be expressed as the included angle formed by side AB and side BC, the second angle ∠f can be expressed as the included angle formed by side AC and side BC, and the third angle ∠e can be expressed as the included angle formed by side AB and side AC. It should be noted that the determination method for the first angle, the second angle, and the third angle is applicable to the case where the vertical coordinate point c is located on the horizontal axis and the vertical axis.
[0103] In the embodiment of the present invention, after calculating the third number of movement steps (Z1 - Z2) and obtaining the angular chord values of the formed triangle, the product of the first number of movement steps Z1 and the sine value of the first angle sin∠d, the product of the third number of movement steps (Z1 - Z2) and the cosine value of the second angle cos∠f, and the product of the second user offset distance (t3 - t2) / (t1 - t2)*√(x1 2 + y1 2 ) and the tangent value of the third angle tan∠e can be used to calculate the user offset.
[0104] That is, the formula for calculating the user offset can be expressed as:
[0105] Z1*sin∠d + (Z1 - Z2)*cos∠f + ((t3 - t2) / (t1 - t2)*√(x1 2 + y1 2 ))*tan∠e
[0106] Step 203: Concatenate the user login account, user login password, the movement direction of the user at the current moment, and the current moment in the user login information with the user offset, and encrypt to generate a login token;
[0107] After obtaining the user offset generated based on the information related to the user's offset position, in addition to using the user offset representing the coordinate offset of the user during the update time interval as the relevant data for generating the login token, the user login information can also be obtained and used as the relevant data for generating the login token together with the user offset.
[0108] The obtained user login information may include, in addition to the user login account and user login password required conventionally when the user terminal logs in, other data also related to the user's coordinate offset, such as the movement direction and the current moment in which the user is located at the current moment, etc., so as to further ensure the uncrackability of the encrypted data based on the uncertainty of these data and improve the security of user login verification.
[0109] In practical applications, in the process of encrypting and generating the login token according to the user login information and the user offset, the user login information can be concatenated with the determined user offset, and the concatenated content can be encrypted and generated.
[0110] Specifically, the user login account, user login password, movement direction in which the user is located at the current moment, and the current moment in the user login information can be obtained, and the current moment can be converted into the current time in milliseconds. Specifically, the hours and minutes included in the current moment can be respectively converted into seconds, and the sum of the seconds included in the current moment and the converted seconds can be added and then converted into milliseconds; then the user login account, user login password, movement direction in which the user is located at the current moment, and the current time in milliseconds can be concatenated to obtain the encrypted content, that is, it is expressed as user login account + user login password + movement direction in which the user is located at the current moment + current moment in milliseconds + Z1*sin∠d+(Z1-Z2)*cos∠f+((t3-t2) / (t1-t2)*√(x1 2 +y1 2 ))*tan∠e.
[0111] Among them, the movement direction in which the user is located at the current moment can be mainly realized by putting eight directions such as due east (i.e., the positive half-axis of the X-axis), due west (i.e., the negative half-axis of the X-axis), due south (i.e., the negative half-axis of the Y-axis), due north (i.e., the positive half-axis of the Y-axis), northeast (i.e., the first quadrant), southeast (i.e., the second quadrant), southwest (i.e., the third quadrant), and northwest (i.e., the fourth quadrant) into an array and determining the corresponding movement direction by judging the quadrant to which point a belongs in the plane rectangular coordinate system.
[0112] It should be noted that the determination of the movement direction is based on the quadrant where the current position is located. The established array is mainly established for the direction where the user is located, and it can be mainly used to store the movement direction of the user at different update times, so as to facilitate the acquisition operation of the corresponding running direction when generating tokens. For example, assuming that the movement direction of the user at time t2 is the northeast direction, then the array can be expressed as (0,0,0,0,1,0,0,0); at the next update time t1, if the movement direction of the user is the southeast direction, the values in the array are also changed accordingly. In addition to the above method of establishing an array for storage, other methods can also be used to store the movement direction, and the embodiments of the present invention do not limit this.
[0113] Then, in the specific implementation, the encrypted content can be encrypted according to a preset encryption method to generate a login token. Specifically, the MD5 algorithm (Message-Digest Algorithm 5, an information-digest algorithm used to ensure the integrity and consistency of information transmission) can be used to encrypt and generate a login token for login verification based on the generated login token.
[0114] Step 204, within the login validity period, if the login request sent by the user terminal carries the generated login token, the login verification passes.
[0115] After generating the login token, the user terminal can be logged in and verified according to the generated login token. Since the data used to generate the login token is related to the user data information, it ensures the randomness of the generated login token, the uncertainty of the user data information based on the determined user coordinate offset, and can also ensure the uncrackability of the encrypted data, improving the security of user login verification.
[0116] In practical applications, after the server generates the login token, it can cache the generated login token and return the login token to the user terminal. At this time, when the user terminal logs in with the user login account and user login password, the login request sent usually carries the login token generated by the server. When the server receives the login request, it can determine whether the login request carries a login token and whether the carried login token is within the login validity period, that is, whether the carried login token is consistent with the cached login token. At this time, within the login validity period, if the login request sent by the user terminal carries the generated login token, it is determined that the current login verification of the user terminal passes.
[0117] In a preferred embodiment, the generated login token has a set login validity period that is the same as the update time interval. At this time, the generated login token can be updated based on the update time interval, and the login token that is not within the login validity period becomes invalid. Exemplarily, assuming that the set update time interval is one hour, then the generated login token will be updated every hour. Specifically, user data information can be re-collected every hour, and a login token can be regenerated according to the re-collected user data information, that is, the specific implementation manners of the foregoing steps 201 to 203 are repeated based on the set update time interval.
[0118] It should be noted that the update time interval can not only refer to the time interval for collecting user data information, but also refer to the update time of the subsequently generated login token, and can also refer to the login validity period of the generated login token. For the specific setting of the update time interval, it can be mainly set based on the actual business situation. In this regard, the embodiments of the present invention do not impose any restrictions.
[0119] In the embodiments of the present invention, the server can obtain user data information and determine a user offset according to the obtained user data information. The determined user offset can be used to represent the coordinate offset of the user during the update time interval. At this time, a login token can be generated by encryption according to the user login information and the user offset used to represent the coordinate offset for login verification of the user terminal. The data used to generate the login token is related to the user data information, which ensures the randomness of the generated login token, the uncertainty of the user data information based on which the user coordinate offset is determined, and can also ensure the uncrackability of the encrypted data, improving the security of user login verification.
[0120] Refer to Figure 5 , which shows a schematic diagram of an application scenario of login verification based on coordinate offset provided by the embodiments of the present invention, involving a user terminal 510 and a server 511. The user terminal 510 and the server 511 are communicatively connected. Among them, the user terminal 510 can initiate a login request to the server 511 by inputting a user login account and a user login password. At this time, the server 511 needs to perform login verification on the login request initiated by the user terminal. Its login verification is not achieved by accessing the database to verify the account password, but by the login token Token carried in the login request.
[0121] In a specific implementation, the server 511 can cache the generated login token and return the login token to the client 510. At this time, when the client logs in with the user login account and user login password, the sent login request usually can carry the login token generated by the server 511. When the server 511 receives the login request, it can determine whether the login request carries a login token and whether the carried login token is within the login validity period, that is, whether the carried login token is consistent with the cached login token by the server 511. At this time, within the login validity period, if the login request sent by the client 510 carries the generated login token, it can be determined that the current login verification of the client 510 is passed.
[0122] Among them, for the generation process of the login token, it can be as Figure 3 shown. The data used to generate the login token is related to the user data information, which can ensure the randomness of the generated login token and increase the difficulty of cracking the login token. At this time, the user offset representing the user coordinate offset can be used as the relevant data for generating the login token. Based on the different daily travel modes of the user in the user coordinate offset and the uncertainty of data such as the number of steps and locations, the uncrackability of the encrypted data can be ensured, and the security of user login verification can be improved.
[0123] Exemplarily, assume that the update time interval is one hour, the current moment t1 is 2022-06-23 08:13:26, the current location of the user, that is, the coordinate point corresponding to the first longitude and latitude where the user is located at the moment t1 is point a, and its first longitude and latitude are (116.3852581°, 40.0106419°), and the first counted number of movement steps Z1 is 3536; while the user's previous moment t2 is 2022-06-23 07:13:26, and at the moment t2, the coordinate point corresponding to the second longitude and latitude where the user is located is point b, and its second longitude and latitude are (116.3727537°, 39.9978197°), and the second counted number of movement steps Z2 is 2679.
[0124] At this time, it can be as Figure 4As shown in the figure, a plane rectangular coordinate system is constructed with point b as the origin. Then, the first user offset distance of the user in the past hour can be calculated as √(116.3852581^2 + 40.0106419^2). At this time, any moment t3 can be randomly selected between two moments t1 and t2. For example, t3 is 2022-06-23 07:36:11. Assuming the user moves at a constant speed within this time interval, the offset distance of the user from 2022-06-23 07:13:26 (i.e., t2) to 2022-06-23 07:36:11 (i.e., t3) is (07:36:11 - 07:13:26) / (08:13:26 - 07:13:26) * √(116.3852581^2 + 40.0106419^2); and point b is in the first quadrant. It is determined that the movement direction of the user at the current moment is the northeast direction, and the number of steps Z1 - Z2 of the user within the update time interval (i.e., within one hour) is 857. At this time, the user login account, user login password, the movement direction of the user at the current moment, and the millisecond value of the current time can be concatenated to obtain the encrypted content M, which is 123456789 (user login account) + 88888888 (user login password) + northeast + 1655943206 (millisecond value of the current moment) + 3536 * sin∠d + 857 * cos∠f + (07:36:11 - 07:13:26) / (08:13:26 - 07:13:26) * √(116.3852581^2 + 40.0106419^2) * tan∠e.
[0125] After encrypting M by the MD5 algorithm, the server 511 can generate a login token v1sa65g16ad1b6fd6z1b6df6SDFcDvDV5v61V6v1d6515165v61vs74cs7df1v6s1vG16G1sd6VDv11v66VSvdfh1a5r6h4a61g6dfz1b6z54bfz61VZD45FUBubyubuVCVK161. The server caches the encrypted login token and returns it to the client for login verification.
[0126] In practical applications, the generated login token has a login validity period set to be the same as the update time interval. At this time, the generated login token can be updated based on the update time interval, and the login token that is not within the login validity period becomes invalid. Exemplarily, assuming the set update time interval is one hour, then the generated login token will be updated every hour. Specifically, user data information can be re - collected every hour, and a new login token can be generated according to the re - collected user data information.
[0127] It should be noted that with the increase in the number of users, various Internet products have also increased. The login verification method based on coordinate offset proposed in the embodiments of the present invention can be widely applied to various Internet products, especially on the APP side, and has strong market potential.
[0128] In the embodiments of the present invention, the user offset representing the coordinate offset of the user is used as the relevant data for generating the login token. The data used for generating the login token is related to the user data information, which can ensure the randomness of the generated login token and increase the difficulty of cracking the login token. Moreover, the user data information may include the longitude and latitude information and step information of the user. Based on the different daily travel modes of the user and the uncertainty of data such as steps and locations, the uncrackability of the encrypted data can be ensured, and the security of user login verification can be improved. Further, based on the process of generating the login token by the user through a series of algorithms, the login token can be updated regularly according to the set update time interval. While enhancing the security of the login token, it can also ensure the non-repeatability of the generated login token. And even if the encrypted ciphertext is obtained by various means, it is impossible to crack and obtain the user's account password information through traditional encryption methods on the market, increasing the randomness and cracking difficulty of the encrypted data and significantly improving the security of the encrypted data. In addition, in order not to violate the user's personal privacy, the user data information used in the process of generating the login token is mainly collected based on the update time interval, that is, only the data at the current moment and the data used at the last moment of data update are obtained, and the user data information is not recorded in real time. Moreover, the token generation algorithm proposed in the embodiments of the present invention can reduce the generation cost of the login token and save system resources.
[0129] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0130] Refer to Figure 6 , which shows a structural block diagram of an embodiment of a login verification device based on coordinate offset of the present invention, applied to a server, and specifically may include the following modules:
[0131] A user offset determination module 601, configured to obtain user data information and determine a user offset according to the user data information; the user offset is used to represent the coordinate offset of the user during the update time interval.
[0132] A token generation module 602, configured to obtain user login information and generate a login token according to the user login information and the user offset.
[0133] A login verification module 603, configured to perform login verification according to the generated login token.
[0134] In an embodiment of the present invention, the user data information includes longitude and latitude information and step count information of the user; the user offset determination module 601 may include the following sub-modules:
[0135] A user offset distance determination sub-module, configured to determine a user offset distance according to the longitude and latitude information of the user.
[0136] A user offset determination sub-module, configured to determine a user offset according to the user offset distance and the step count information.
[0137] In an embodiment of the present invention, the longitude and latitude information of the user includes the first longitude and latitude where the user is located at the current moment and the second longitude and latitude where the user was located at the previous moment before the distance update time interval; the step count information includes the first number of exercise steps counted at the current moment and the second number of exercise steps counted at the previous moment before the update time interval;
[0138] The user offset distance determination sub-module may include the following units:
[0139] A coordinate system construction unit, configured to construct a plane rectangular coordinate system with the second longitude and latitude as the origin.
[0140] A first user offset distance determination unit, configured to calculate a first user offset distance of the user from the previous moment before the distance update time interval to the current moment in the plane rectangular coordinate system by using the first longitude and latitude and the second longitude and latitude.
[0141] A second user offset distance determination unit, configured to randomly select any moment within the time period from the previous moment before the distance update time interval to the current moment, and calculate a second user offset distance of the user from the selected moment to the previous moment before the distance update time interval by using the first user offset distance, the current moment, and the selected moment.
[0142] In an embodiment of the present invention, the user offset distance includes a second user offset distance from any moment selected within the time period from the previous moment before the distance update time interval to the current moment to the current moment;
[0143] The user offset determination sub-module may include the following units:
[0144] A third movement step count determination unit, configured to calculate a third movement step count of the user from the previous moment before the update time interval to the current moment by using the first movement step count counted at the current moment and the second movement step count counted at the previous moment before the update time interval.
[0145] An angular chord value determination unit, configured to obtain a vertical coordinate point of the corresponding coordinate point of the first longitude and latitude in the plane coordinate system, and determine an angular chord value of a triangle formed in the plane rectangular coordinate system according to the vertical coordinate point.
[0146] A user offset determination unit, configured to determine a user offset according to the first movement step count, the second user offset distance, the third movement step count, and the angular chord value of the formed triangle.
[0147] In an embodiment of the present invention, the angular chord value includes a first angle sine value, a second angle cosine value, and a third angle tangent value; the user offset determination unit may include the following sub-units:
[0148] A user offset determination sub-unit, configured to calculate a user offset by using the sum of the product of the first movement step count and the first angle sine value, the product of the third movement step count and the second angle cosine value, and the product of the second user offset distance and the third angle tangent value.
[0149] In an embodiment of the present invention, the token generation module 602 may include the following sub-modules:
[0150] A user login information acquisition sub-module, configured to acquire a user login account, a user login password, a movement direction of the user at the current moment, and the current moment in the user login information.
[0151] An encrypted content generation sub-module, configured to convert the current moment into a current time millisecond value, and splice the user login account, the user login password, the movement direction of the user at the current moment, the current time millisecond value, and the user offset to obtain encrypted content.
[0152] A token generation sub-module, configured to encrypt the encrypted content according to a preset encryption method to generate a login token.
[0153] In an embodiment of the present invention, the login token uses the update time interval as a login validity period; the login verification module 603 may include the following sub-modules:
[0154] A login verification sub-module, configured to, within the login validity period, if the login request sent by the user terminal carries the generated login token, then the login verification is passed.
[0155] The login verification device based on coordinate offset proposed in the embodiments of the present invention can obtain user data information, determine the user offset according to the obtained user data information, and the determined user offset can be used to represent the coordinate offset of the user during the update time interval. At this time, a login token can be generated by encrypting according to the user login information and the user offset used to represent the coordinate offset, so as to be used for login verification of the user terminal. The data used to generate the login token is related to the user data information, which ensures the randomness of the generated login token, the uncertainty of the user data information based on determining the user coordinate offset, and can also ensure the uncrackability of the encrypted data, improving the security of user login verification.
[0156] For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, please refer to the partial description of the method embodiments.
[0157] The embodiments of the present invention also provide an electronic device, including:
[0158] Including a processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, it implements each process of the above-mentioned method embodiment of login verification based on coordinate offset, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0159] The embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the processor, it implements each process of the above-mentioned method embodiment of login verification based on coordinate offset, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0160] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.
[0161] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0162] Embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in one or more flows Figure 1 one or more flows and / or blocks Figure 1 or in one or more blocks.
[0163] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in one or more flows Figure 1 one or more flows and / or blocks Figure 1 or in one or more blocks.
[0164] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more flows Figure 1 one or more flows and / or blocks Figure 1 or in one or more blocks.
[0165] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.
[0166] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising said element.
[0167] The above has introduced in detail a login verification method based on coordinate offset, a login verification device based on coordinate offset, a corresponding electronic device, and a corresponding computer storage medium provided by the present invention. Specific examples are used in this text to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A login verification method based on coordinate offset, characterized in that, applied to the server side, the method includes: Obtain user data information, and determine the user offset according to the user data information; the user offset is used to represent the coordinate offset of the user during the update time interval; Obtain user login information, and generate a login token according to the user login information and the user offset; Perform login verification according to the generated login token; wherein, the update time interval is determined by the time interval for collecting user data information, or the update time interval is determined by the update time of the subsequently generated login token, or the update time interval is determined by the login validity period of the generated login token.
2. The method according to claim 1, characterized in that, the user data information includes the longitude and latitude information and step information of the user; the determining of the user offset according to the user data information includes: Determine the user offset distance according to the longitude and latitude information of the user; Determine the user offset according to the user offset distance and the step information.
3. The method according to claim 2, characterized in that, the longitude and latitude information of the user includes the first longitude and latitude where the user is located at the current moment and the second longitude and latitude where the user was located at the previous moment before the update time interval, and the step information includes the first number of exercise steps counted at the current moment and the second number of exercise steps counted at the previous moment before the update time interval; the determining of the user offset distance according to the longitude and latitude of the user includes: Construct a plane rectangular coordinate system with the second longitude and latitude as the origin; In the plane rectangular coordinate system, use the first longitude and latitude and the second longitude and latitude to calculate the first user offset distance of the user from the previous moment before the update time interval to the current moment; Randomly select any moment within the time period from the previous moment before the update time interval to the current moment, and use the first user offset distance, the current moment, and the randomly selected moment to calculate the second user offset distance of the user from the randomly selected moment to the previous moment before the update time interval.
4. The method according to claim 3, characterized in that, the user offset distance includes the second user offset distance from any moment selected within the time period from the previous moment before the update time interval to the current moment to the current moment; the determining of the user offset according to the user offset distance and the step information includes: Use the first number of exercise steps counted at the current moment and the second number of exercise steps counted at the previous moment before the update time interval to calculate the third number of exercise steps of the user from the previous moment before the update time interval to the current moment; Obtain the vertical coordinate point of the corresponding coordinate point of the first longitude and latitude in the plane rectangular coordinate system, and determine the chord value of the angle of the triangle formed in the plane rectangular coordinate system according to the vertical coordinate point; Determine the user offset according to the first number of movement steps, the second user offset distance, the third number of movement steps, and the chord values of the angles of the formed triangle.
5. The method according to claim 4, wherein, the chord values of the angles include the sine value of the first angle, the cosine value of the second angle, and the tangent value of the third angle; the determining the user offset according to the second user offset distance, the third number of movement steps, and the chord values of the angles of the formed triangle includes: Calculate the user offset by using the sum of the product of the first number of movement steps and the sine value of the first angle, the product of the third number of movement steps and the cosine value of the second angle, and the product of the second user offset distance and the tangent value of the third angle.
6. The method according to claim 1, wherein, the generating the login token according to the user login information and the user offset includes: Obtain the user login account, user login password, the movement direction where the user is located at the current moment, and the current moment in the user login information; Convert the current moment into the current time in milliseconds, and splice the user login account, user login password, the movement direction where the user is located at the current moment, the current time in milliseconds, and the user offset to obtain the encrypted content; Encrypt the encrypted content according to a preset encryption method to generate a login token.
7. The method according to claim 1 or 6, wherein, the login token uses the update time interval as the login validity period; the performing login verification according to the generated login token includes: Within the login validity period, if the login request sent by the user terminal carries the generated login token, the login verification passes.
8. A login verification device based on coordinate offset, wherein, applied to the server, the device includes: A user offset determination module, configured to obtain user data information and determine the user offset according to the user data information; the user offset is used to represent the coordinate offset of the user during the update time interval; A token generation module, configured to obtain user login information and generate a login token according to the user login information and the user offset; A login verification module, configured to perform login verification according to the generated login token; wherein, the update time interval is determined by the time interval for collecting user data information, or the update time interval is determined by the update time of the subsequently generated login token, or the update time interval is determined by the login validity period of the generated login token.
9. An electronic device, wherein, includes: A processor, a memory, and a computer program stored on the memory and capable of running on the processor, and when the computer program is executed by the processor, it implements the coordinate-offset-based login verification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the coordinate-offset-based login verification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Verification method, verification device and verification system for network application accessing
CN106034104A