Verification code generation method, communication device and computer-readable storage medium

By generating a two-dimensional matrix verification code, the initial position of the active object is different from the position of the obstacle object, and the preset expected position is associated with the prompt object, which solves the problem of poor security of the existing verification code and achieves the security of the verification code.

CN115688080BActive Publication Date: 2025-08-26MIGU CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211320623.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-26
Publication Date
2025-08-26
Estimated Expiration
2042-10-26

AI Technical Summary

Technical Problem

The existing verification codes are poorly secure and are easily identified.

Method used

Generate and send a two-dimensional matrix verification code. The initial position of the active object is different from the position of the obstacle object. The preset expected position is associated with the prompt object, and the path from the active object to the preset expected position is generated through a random number sequence.

Benefits of technology

It enriches the content of the verification code, reduces the risk of being identified, and improves the security of the verification code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115688080B_ABST
    Figure CN115688080B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of verification technology, and provides a verification code receiving method, a verification code generating method, and a communication device to address the problem of poor verification code security. The method comprises: sending a verification code request to a server; and receiving a two-dimensional matrix verification code sent by the server in response to the verification code request. In the two-dimensional matrix verification code, the value corresponding to the initial position associated with an active object is different from the value corresponding to the position associated with any of a plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and a prompt object is preset to be associated with the expected position. In this way, the verification code content can be enriched, the risk of being recognized can be reduced, and the security of the verification code can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of verification technology, and in particular to a verification code generation method, a communication device, and a computer-readable storage medium. Background Art

[0002] In some scenarios, such as login and password modification, a verification code is required for improved security.

[0003] However, the common forms of verification codes currently generated are numbers, letters, a combination of numbers and letters, pictures containing specific elements, two-element arithmetic operations, sliding verification codes, etc. The current verification codes are relatively simple and easy to identify, that is, the security of the common verification codes currently is poor. Summary of the Invention

[0004] Embodiments of the present invention provide a verification code generation method, a communication device, and a computer-readable storage medium to solve the problem of poor security of verification codes.

[0005] In order to solve the above-mentioned technical problems, the present invention is achieved as follows:

[0006] In a first aspect, an embodiment of the present invention provides a verification code receiving method, comprising:

[0007] Send a verification code request to the server;

[0008] receiving a two-dimensional matrix verification code sent by the server in response to the verification code request, wherein, in the two-dimensional matrix verification code, a value corresponding to an initial position associated with an active object is different from a value corresponding to a position associated with any one of a plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and a preset expected position is associated with a prompt object.

[0009] In a second aspect, an embodiment of the present invention provides a verification code generation method, comprising:

[0010] Upon receiving a verification code request sent by a terminal, generating a random number sequence;

[0011] generating a first path from the moving object to a preset desired position in the matrix according to the random number sequence and the starting position of the moving object in the initial matrix;

[0012] generating a two-dimensional matrix verification code based on the first path and the initial matrix, wherein, in the two-dimensional matrix verification code, a value corresponding to the initial position associated with the active object is different from a value corresponding to a position associated with any one of the plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and the preset expected position is associated with a prompt object;

[0013] The two-dimensional matrix verification code is sent to the terminal.

[0014] In a third aspect, an embodiment of the present invention further provides a communication device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the verification code generation method as described above when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the verification code generation method described above are implemented.

[0016] In this embodiment, the verification code received by the terminal from the server is a two-dimensional matrix verification code. In addition, in the two-dimensional matrix verification code, the value corresponding to the initial position associated with the active object is different from the value corresponding to the position associated with any of the multiple obstacle objects. The values ​​corresponding to the positions associated with the multiple obstacles are the same, and a prompt object is preset to be associated with the expected position. In this way, the content of the verification code can be enriched, the risk of being identified can be reduced, and the security of the verification code can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in describing the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 is a flowchart of a verification code receiving method provided by an embodiment of the present invention;

[0019] Figure 2 is a schematic diagram of a two-dimensional grid provided by an embodiment of the present invention;

[0020] Figure 3 is a flow chart of a verification code generation method provided by an embodiment of the present invention;

[0021] Figure 4 This is one of the verification interface diagrams provided by the embodiment of the present invention;

[0022] Figure 5 This is the second verification interface diagram provided by an embodiment of the present invention;

[0023] Figure 6 This is the third verification interface diagram provided by an embodiment of the present invention;

[0024] Figure 7 This is the fourth verification interface diagram provided by an embodiment of the present invention;

[0025] Figure 8 This is the fifth verification interface diagram provided by the embodiment of the present invention;

[0026] Figure 9 This is the sixth verification interface diagram provided by the embodiment of the present invention;

[0027] Figure 10 This is the seventh verification interface diagram provided by the embodiment of the present invention;

[0028] Figure 11 This is the eighth verification interface diagram provided by the embodiment of the present invention;

[0029] Figure 12 is a structural diagram of a verification code receiving device provided by an embodiment of the present invention;

[0030] Figure 13 It is a structural diagram of a verification code generating device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0032] See also Figure 1 , Figure 1 is a flow chart of a verification code receiving method provided by an embodiment of the present invention, which can be executed by a terminal, such as Figure 1 As shown, the following steps are included:

[0033] Step 101: Send a verification code request to the server.

[0034] Verification is an important means of improving security. For example, during the login process, login verification can ensure login security. Verification using verification codes is an important method, and different verification code formats correspond to different verification processes. When verification is required, the user can operate on the terminal to generate a verification code request and send it to the server, requesting the server to issue the verification code.

[0035] A terminal can be a device capable of intelligent input and output and verification, such as a desktop computer or a mobile terminal. A mobile terminal can be a mobile phone, tablet computer, laptop computer, car computer, personal digital assistant (PDA), mobile internet device (MID), or wearable device. A server can be a server where the verification platform providing verification is located. The server can be implemented as a standalone server or a server cluster consisting of multiple servers.

[0036] Step 102: receiving a two-dimensional matrix verification code sent by the server in response to the verification code request;

[0037] Among them, in the two-dimensional matrix verification code, the value corresponding to the initial position associated with the active object is different from the value corresponding to the position associated with any obstacle object among the multiple obstacle objects, the values ​​corresponding to the positions associated with the multiple obstacles are the same, and the expected position is preset to be associated with the prompt object.

[0038] The verification code is in the form of a two-dimensional matrix, which can also be understood as a two-dimensional array. The received two-dimensional verification code is used by the terminal for verification input to adjust the two-dimensional verification code to achieve verification. It should be noted that the two-dimensional matrix verification code can be a verification code generated via a first path and an initial matrix, where the first path is a path from the active object generated in the initial matrix to a preset desired position via a random number sequence and the starting position of the active object in the initial matrix, and the random number sequence is a sequence generated in response to the verification code request.

[0039] In this embodiment, the verification code received by the terminal from the server is a two-dimensional matrix verification code. In addition, in the two-dimensional matrix verification code, the value corresponding to the initial position associated with the active object is different from the value corresponding to the position associated with any of the multiple obstacle objects. The values ​​corresponding to the positions associated with the multiple obstacles are the same, and a prompt object is preset to be associated with the expected position. In this way, the content of the verification code can be enriched, the risk of being identified can be reduced, and the security of the verification code can be improved.

[0040] In one embodiment, after receiving the two-dimensional matrix verification code sent by the server in response to the verification code request, the method further includes:

[0041] Generate a two-dimensional grid based on the two-dimensional matrix verification code. The size of the two-dimensional grid is the same as the size of the two-dimensional matrix verification code.

[0042] Display the verification interface;

[0043] The verification interface includes an intermediate subgrid of a two-dimensional grid, an active object, a prompt object, and a target obstacle object associated with an intermediate submatrix corresponding to the intermediate subgrid. The active object is located in an initial grid in the intermediate subgrid. The position of the initial grid in the two-dimensional grid matches the position of the initial position in the two-dimensional matrix verification code. The prompt object is located in a preset expected grid in the intermediate subgrid. The position of the preset expected grid in the two-dimensional grid matches the preset expected position in the two-dimensional matrix verification code. An obstacle is located in a grid in the intermediate subgrid. The number of rows of the intermediate subgrid is the same as the number of rows of the two-dimensional grid, and the obstacle is located between the first subgrid and the second subgrid of the two-dimensional grid.

[0044] For example, if the active object's associated position in the two-dimensional matrix verification code is row x, column y, then the grid where the active object is located in the two-dimensional grid is row x, column y. If the preset expected position is the last row, column z of the two-dimensional verification code matrix, then the preset expected grid is the last row, column z of the two-dimensional grid.

[0045] After receiving the two-dimensional matrix verification code, a verification interface may be displayed, in which the middle subgrid in the two-dimensional grid generated according to the two-dimensional matrix verification code may be displayed, such as Figure 2 As shown, the user can view the specific presentation of the active objects, target obstacles, and prompt objects in the middle sub-matrix of the two-dimensional matrix verification code in the verification interface, so that the user can perform verification input, etc. In one example, the first sub-grid and the second sub-grid are the same size and have the same number of rows as the two-dimensional matrix verification code.

[0046] In one embodiment, the verification interface further includes a plurality of mobile controls distributed on opposite sides of the middle subgrid, wherein one row of grids corresponds to two mobile controls, and the two mobile controls are distributed on opposite sides of the row of grids;

[0047] After the verification interface is displayed, it also includes:

[0048] receiving a user's ordered movement input sequence for at least part of a plurality of movement controls in the verification interface;

[0049] In response to a movement input sequence, the two-dimensional matrix verification code is adjusted according to a movement direction of the movement input sequence and row identifiers of at least some of the movement controls to obtain a first verification result matrix; wherein, after an object associated with a reference row grid moves a unit grid according to a reference movement direction, and after an active object in the reference row grid moves a unit grid according to the reference movement direction, if there is no obstacle in a target grid in a next row of grids and in the same column as the grid where the active object is located, the active object moves to the target grid, the reference row grid is the row grid corresponding to the row identifier of the reference movement control, the reference movement direction is the movement direction of the movement input of the reference movement control, and the reference movement control is any one of the at least some of the controls;

[0050] The first verification result matrix, the movement direction of the movement input sequence, and the row identifiers of at least part of the movement controls are sent to the server.

[0051] It should be noted that, for example, the grid where the active object is located is the grid at the xth row and yth column, the next row of grids is the grid at the x+1th row and the target grid is the grid at the x+1th row and yth column.

[0052] Each movement input to a mobile control adjusts the most recent two-dimensional matrix verification code. Each movement input moves the object associated with the row grid corresponding to the movement input in the subgrid displayed on the verification interface. This means that users can adjust the position of objects within the grid through input operations on the verification interface, thereby adjusting the verification interface. Furthermore, the two-dimensional matrix verification code must be modified to generate a first verification result matrix for server-side verification. It should be noted that the row identifiers of at least some mobile controls can be understood as row identifiers of a sequence of movement inputs. One movement input corresponds to one row identifier, meaning that the movement input is an input to the mobile control in the row corresponding to that row identifier in the grid. The mobile control returns to its original position after each movement input.

[0053] In one embodiment, in response to a movement input sequence, the two-dimensional matrix verification code is adjusted according to the movement direction of the movement input sequence and the row identifiers of at least some of the movement controls to obtain a first verification result matrix, including:

[0054] When receiving a movement input of the reference movement control, adjusting the two-dimensional matrix verification code according to the movement direction of the movement input of the reference movement control and the row identifier of the reference movement control until the adjustment is completed according to the movement direction of each movement input in the movement input sequence, thereby obtaining a first verification result matrix;

[0055] The adjusting of the two-dimensional matrix verification code according to the moving direction of the moving input of the reference moving control and the row identifier of the reference moving control includes at least one of the following:

[0056] When the moving direction is a first direction, adjusting the value of the lth column in a reference row of the two-dimensional matrix verification code to the value of the l+1th column, filling the value of the last column of the reference row with a third preset value, and when the value of the target position in the row below the position of the moving object and the same column as the position of the moving object is the first value, adjusting the value of the position of the moving object to the first value, associating the moving object with the target position, and adjusting the value of the target position to the second preset value, l is greater than or equal to 1 and less than the number of columns of the two-dimensional matrix verification code, and the reference row is the row corresponding to the row identifier corresponding to the moving direction;

[0057] When the moving direction is the second direction, the value of the l+1th column in the reference row of the two-dimensional matrix verification code is adjusted to the value of the lth column, the value of the 1st column of the reference row is filled with the third preset value, and when the value of the target position in the same column as the position of the active object in the next row is the first value, the value of the position of the active object is adjusted to the first value, the active object is associated with the target position, and the value of the target position is adjusted to the second preset value.

[0058] The movement direction of the mobile control can be a first direction or a second direction. The first direction can be understood as the direction along the columns of the two-dimensional grid from largest to smallest, and the second direction is opposite to the first direction. The position of the active object can be understood as the position associated with the active object in the two-dimensional matrix verification code. It should be noted that the current associated position of the active object is row x, column y, the next row is row x+1, and the target position is row x+1, column y.

[0059] In this embodiment, different moving directions result in different adjustment methods for the two-dimensional matrix verification code, which can meet different adjustment requirements.

[0060] See also Figure 3 , a verification code generation method, which can be applied to the server, includes:

[0061] Step 301: upon receiving a verification code request sent by a terminal, a random number sequence is generated.

[0062] Step 302: Generate a first path from the moving object to a preset desired position in the matrix according to the random number sequence and the starting position of the moving object in the initial matrix.

[0063] A preset number of rows (h) and a preset number of columns (w) may be pre-set, and a starting position may be determined based on the preset number of columns and a random function, for example, the starting position may be determined by the random function Random(1, w-2). The active object may be associated with a starting position in a pre-initialized initial matrix, which may be a random position in the first row of the initial matrix. Based on the random number sequence, a first path between the starting position and the preset desired position may be mapped.

[0064] Step 303: Generate a two-dimensional matrix verification code based on the first path and the initial matrix.

[0065] Among them, in the two-dimensional matrix verification code, the value corresponding to the initial position associated with the active object is different from the value corresponding to the position associated with any obstacle object among the multiple obstacle objects, the values ​​corresponding to the positions associated with the multiple obstacles are the same, and the expected position is preset to be associated with the prompt object.

[0066] Step 304: Send the two-dimensional matrix verification code to the terminal.

[0067] That is, in the process of generating the two-dimensional matrix verification code based on the initial matrix, the first path is also considered.

[0068] In this embodiment, the verification code generated by the terminal server is a two-dimensional matrix verification code, and in the two-dimensional matrix verification code, the value corresponding to the initial position associated with the active object is different from the value corresponding to the position associated with any obstacle object among the multiple obstacle objects, the values ​​corresponding to the positions associated with the multiple obstacles are the same, and the expected position is preset to be associated with a prompt object. In this way, the content of the verification code can be enriched, and the first path is taken into consideration, which can reduce the risk of being identified, thereby improving the security of the verification code.

[0069] In one embodiment, the value of each position in the initial matrix is ​​the first value, the first path includes M path segments that are ordered and have path directions, any path segment is associated with two positions, and M is a positive integer.

[0070] Based on the first path and the initial matrix, a two-dimensional matrix verification code is generated, including:

[0071] According to the M path directions and M path segments, the values ​​of some positions in the initial matrix are adjusted in order to obtain a two-dimensional matrix verification code.

[0072] It should be noted that the two positions associated with each path segment are adjacent, and their row or column identifiers differ by 1. The M path directions are the path directions of the M path segments. In the process of generating a two-dimensional matrix verification code, the values ​​of some positions in the initial matrix are adjusted in an orderly manner using the M path directions and the M path segments. This not only takes into account the M path segments, but also their directionality and order, thereby improving the security of the resulting two-dimensional verification code.

[0073] In one embodiment, according to M path directions and M path segments, the values ​​of some positions in the initial matrix are adjusted in an orderly manner to obtain a two-dimensional matrix verification code, including:

[0074] For each of the M path directions, the value of the initial matrix is ​​adjusted according to the path direction, and the position of the active object is updated according to the position associated with the path segment of the path direction;

[0075] When the initial matrix is ​​adjusted according to the M path directions, a two-dimensional matrix verification code is obtained, and the position of the active object is updated to the starting position;

[0076] Among them, target adjustments include:

[0077] In the case where the path direction is the first direction, the first position is determined according to the position of the active object, and the value of the first position in the initial matrix is ​​adjusted to a first preset value, or

[0078] In the case where the path direction is the second direction, the second position is determined according to the position of the active object, and the value of the second position in the initial matrix is ​​adjusted to the first preset value, or

[0079] When the path direction is the third direction, determining the third position according to the position of the active object, and adjusting the value of the third position in the initial matrix to the first preset value;

[0080] The third direction is perpendicular to the first direction and the second direction respectively.

[0081] The preset value can be set as needed and is not specifically limited in this embodiment. For example, the first preset value can be 1, etc. It is understood that the position corresponding to the first preset value is associated with an obstacle object. In this embodiment, the path direction can be the first direction, the second direction, or the third direction. Different path directions correspond to different positions that need to be adjusted to the first preset value. The values ​​of different positions can be adjusted to the first preset value to meet different needs.

[0082] In one example, the first position includes at least one of a first sub-position and a second sub-position, the first sub-position includes a position adjacent to the position of the active object in the third direction, the second sub-position includes a position in the same row as the position of the active object in a first target column of the initial matrix, the first target column is any column in the s column along the second direction based on the position of the active object, and the s column is located between the middle area and the first boundary area;

[0083] The second position includes at least one of a third sub-position and a fourth sub-position, the third sub-position includes a position adjacent to the position of the active object in the third direction, the fourth sub-position includes a position in the same row as the position of the active object in the second target column of the initial matrix, the second target column is any column in the t column along the first direction based on the position of the active object, the t column is located between the second boundary area and the middle area, and the first boundary area and the second boundary area each include at least one column area;

[0084] The third position includes at least one of a fifth sub-position and a sixth sub-position, the fifth sub-position including a position in the first target column that is in the same row as the position of the active object, and the sixth sub-position including a position in the second target column that is in the same row as the position of the active object;

[0085] Wherein, s and t are both positive integers.

[0086] In one embodiment, generating a first path from the moving object to a preset desired position in the initial matrix according to the random number sequence and the starting position of the moving object in the initial matrix includes:

[0087] S1: According to a first preset value, perform a modulo process on the i-th random number in the random number sequence to obtain the i-th remainder, where the initial value of i is 1, i is less than or equal to N, and N is the total number of random numbers in the random number sequence;

[0088] S2: Determine the direction of the i-th movement based on the i-th remainder;

[0089] S3: When the i-th moving direction is different from the k path directions and the j-1-th position is different from the preset expected position, the i-th moving direction is determined as a path direction, and the j-th position is obtained according to the i-th moving direction and the j-1-th position, and i is increased by 1 and j is increased by 1;

[0090] Repeat S1-S2 until the position of the active object is the same as the preset expected position, and obtain M path directions. The initial value of j is 1, j≤M, and the 0th position is the starting position;

[0091] Wherein, k is a positive integer, and the k path directions are the k path directions after the determination sequence before determining the i-th moving direction.

[0092] It should be noted that the i-th moving direction is determined as a path direction. After obtaining the j-th position based on the i-th moving direction and the j-1-th position, the j-th path segment among the M path segments can be determined, that is, the j-th path segment is associated with the j-th position and the j-1-th position, and the corresponding path direction is the direction from the j-1-th position to the j-th position. The j-th path segment can be understood as the path segment from the j-1-th position to the j-th position. Until the position of the moving object is the same as the preset expected position, M path directions are obtained, or M path segments are obtained, and the M path segments correspond one-to-one to the M path directions. The first preset value can be pre-set according to actual needs and is not specifically limited in this embodiment. For example, it can be 3, etc. The value of k can be pre-set according to actual needs and is not specifically limited. For example, the value of k can be 2.

[0093] From the first random number in the random number sequence to the Nth random number, values ​​are taken one by one. For example, if the random number sequence is 123456789, the first value is 1, the next value is 2, and so on. Now, let's assume that the random number obtained is A. Then, divide A by 3 to obtain the remainder. If it is 0, the next direction of the path is downward (the third direction); if it is 1, the next direction of the path is left (the first direction); and if it is 2, the next direction of the path is right (the second direction). During the process of constructing the path, the number of times the same direction is always recorded. If the direction in the path is the same more than k times, the current path direction is invalid (the path is not constructed), and the next random code is taken to construct the path. This continues until the random code bits are exhausted or the active object reaches the preset expected position. In this embodiment, the randomness of the first path obtained can be improved by the above process of constructing the first path. In this way, a two-dimensional matrix verification code is generated, reducing the risk of the verification code being recognized and improving the security of the two-dimensional matrix verification code.

[0094] In one embodiment, the method further comprises:

[0095] S4: If the direction of the i-th movement is the same as the direction of the k-th path, and the j-1-th position is different from the preset expected position, increase i by 1;

[0096] Repeat S1-S2 until the position of the active object is the same as the preset expected position, and M path directions are obtained.

[0097] That is, during the process of building a path, the number of times the same direction is always recorded. When the direction in the path is the same for more than k times, the current path direction is invalid (the path is not built), and the next bit of the random code is taken to build the path. In this way, the security of the constructed path is improved.

[0098] In one embodiment, upon receiving a verification code request sent by a terminal, generating a random number sequence includes:

[0099] In response to the verification code request, a random number sequence is generated based on target information, where the target information includes at least one of the following:

[0100] The timestamp of the verification code request;

[0101] The terminal's identity in the verification code request;

[0102] The server provides a hash code for the verification code service object.

[0103] For example, according to a second preset value (e.g., 6, etc.), in the process of generating a random number sequence, when the target information includes one piece of information, each digit of the target information is modulo processed according to the second preset value to obtain a random number sequence, and the random number sequence includes the value of each digit of the target information after the modulo processing; when the target information includes at least two pieces of information, according to the second preset value, the at least two pieces of information are added and modulo processed in units of bits to obtain a random number sequence. In this embodiment, in the process of generating a random number sequence, at least one of the request sending timestamp in the verification code request, the identity identifier of the terminal in the verification code request, and the hash code of the object for which the server provides verification code services to the terminal can be used to generate the random number sequence, thereby improving the security of the generated random number sequence.

[0104] In one embodiment, after sending the two-dimensional matrix verification code to the terminal, the method further includes:

[0105] receiving a first verification result matrix, a moving direction of an ordered moving input sequence, and a row identifier of the moving input sequence sent by a terminal;

[0106] When the values ​​of the preset row of the first verification result matrix include only one second preset value, the initial two-dimensional matrix verification code is sequentially adjusted using the movement direction of the movement input sequence and the row identifier of the movement input sequence to obtain a second verification result matrix in which the preset row is the same as the row where the preset expected position is located;

[0107] In the case that the first verification result matrix matches the second verification result matrix, a first prompt is sent to the terminal, where the first prompt is used to indicate that the verification is successful.

[0108] In this embodiment, a determination is first made as to whether the values ​​in the preset rows of the first verification result matrix include only one second preset value. If the values ​​include at least two second preset values, verification is successful, and a second prompt indicating verification failure is returned. If the values ​​in the preset rows of the first verification result matrix include only one second preset value, the initial two-dimensional matrix verification code can be further adjusted using the movement direction and row identifier of the movement input sequence to obtain a second verification result matrix. A determination is then made as to whether the first verification result and the second verification result matrix match. If so, a first prompt indicating successful verification is sent to the terminal, thereby improving verification accuracy.

[0109] In one embodiment, the moving direction of the moving input sequence is a moving direction linked list, and any node in the moving direction linked list stores a moving direction and a corresponding row identifier;

[0110] The two-dimensional matrix verification code is sequentially adjusted using the moving direction of the moving input sequence and the row identifier of the moving input sequence to obtain a second verification result matrix, including:

[0111] When the moving direction linked list is not empty, obtaining the target moving direction and target row identifier of the head node in the moving direction linked list, and deleting the head node of the moving direction linked list;

[0112] The two-dimensional matrix verification code is adjusted according to the target moving direction and the target row identifier. When the moving direction linked list is not empty, the target moving direction of the head node in the moving direction linked list is obtained, and the head node of the moving direction linked list is deleted. The second verification result matrix is ​​obtained when the moving direction linked list is empty.

[0113] In this embodiment, the initial two-dimensional matrix verification code is adjusted in an orderly manner in the form of a linked list, thereby improving the accuracy of the adjustment and thus improving the accuracy of the second verification result matrix.

[0114] In one embodiment, adjusting the two-dimensional matrix verification code according to the target movement direction and the target row identifier includes at least one of the following:

[0115] When the target moving direction is the first direction, adjusting the value of the lth column in the target row of the two-dimensional matrix verification code to the value of the l+1th column, filling the value of the last column of the target row with the third preset value, and when the value of the fourth position in the row below the position of the active object and the same column as the position of the active object is the first value, adjusting the value of the position of the active object to the first value, associating the active object with the fourth position, and adjusting the value of the fourth position to the second preset value, l is greater than or equal to 1 and less than the number of columns of the matrix verification code, and the target row is the row corresponding to the target row identifier;

[0116] When the target moving direction is the second direction, the value of the l+1th column in the target row of the two-dimensional matrix verification code is adjusted to the value of the lth column, the value of the 1st column of the target row is filled with the third preset value, and when the value of the fourth position in the same column as the position of the active object in the next row is the first value, the value of the position of the active object is adjusted to the first value, the active object is associated with the fourth position, and the value of the fourth position is adjusted to the second preset value.

[0117] The above method is described in detail below with reference to a specific embodiment.

[0118] Part 1: Server-side verification code generation.

[0119] The first step is to set the complexity of the verification code according to the usage scenario. For example, the normal complexity can be used for login, and the complexity can be increased for password modification. That is, define the grid size. Let the grid width be w and the height be h. Figure 4 For example, w = 8, h = 5. Common sense shows that the larger the value, the higher the complexity.

[0120] The second step is to randomly determine the active object ( Figure 4 The formula is Random(1, w-2), which excludes the cells on the left and right borders. The random value here is the random function built into the programming system.

[0121] The third step is to calculate the random number sequence and build a moving object in the grid to reach the preset expected position according to the generated random number sequence ( Figure 5 The first path of the exit area in the process ensures that the generated verification code is random and has a solution.

[0122] Step 4: Data Packaging. Create a two-dimensional array of size [h+1,w+8], initialized to 0 (the initial value). The 8-bit value is greater than the width because there are two hidden positions on each side, and the array supports moving two cells. Hidden positions are filled with -1, unobstructed positions are filled with 0, obstructed positions are filled with 1, active object positions are filled with 2, invalid positions are filled with -2, and the last row is filled with 0.

[0123] The user-visible position is Figure 2 The goal of the verification is to adjust the position of the obstacles in the grid so that the active object reaches the preset expected position shown in the figure. When the obstacles in the grid are translated left and right in units of whole rows, the elements at the edge of the grid before translation (including obstacles and unobstructed positions) will move out of the grid area and move into the "hidden moving position". Similarly, the "invalid position" is the element that stores the hidden moving position.

[0124] The fifth step is to generate necessary obstacles based on the moving trajectory of the active object in the third step. Assume that after the first three steps, the generated trajectory is Figure 6 shown.

[0125] The first time the active object moves to the left, two necessary obstacles can be determined: one obstacle is added outside the right border, and one obstacle is added below the original position of the active object. Figure 7 As shown in the figure. According to the data structure definition in step 4, it is a two-dimensional array of [6,16]. The required obstacles are at [1,13] and [2,10]. Their position values ​​are defined in step 4 and are assigned a value of 1.

[0126] The active object moves downward for the second time, indicating that there is no obstacle below. At the same time, the target completes the operation of the previous row, and an obstacle is randomly added on the left and right sides, such as Figure 8 As shown in the figure, assume that the position to be filled is on the left, that is, the position [1,4] is assigned the value 1.

[0127] The same logic applies when the active object moves downward for the third time. Note that the target has already moved in the same direction twice (downward) in a row. If the direction of the random code is still downward the next time, it will not be executed. The next random code will be taken to determine the moving direction until the moving direction is the new direction. Figure 9 shown.

[0128] The fourth time the active object moves to the left, the logic is the same as the first time, so it will not be repeated; the fifth time it moves downward, it will not be repeated.

[0129] The active object moves to the right for the sixth time, and two necessary obstacles are determined: one obstacle is added outside the left border, and one obstacle is added below the original position of the active object. Figure 10 shown.

[0130] In the sixth step, we randomly generate other non-essential obstacles to ensure that the grid area is not too monotonous. The encapsulated data (the structure defined in the fourth step) is returned to the terminal.

[0131] Part 2: Terminal display and response processing:

[0132] The terminal's display is the process of data encapsulation and visualization. It decrypts and parses the data transmitted from the server and then draws the front-end interface elements. This is a field-proven technology and will not be discussed in detail here. The terminal's focus is on responding to and recording user actions.

[0133] The terminal displays the verification interface based on the information returned by the server. The verification interface mainly includes four core elements: active object ( Figure 5 The heart-shaped symbol in the middle), preset desired position ( Figure 5 The exit area in the grid is also the basis for verification), the grid with obstacles ( Figure 5 The black circle is the obstacle), move the handle left and right (i.e. move the control, Figure 5 Chinese style double-headed arrows on the left and right sides).

[0134] Figure 4 yes Figure 5 The diagram shows the bottom layer style of the active object. Taking the top row as an example, there are two consecutive obstacles below the active object (the second row from the top), and it cannot continue to move down. The left and right handles outside the grid each have an obstacle, which means that it can move one cell left or right. Similarly, the left handle of the second row has two obstacles, and the right handle has no obstacles, which means that the second row can move two cells to the right but not to the left. For the user, it is necessary to operate the left and right handles to determine whether it can move left or right, and to determine how many cells can be moved. The user cannot distinguish without operation, thus avoiding being cracked after machine recognition.

[0135] because Figure 4 and Figure 5 is an example of a representation, differing only in that Figure 1 It is the bottom layer style. Figure 4 It is a user-visible style. For the convenience of description, it is used uniformly below. Figure 1 Give explanation.

[0136] for Figure 5 In the case of the verification code shown, the user needs to complete the following steps to complete the verification:

[0137] Step 1: Click the left handle of the first row to move the entire row one cell to the left;

[0138] Step 2: Click the left handle of the third row to move the entire row one cell to the left;

[0139] Step 3: Click the handle on the right side of the fourth row to move the entire row one cell to the right; the effect diagram of the process decomposition is as follows Figure 11 It should be noted that Figure 11 The operational details of the third step are omitted, but can be deduced from the operational effects of the first two steps and will not be repeated here.

[0140] The data layer can be summarized as follows: Assume that the user clicks the left handle, performing a left shift of a row of elements. The terminal modifies the 2D matrix verification code and, after the shift, checks whether there is an obstacle in the next row of the currently active object. If not, the active object continues to move downward (with a consequential reaction), modifies the 2D matrix verification code, and then returns to check again whether there is an obstacle in the next row of the moved position. If there is an obstacle, the response to this user's left-side operation ends.

[0141] The user operation behaviors are linked in a linked list. To reduce the complexity of operation and verification, the length of the linked list is generated by the background and its value is h*4. When the user fails to complete the verification within the specified number of operation steps, it is reset. The structure of the operation behavior is hi_L / R, which is the left handle or right handle of the i-th row. In summary, Figure 10 The three-step process chain is represented as follows: h1_L, h3_L, h4_R.

[0142] Finally, the final first verification result matrix and operation behavior are returned to the server for verification.

[0143] Part 3: Server-side verification code verification:

[0144] The server decrypts the data upon receiving it. The verification process consists of two steps: The first step checks the value of the last row of the first verification result matrix to see if there is exactly one 2, thus determining whether the active object falls within the target area. If not, verification fails; otherwise, the process continues. The second step is to recall the front-end operations, obtain the second verification result matrix, and compare the first and second verification result matrices. If they match, verification succeeds; otherwise, verification fails.

[0145] Add multiple layers of movement and interaction to the CAPTCHA to increase the verification process and make it harder to crack. Incorporate maze elements into the CAPTCHA interface and change them through interactive operations to prevent direct computer recognition.

[0146] See also Figure 12 , provides a verification code receiving device 1200 of an embodiment, which can be applied to a terminal, including:

[0147] The first sending module 1201 is used to send a verification code request to the server;

[0148] The first receiving module 1202 is configured to receive a two-dimensional matrix verification code sent by the server in response to a verification code request, wherein in the two-dimensional matrix verification code, a value corresponding to an initial position associated with the active object is different from a value corresponding to a position associated with any one of the plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and a preset expected position is associated with a prompt object.

[0149] In one embodiment, the verification code receiving device 1200 further includes:

[0150] The grid generation module is used to generate a two-dimensional grid according to the two-dimensional matrix verification code after the first receiving module 1202 receives the two-dimensional matrix verification code sent by the server in response to the verification code request. The size of the two-dimensional grid is the same as the size of the two-dimensional matrix verification code.

[0151] Display module, used to display the verification interface;

[0152] The verification interface includes an intermediate subgrid of a two-dimensional grid, an active object, a prompt object, and a target obstacle object associated with an intermediate submatrix corresponding to the intermediate subgrid. The active object is located in an initial grid in the intermediate subgrid. The position of the initial grid in the two-dimensional grid matches the position of the initial position in the two-dimensional matrix verification code. The prompt object is located in a preset expected grid in the intermediate subgrid. The position of the preset expected grid in the two-dimensional grid matches the preset expected position in the two-dimensional matrix verification code. An obstacle is located in a grid in the intermediate subgrid. The number of rows of the intermediate subgrid is the same as the number of rows of the two-dimensional grid, and the obstacle is located between the first subgrid and the second subgrid of the two-dimensional grid.

[0153] In one embodiment, the verification interface further includes a plurality of mobile controls distributed on opposite sides of the middle subgrid, wherein one row of grids corresponds to two mobile controls, and the two mobile controls are distributed on opposite sides of the row of grids;

[0154] The verification code receiving device 1200 further includes:

[0155] a movement input receiving module, configured to receive an orderly movement input sequence of at least some of the multiple movement controls in the verification interface from the user after the display module executes the display of the verification interface;

[0156] A verification code adjustment module is configured to adjust a two-dimensional matrix verification code in response to a movement input sequence and according to a movement direction of the movement input sequence and row identifiers of at least some of the mobile controls, to obtain a first verification result matrix; wherein, after an object associated with a reference row grid moves a unit grid in accordance with a reference movement direction, and after an active object in the reference row grid moves a unit grid in accordance with the reference movement direction, if there is no obstacle in a target grid in a next row of grids to the grid where the active object is located and in the same column as the grid where the active object is located, the active object moves to the target grid, the reference row grid is the row grid corresponding to the row identifier of the reference mobile control, the reference movement direction is the movement direction of the movement input of the reference mobile control, and the reference mobile control is any one of the at least some of the controls;

[0157] The second sending module is configured to send the first verification result matrix, the moving direction of the moving input sequence, and the row identifiers of at least part of the moving controls to the server.

[0158] In one embodiment, the verification code adjustment module includes:

[0159] a first adjustment unit configured to, upon receiving a movement input of a reference movement control, adjust the two-dimensional matrix verification code according to a movement direction of the movement input of the reference movement control and a row identifier of the reference movement control, until adjustment is completed according to the movement direction of each movement input in the movement input sequence, thereby obtaining a first verification result matrix;

[0160] The adjusting of the two-dimensional matrix verification code according to the moving direction of the moving input of the reference moving control and the row identifier of the reference moving control includes at least one of the following:

[0161] When the moving direction is a first direction, adjusting the value of the lth column in a reference row of the two-dimensional matrix verification code to the value of the l+1th column, filling the value of the last column of the reference row with a third preset value, and when the value of the target position in the row below the position of the moving object and the same column as the position of the moving object is the first value, adjusting the value of the position of the moving object to the first value, associating the moving object with the target position, and adjusting the value of the target position to the second preset value, l is greater than or equal to 1 and less than the number of columns of the two-dimensional matrix verification code, and the reference row is the row corresponding to the row identifier corresponding to the moving direction;

[0162] When the moving direction is the second direction, the value of the l+1th column in the reference row of the two-dimensional matrix verification code is adjusted to the value of the lth column, the value of the 1st column of the reference row is filled with the third preset value, and when the value of the target position in the same column as the position of the active object in the next row is the first value, the value of the position of the active object is adjusted to the first value, the active object is associated with the target position, and the value of the target position is adjusted to the second preset value.

[0163] The technical features of the above-mentioned verification code receiving device 1200 correspond to the technical features of the above-mentioned verification code receiving method applicable to the terminal. The various processes of the above-mentioned verification code receiving method are implemented by the verification code receiving device 1200, and the same effect can be obtained. To avoid repetition, they will not be repeated here.

[0164] See also Figure 13 , provides a verification code generating device 1300 of an embodiment, which can be applied to a server, including:

[0165] The random sequence generation module 1301 is configured to generate a random number sequence upon receiving a verification code request sent by a terminal;

[0166] A path generation module 1302 is configured to generate a first path from the moving object to a preset desired position in the matrix according to the random number sequence and the starting position of the moving object in the initial matrix;

[0167] The verification code generation module 1303 is configured to generate a two-dimensional matrix verification code based on the first path and the initial matrix, wherein in the two-dimensional matrix verification code, a value corresponding to the initial position associated with the active object is different from a value corresponding to a position associated with any of the plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and a preset expected position is associated with a prompt object;

[0168] The verification code sending module 1304 is configured to send a two-dimensional matrix verification code to the terminal.

[0169] In one embodiment, the value of each position in the initial matrix is ​​the first value, the first path includes M path segments that are ordered and have path directions, any path segment is associated with two positions, and M is a positive integer.

[0170] The verification code generation module 1303 includes:

[0171] The second adjustment unit is used to sequentially adjust the values ​​of some positions in the initial matrix according to the M path directions and the M path segments to obtain a two-dimensional matrix verification code.

[0172] In one embodiment, the second adjustment unit includes:

[0173] a first adjustment subunit, configured to perform a target adjustment on the value of the initial matrix according to each of the M path directions, and update the position of the active object according to the position associated with the path segments of the path direction;

[0174] The second adjustment subunit is configured to obtain a two-dimensional matrix verification code and update the position of the active object to the starting position when the initial matrix is ​​adjusted according to the M path directions;

[0175] Among them, target adjustments include:

[0176] In the case where the path direction is the first direction, the first position is determined according to the position of the active object, and the value of the first position in the initial matrix is ​​adjusted to a first preset value, or

[0177] In the case where the path direction is the second direction, the second position is determined according to the position of the active object, and the value of the second position in the initial matrix is ​​adjusted to the first preset value, or

[0178] When the path direction is the third direction, determining the third position according to the position of the active object, and adjusting the value of the third position in the initial matrix to the first preset value;

[0179] The third direction is perpendicular to the first direction and the second direction respectively.

[0180] In one embodiment, the path generation module 1302 includes:

[0181] A modulo processing module is configured to execute S1: performing a modulo processing on the i-th random number in the random number sequence according to a first preset value to obtain an i-th remainder, where the initial value of i is 1, i is less than or equal to N, and N is the total number of random numbers in the random number sequence;

[0182] A first determining module is configured to execute S2: determining an i-th moving direction according to an i-th remainder;

[0183] A second determining module is configured to execute S3: when the i-th moving direction is different from the k path directions and the j-1-th position is different from the preset expected position, determine the i-th moving direction as a path direction, obtain the j-th position based on the i-th moving direction and the j-1-th position, and increment i by 1 and j by 1;

[0184] Repeat S1-S2 until the position of the active object is the same as the preset expected position, and obtain M path directions. The initial value of j is 1, j≤M, and the 0th position is the starting position;

[0185] Wherein, k is a positive integer, and the k path directions are the k path directions after the determination sequence before determining the i-th moving direction.

[0186] In one embodiment, the verification code generating device 1300 further includes:

[0187] A third adjustment module is configured to execute S4: when the i-th moving direction is the same as the k-th path direction and the j-1-th position is different from the preset expected position, increase i by 1;

[0188] Repeat S1-S2 until the position of the active object is the same as the preset expected position, and M path directions are obtained.

[0189] In one embodiment, the verification code generating device 1300 further includes:

[0190] A second receiving module is configured to receive the first verification result matrix, the moving direction of the ordered moving input sequence, and the row identifier of the moving input sequence sent by the terminal after the verification code sending module 1304 sends the two-dimensional matrix verification code to the terminal;

[0191] a fourth adjustment module configured to, when the values ​​of the preset row of the first verification result matrix include only one second preset value, sequentially adjust the initial two-dimensional matrix verification code using the movement direction of the movement input sequence and the row identifier of the movement input sequence to obtain a second verification result matrix in which the preset row is the same as the row where the preset expected position is located;

[0192] The third sending module is used to send a first prompt to the terminal when the first verification result matches the second verification result matrix, where the first prompt is used to indicate that the verification is successful.

[0193] The technical features of the above-mentioned verification code generation device 1300 correspond to the technical features of the above-mentioned verification code generation method that can be applied to the server. The various processes of the above-mentioned verification code generation method are implemented through the verification code generation device 1300, and the same effect can be obtained. To avoid repetition, they will not be repeated here.

[0194] An embodiment of the present invention further provides a communication device, including a processor and a memory, wherein the memory stores a computer program that can be run on the processor. When the computer program is executed by the processor, the various processes in the above-mentioned verification code generation method embodiment are implemented and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0195] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned verification code generation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0196] The computer readable storage medium is a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0197] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0198] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a communication device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of various embodiments of the present invention.

[0199] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.

Claims

1. A verification code receiving method, characterized in that: Applied to terminals, including: Send a verification code request to the server; receiving a two-dimensional matrix verification code sent by the server in response to the verification code request, wherein, in the two-dimensional matrix verification code, a value corresponding to an initial position associated with the active object is different from a value corresponding to a position associated with any one of the plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and a preset expected position is associated with a prompt object; After receiving the two-dimensional matrix verification code sent by the server in response to the verification code request, the method further includes: Generating a two-dimensional grid according to the two-dimensional matrix verification code, wherein the size of the two-dimensional grid is the same as the size of the two-dimensional matrix verification code; Display the verification interface; The verification interface includes an intermediate subgrid of the two-dimensional grid, the active object, the prompt object, and a target obstacle object associated with the intermediate submatrix corresponding to the intermediate subgrid; the active object is located in an initial grid in the intermediate subgrid; the position of the initial grid in the two-dimensional grid matches the position of the initial position in the two-dimensional matrix verification code; the prompt object is located in a preset expected grid in the intermediate subgrid; the position of the preset expected grid in the two-dimensional grid matches the preset expected position in the two-dimensional matrix verification code; an obstacle is located in a grid in the intermediate subgrid; the number of rows of the intermediate subgrid is the same as the number of rows of the two-dimensional grid, and the obstacle is located between the first subgrid and the second subgrid of the two-dimensional grid.

2. The method according to claim 1, characterized in that The verification interface further includes a plurality of mobile controls distributed on opposite sides of the middle sub-grid, with one row of grids corresponding to two mobile controls, and the two mobile controls are distributed on opposite sides of the row of grids; After displaying the verification interface, the method further includes: receiving a user's ordered movement input sequence for at least part of the plurality of movement controls in the verification interface; In response to the movement input sequence, the two-dimensional matrix verification code is adjusted according to the movement direction of the movement input sequence and the row identifier of the at least part of the mobile control to obtain a first verification result matrix; wherein, after the object associated with the reference row grid moves the unit grid according to the reference movement direction, and after the active object in the reference row grid moves the unit grid according to the reference movement direction, if there is no obstacle in a target grid in the next row of grids of the grid where the active object is located and in the same column as the grid where the active object is located, the active object moves to the target grid, the reference row grid is the row grid corresponding to the row identifier of the reference mobile control, the reference movement direction is the movement direction of the movement input of the reference mobile control, and the reference mobile control is any control among the at least part of the mobile controls; The first verification result matrix, the movement direction of the movement input sequence, and the row identifier of at least part of the mobile control are sent to the server.

3. The method according to claim 2, characterized in that The step of adjusting the two-dimensional matrix verification code in response to the movement input sequence according to the movement direction of the movement input sequence and the row identifiers of at least part of the mobile controls to obtain a first verification result matrix includes: When receiving the movement input of the reference movement control, adjusting the two-dimensional matrix verification code according to the movement direction of the movement input of the reference movement control and the row identifier of the reference movement control until the adjustment is completed according to the movement direction of each movement input in the movement input sequence, thereby obtaining the first verification result matrix; The adjusting of the two-dimensional matrix verification code according to the moving direction of the moving input of the reference moving control and the row identifier of the reference moving control includes at least one of the following: In the case where the moving direction is the first direction, the first l The value of the column is adjusted to l +1 column, the value of the last column of the reference row is filled with the third preset value, and when the value of the target position in the next row and the same column as the position of the active object is the first value, the value of the position of the active object is adjusted to the first value, the active object is associated with the target position, and the value of the target position is adjusted to the second preset value, l Greater than or equal to 1 , and is smaller than the number of columns of the two-dimensional matrix verification code, the reference row being the row corresponding to the row identifier corresponding to the moving direction; In the case where the moving direction is the second direction, l +1 column value is adjusted to l The value of the first column of the reference row is filled with a third preset value, and when the value of the target position in the same column as the position of the active object in the next row below the position of the active object is a first value, the value of the position of the active object is adjusted to the first value, the active object is associated with the target position, and the value of the target position is adjusted to the second preset value.

4. A verification code generation method, characterized in that: Applied to the server, including: Upon receiving a verification code request sent by a terminal, generating a random number sequence; generating a first path from the moving object to a preset desired position in the matrix according to the random number sequence and the starting position of the moving object in the initial matrix; generating a two-dimensional matrix verification code based on the first path and the initial matrix, wherein, in the two-dimensional matrix verification code, a value corresponding to the initial position associated with the active object is different from a value corresponding to a position associated with any one of the plurality of obstacle objects, the values ​​corresponding to the positions associated with the plurality of obstacles are the same, and the preset expected position is associated with a prompt object; Sending the two-dimensional matrix verification code to the terminal; The value of each position in the initial matrix is ​​a first value, the first path includes M path segments that are ordered and have path directions, any path segment is associated with two positions, and M is a positive integer. Generating a two-dimensional matrix verification code based on the first path and the initial matrix includes: According to the M path directions and the M path segments, the values ​​of some positions in the initial matrix are adjusted in order to obtain the two-dimensional matrix verification code.

5. The method according to claim 4, characterized in that The step of sequentially adjusting the values ​​of some positions in the initial matrix according to the M path directions and the M path segments to obtain the two-dimensional matrix verification code includes: For each of the M path directions, target adjustment is performed on the value of the initial matrix according to the path direction, and the position of the active object is updated according to the position associated with the path segment of the path direction; When the initial matrix is ​​adjusted according to the M path directions, the two-dimensional matrix verification code is obtained, and the position of the active object is updated to the starting position; The target adjustment includes: In the case where the path direction is the first direction, determining a first position according to the position of the moving object, and adjusting the value of the first position in the initial matrix to a first preset value, or In the case where the path direction is the second direction, determining a second position according to the position of the moving object, and adjusting the value of the second position in the initial matrix to the first preset value, or When the path direction is the third direction, determining a third position according to the position of the moving object, and adjusting the value of the third position in the initial matrix to the first preset value; The third direction is perpendicular to the first direction and the second direction respectively.

6. The method according to claim 4, characterized in that Generating a first path from the active object to a preset expected position in the initial matrix according to the random number sequence and the starting position of the active object in the initial matrix includes: S1: performing a modulo process on the i-th random number in the random number sequence according to a first preset value to obtain an i-th remainder, where the initial value of i is 1, i is less than or equal to N, and N is the total number of random numbers in the random number sequence; S2: Determine the i-th moving direction according to the i-th remainder; S3: When the i-th moving direction is different from the k path directions and the j-1-th position is different from the preset expected position, the i-th moving direction is determined as a path direction, the j-th position is obtained according to the i-th moving direction and the j-1-th position, and i is increased by 1 and j is increased by 1; Repeating S1-S2 until the position of the moving object is the same as the preset expected position, obtaining M path directions, where the initial value of j is 1, j≤M, and the 0th position is the starting position; Wherein, k is a positive integer, and the k path directions are the k path directions after the determination sequence before the i-th moving direction is determined.

7. The method according to claim 6, characterized in that The method further comprises: S4: when the i-th moving direction is the same as the k-path directions, and the j-1-th position is different from the preset expected position, increment i by 1; Repeat steps S1-S2 until the position of the moving object is the same as the preset expected position, thereby obtaining the M path directions.

8. The method according to claim 4, characterized in that After sending the two-dimensional matrix verification code to the terminal, the method further includes: receiving a first verification result matrix, a moving direction of an ordered moving input sequence, and a row identifier of the moving input sequence sent by the terminal; When the values ​​of the preset row of the first verification result matrix include only one second preset value, sequentially adjusting the two-dimensional matrix verification code using the movement direction of the movement input sequence and the row identifier of the movement input sequence to obtain a second verification result matrix, wherein the preset row is the same as the row where the preset expected position is located; In a case where the first verification result matrix matches the second verification result matrix, a first prompt is sent to the terminal, where the first prompt is used to indicate that the verification is successful.

9. A communication device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the processor implements the steps of the verification code generation method described in any one of claims 1 to 3 or the steps of the verification code receiving method described in any one of claims 4 to 8.

Citation Information

Patent Citations

  • Image-based verification code implementation method and device

    CN107453876A

  • Verification method and system of verification code, client device and server device

    CN112199658A