Verification method, device and equipment for verification code
By segmenting and adjusting and rearranging the verification code pictures, generating verification code blocks to be verified, and verifying them in combination with prompt rule information, the problem that existing verification codes are easily identified and cracked is solved, and the security and protection capabilities of the verification code are improved.
Patent Information
- Application Number
- CN202111198467.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-14
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-10-14
AI Technical Summary
Existing verification codes are easily identified and cracked, and cannot effectively prevent malicious behaviors such as automatic batch registration.
By dividing the verification code picture into multiple original verification code blocks, adjusting the position and/or angle, and rearranging it, the verification code block to be verified, and verification is performed in combination with the prompt rule information.
It improves the difficulty of cracking verification codes, prevents machine cracking, and enhances the security of verification codes.
Smart Images

Figure CN113868620B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of verification codes, and in particular to a verification method, device and equipment for verification codes. Background Art
[0002] With current technology, generated verification codes come in many forms, such as random combinations of numbers and letters, images containing specific text or elements, randomly generated binary arithmetic operations, sliding verification codes, etc. Each type of verification code has a specific format. For example, digital verification is of fixed length, and image verification mostly uses a simple matching principle. Therefore, the verification code elements in the input scheme are easy to identify, with fewer complexity and associated elements, which makes them easy to crack and cannot effectively prevent malicious behaviors such as automatic batch registration. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide a verification code verification method that overcomes the above problems or at least partially solves the above problems.
[0004] According to one aspect of an embodiment of the present invention, a verification code verification method is provided, which is applied to a server, and the method includes:
[0005] Get the verification code image;
[0006] Segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order;
[0007] Rearranging the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order;
[0008] Sending the verification code block to be verified and prompt rule information to the client;
[0009] receiving a target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information;
[0010] Verify the position and / or included picture blocks of the target verification code block and the original verification code block to obtain a verification result, and send the verification result to the client.
[0011] According to another aspect of an embodiment of the present invention, a verification code verification method is provided, which is applied to a client, and the method includes:
[0012] Receive the verification code block to be verified and prompt rule information;
[0013] According to the verification code block to be verified, and in accordance with the prompt rule information, the position and / or angle rotation adjustment of the verification code block to be verified is performed to obtain a target verification code block;
[0014] Sending the target verification code block to the server;
[0015] Receive the verification result of the target verification code block from the server.
[0016] According to one aspect of an embodiment of the present invention, a verification code verification device is provided, which is applied to a server, and the device includes:
[0017] Acquisition module, used to obtain verification code images;
[0018] a processing module configured to segment the verification code image to obtain at least two original verification code blocks arranged in a first order; and rearrange the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order;
[0019] The transceiver module is configured to send the verification code block to be verified and the prompt rule information to the client; and receive the target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information;
[0020] The processing module is further configured to verify the positions and / or included image blocks of the target verification code block and the original verification code block, obtain a verification result, and send the verification result to the client.
[0021] According to another aspect of an embodiment of the present invention, a verification code verification device is provided, which is applied to a client, and the device includes:
[0022] The transceiver module is used to receive the verification code block to be verified and the prompt rule information;
[0023] a processing module, configured to adjust the position and / or rotation angle of the verification code block to be verified according to the prompt rule information, to obtain a target verification code block;
[0024] The transceiver module is further configured to send the target verification code block to the server; and receive a verification result of the target verification code block from the server.
[0025] According to another aspect of an embodiment of the present invention, there is provided a computing device, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;
[0026] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the verification method of the verification code.
[0027] According to another aspect of the embodiments of the present invention, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to execute operations corresponding to the verification method of the verification code as described above.
[0028] According to the solution provided by the above-mentioned embodiment of the present invention, the verification method of the verification code can be carried out by obtaining a verification code image; segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order; rearranging the at least two original verification code blocks arranged in the first order to obtain a verification code block to be verified arranged in a second order; sending the verification code block to be verified and prompt rule information to the client; receiving the target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information; verifying the position and / or the included picture blocks of the target verification code block and the original verification code block to obtain a verification result, and sending the verification result to the client, thereby solving the problems of the verification code being easy to crack and the complexity and related elements being few, and achieving the beneficial effects of effectively increasing the difficulty of cracking the verification code and preventing the verification code from being cracked by a machine.
[0029] The above description is only an overview of the technical solutions of the embodiments of the present invention. In order to more clearly understand the technical means of the embodiments of the present invention, they can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiments of the present invention more obvious and easy to understand, the specific implementation methods of the embodiments of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the embodiments of the present invention. The same reference numerals are used throughout the accompanying drawings to denote the same components. In the accompanying drawings:
[0031] Figure 1 A flowchart of a verification code verification method applied to a server provided by an embodiment of the present invention is shown;
[0032] Figure 2 A schematic diagram of the process of obtaining a verification code block to be verified in a specific embodiment provided by the present invention is shown;
[0033] Figure 3 A schematic diagram showing a visibility area in a specific embodiment provided by the present invention;
[0034] Figure 4 A schematic diagram showing a picture block of a verification code block in a specific embodiment provided by the present invention is shown;
[0035] Figure 5A flowchart of a verification code verification method applied to a client provided by another embodiment of the present invention is shown;
[0036] Figure 6 A schematic diagram of a process for a user to adjust the position and / or rotation angle of a verification code block to be verified according to an embodiment of the present invention is shown;
[0037] Figure 7 A schematic diagram of the structure of a verification code verification device applied to a server provided by an embodiment of the present invention is shown;
[0038] Figure 8 A schematic diagram of the structure of a verification code verification device applied to a client provided by an embodiment of the present invention is shown;
[0039] Figure 9 A schematic structural diagram of a computing device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0040] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0041] Figure 1 FIG. 1 shows a flow chart of a verification method for a verification code applied to a server according to an embodiment of the present invention. Figure 1 As shown, the method includes the following steps:
[0042] Step 11, obtain the verification code image;
[0043] Step 12: segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order;
[0044] Step 13, rearranging the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order;
[0045] Step 14: Send the verification code block to be verified and the prompt rule information to the client;
[0046] Step 15: receiving a target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information;
[0047] Step 16: Verify the position and / or included image blocks of the target verification code block and the original verification code block, obtain a verification result, and send the verification result to the client.
[0048] In this embodiment, the acquired verification code image is segmented to obtain at least two original verification code blocks arranged in a first order, and the at least two original verification code blocks arranged in the first order are rearranged to obtain a verification code block to be verified arranged in a second order; the verification code block to be verified and prompt rule information are sent to the client, and the prompt rule information is used to guide the user of the client to adjust the position and / or rotate the angle of the verification code block to be verified to obtain a target verification code block. The user of the client adjusts the position and / or rotates the angle of the verification code block to be verified according to the prompt rule information to obtain the target verification code block. The server receives the target verification code block submitted by the client, verifies the position and / or the image block included in the target verification code block, and sends the verification result to the client. This effectively increases the difficulty of cracking the verification code to prevent the verification code from being cracked by a machine.
[0049] It should be noted that the first order of the at least two original verification code blocks is preferably the logical order of the at least two original verification codes obtained after the verification code image is segmented; and the at least two original verification code blocks arranged in the first order are rearranged to obtain verification code blocks to be verified arranged in a second order, where the second order preferably includes an order obtained by adjusting the positions and / or rotating the at least two original verification codes; if the verification code image is rectangular, the verification code block is preferably at least two rectangular images obtained by vertically segmenting the rectangular verification code image, and each rectangular image is a cylindrical verification code block formed by butting two opposite wide sides or long sides together, but the present application is not limited to this, and the verification code block may also be a three-dimensional shape such as a cuboid, a cube, or a triangular pyramid;
[0050] Figure 2 FIG. 1 shows a flow chart of obtaining a verification code block to be verified in a specific embodiment of the present invention. Figure 2 As shown in a specific embodiment, the server obtains a verification code image with vertices O, W, M, and H, wherein the origin of the coordinate axis is point O, the coordinates of point O are O(0, 0), the positive direction of the X axis is from left to right, the positive direction of the Y axis is from top to bottom, the line segments OW and HM are the lengths of the verification code image, and l OW =w,l HM =w, line segments OH and WM are the width of the verification code image, l OH =h,l WM =h;
[0051] Connect the long sides of the verification code image, that is, connect the line segment OW and the line segment HM to form a cylindrical verification code block. The total area of the verification code block image block S1 = w * h is the surface area S2 of the cylindrical verification code block; with four lines x parallel to the positive direction of the Y axis 11x 12 、x 21 x 22 、x 31 x 32 and x 41 x 42 Segment the verification code image to form five segmented verification code blocks. Rearrange the segmented verification code blocks to obtain the verification code block to be verified, and send it to the client for verification.
[0052] Specifically:
[0053] Step 1: The segmented verification code blocks include X0, X1, X2, X3 and X4 in sequence;
[0054] Step 2: Adjust the position of the segmented verification code blocks. The adjusted verification code blocks include X3, X1, X2, X0, and X4 in sequence.
[0055] Step 3, perform angle rotation adjustment on the position-adjusted verification code block. The position-adjusted verification code block includes X3, X1, X2, X0 and X4 in sequence. The verification code block after angle rotation adjustment is marked with a dotted line. The verification code block after angle rotation adjustment includes X3', X1', X2', X0' and X4.
[0056] In an optional embodiment of the present invention, step 13 includes:
[0057] Step 131 : performing position adjustment and / or angle rotation adjustment on at least one of the at least two original verification code blocks arranged in the first order to obtain a verification code block to be verified arranged in the second order.
[0058] In this embodiment, the rearrangement of the at least two original verification code blocks arranged in the first order includes position adjustment and / or angle rotation adjustment of the at least two original verification code blocks arranged in the first order.
[0059] Optionally, step 131 includes:
[0060] Step 1311: Using a first random function, for the at least two original verification code blocks arranged in the first order, generate a swap list in which at least one original verification code block is position-adjusted.
[0061] Step 1312: Using a second random function, for the at least two original verification code blocks arranged in the first order, generate a rotation list in which at least one original verification code block is subjected to angle rotation adjustment.
[0062] Step 1313: Perform position adjustment and angle rotation adjustment on at least one of the at least two original verification code blocks according to the interchange list and the rotation list to generate a verification code block to be verified.
[0063] In this embodiment, according to the first random function, an exchange list is generated after the position of at least one original verification code block is adjusted. The number of random exchange positions generated in the exchange list is (qp), that is, at least q exchanges and at most p exchanges. Then, the original verification code blocks to be exchanged are randomly selected. The number of original verification code blocks is N, and the labels of the original verification code blocks are [0, N-1]. An original verification code block is randomly selected from the label range of the original verification code blocks [0, m-1] and [m+1, N-1] and is recorded as the original verification code block n. Then, an element "mn" in the exchange list is generated, where "mn" represents an exchange record of the original verification code block, m is the label of the original verification code block m, and n is the number of the original verification code block n. Label; It should be noted that the randomly generated element "mn" is an element that does not exist in the current interchange list, that is, the current interchange list preferably does not contain the same element information; according to the second random function, a rotation list is generated after at least one original verification code block is angle-rotated, and the elements in the rotation list are random numbers generated by the second random function between [-180°, 180°], a positive value of the random number indicates clockwise rotation, and a negative value indicates counterclockwise rotation. Of course, a positive value of the random number may also indicate counterclockwise rotation, and a negative value indicates clockwise rotation; the elements in the rotation list preferably correspond to the number of original verification code blocks, that is, each original verification code block corresponds to an element in the rotation list, and when the original verification code block does not undergo angle rotation adjustment, its angle rotation adjustment is 0°;
[0064] In an optional embodiment of the present invention, after step 12, the following steps are further included:
[0065] A cutting point list is generated based on the at least two original verification code blocks arranged in the first order; the elements in the cutting point list are the offsets corresponding to each original verification block, and the offsets are the offsets obtained by multiplying the average length of the original verification code blocks by the offset coefficient obtained by a third random function within a preset offset coefficient range.
[0066] In this embodiment, it should be noted that, based on at least two original verification code blocks arranged in the first order obtained after the segmentation process, a cutting point list is generated. The elements in the cutting point list are the offsets corresponding to each original verification code block. The average length of the original verification code blocks in the verification code image is l ave The offset is the offset coefficient obtained by the third random function within a preset offset coefficient range and the average length is lave The offset obtained by multiplication can be used to split the verification code image into several original verification code blocks, and the length of each original verification code block is within the offset corresponding to the preset offset coefficient range;
[0067] According to the swap list generated by the first random function, at least one original verification code block among the at least two original sub-verification code blocks is positionally adjusted, and then according to the rotation list generated by the second random function, at least one original verification code block among the at least two original verification code blocks after the position adjustment is rotationally adjusted to generate a verification code block to be verified; this effectively increases the difficulty for the client to crack the verification code.
[0068] Optionally, step 1314 includes:
[0069] Step 13141: traverse the at least two original verification code blocks according to the rotation list, adjust the position of at least one original verification code block among the at least two original sub-verification code blocks, and obtain at least two original verification code blocks after position adjustment; traverse the at least two original verification code blocks after position adjustment according to the rotation list, and obtain at least one original verification code block to be rotated and adjusted.
[0070] Step 13142, determining whether at least one original verification code block has been position adjusted;
[0071] Step 13143: If at least one original verification code block has not been position-adjusted, then angle-rotate the at least one original verification code block to obtain a verification code block to be verified.
[0072] Step 13144: If at least one original verification code block has been position-adjusted, perform angle rotation adjustment on the at least one original verification code block, and perform angle rotation adjustment in the opposite direction on the position-adjusted original verification code block corresponding to the at least one original verification code block to obtain a verification code block to be verified.
[0073] In this embodiment, according to the rotation list generated by the second random function, traverse the at least two original verification code blocks to obtain at least one original verification code block to be adjusted by angle rotation, and determine whether the at least one original verification code block to be adjusted by angle rotation has been adjusted in position, that is, whether the label of the at least one original verification code block to be adjusted by angle rotation is the label m in the element "m-n" of the above swap list; if the at least one original verification code block to be adjusted by angle rotation has been adjusted in position, then first adjust the angle rotation of the original verification code block with label m, and then adjust the angle rotation of the original verification code block with label n in the opposite direction; if the at least one original verification code block to be adjusted by angle rotation has not been adjusted in position, then only the original verification code block with label m needs to be adjusted by angle rotation; judge and adjust the angle rotation for each original verification code block to be adjusted by angle rotation to obtain the verification code block to be verified; on the basis of position adjustment, further perform angle rotation adjustment, which increases the cracking difficulty of the verification code and can prevent the verification code from being machine-learned and cracked;
[0074] It should be noted that the element "m-n" in the swap list is different from the element "n-m". The element "m-n" in the swap list means that the original verification code block with label m and the original verification code block with label n have been swapped in position, and it also means that when the original verification code block with label m is adjusted by angle rotation, the original verification code block with label n is adjusted by angle rotation in the opposite direction at the same time; if the element in the swap list is "n-m", it means that the original verification code block with label n and the original verification code block with label m have been swapped in position, and it also means that when the original verification code block with label n is adjusted by angle rotation, the original verification code block with label m is adjusted by angle rotation in the opposite direction at the same time.
[0075] In a specific embodiment, the server obtains a verification code picture composed of points O, W, M, and H. Among them, the length of the verification code picture is h, the width is w, and the resolution is 720p, that is, the size of the verification code picture is 1280*720, then h = 720, w = 1280. Let the number of divided verification code blocks be N, and generate a cutting point list XList; generate a rotation list for the N verification code blocks according to the first random function, and the value range of the elements in the rotation list is [-180°, 180°], and the rotation list is denoted as RotAngList; generate a swap list according to the second random function, and the swap list is denoted as TransList, and the format of the elements in the swap list is "m-n", where m and n are the subscripts of the verification code blocks. Since the upper limit of the number of verification code blocks is N, the value range of m is 0 <= m < N, and the value range of n is 0 <= n < N;
[0076] Specifically, generating the cutting point list XList includes:
[0077] 1.1 Calculate the average length of the verification code blocks after segmentation: BaseEleW = w / N, where BaseEleW is the average length of the verification code blocks, w is the width of the verification code image, and N is the number of verification code blocks after segmentation;
[0078] 1.2 According to the preset offset coefficient range, obtain the offset offset = BaseEleW * (-0.3 to 0.3), where offset is the offset of the verification code block, BaseEleW is the average length of the verification code block, and (-0.3 to 0.3) is the preset offset coefficient range;
[0079] 1.3 Based on the average length and offset of the verification code block, obtain the element value in the cutting point list XList, XList[i+1] = (i+1)*BaseEleW+offset[i], where XList[i+1] is the x-axis coordinate of the cutting point of the i-th verification code block in XList, BaseEleW is the average length of the verification code block, and offset[i] is the offset of the i-th verification code block;
[0080] Generating the rotation list RotAngList includes:
[0081] 2.1 Generate a random number corresponding to the verification code block in the range of [-180°, 180°] according to a second random function. A positive value of the random number represents a clockwise rotation, and a negative value represents a counterclockwise rotation. The elements in the rotation list RotAngList correspond one-to-one to the verification code block.
[0082] Generating the swap list TransList includes:
[0083] 3.1 The number of random swaps is (1-3), i.e. at least 1 swap and at most 3 swaps;
[0084] 3.2 Randomly select the verification code blocks to be exchanged, and obtain the exchange list TransList = ["0-3", "1-2"].
[0085] The swap list TransList, rotation list RotAngList, cutting point list XList and verification code picture are processed by the program. The verification code picture is img. Taking the Python language representation as an example, the i-th verification code block after segmentation is img[:,XList[i]:XList[i+1],:], and the first image list ImgList of the verification code block is generated. The values at both ends of the first image list ImgList are:
[0086] ImgList[0]=img[:,0:XList[0],:];
[0087] ImgList[N-1]=img[:,XList[N-2]:w,:];
[0088] According to the swap list TransList, the position of the verification code block is adjusted to obtain the second image list of the adjusted verification code block; according to the rotation list RotAngList, the verification code block is rotated and adjusted in angle, and all the verification code blocks are traversed to rotate the verification code block. When the verification code block Ei is rotated, it is determined whether the verification code block Ei has been adjusted in position, that is, whether the label of the verification code block Ei exists in the position m of the element "mn" in the swap list TransList; if not, the verification code block Ei cylinder is rotated and adjusted in angle according to the value of RotAngList[i]; if so, the verification code block Ei cylinder is first rotated and adjusted in angle according to the value of RotAngList[i], and then the Ej cylinder is rotated in the opposite direction with the same value. It should be noted that Ei and Ej are an element "Ei-Ej" in the swap list TransList. When it is a verification code block When the label Ei and the label Ej of the verification code block are an element in the interchange list TransList, the angle rotation adjustment of the verification code block Ei corresponding to "Ei-Ej" will drive the angle rotation adjustment of the verification code block Ej with the same angle value in the opposite direction, but the angle rotation adjustment of the verification code block Ej will not drive the angle rotation adjustment of the verification code block Ei with the same angle value in the opposite direction; the angle rotation adjustment of the verification code block Ej corresponding to "Ej-Ei" will drive the angle rotation adjustment of the verification code block Ei with the same angle value in the opposite direction, but the angle rotation adjustment of the verification code block Ei will not drive the angle rotation adjustment of the verification code block Ej with the same angle value in the opposite direction;
[0089] Figure 3 Schematic diagram of the visibility area in a specific embodiment of the present invention is shown. Figure 3 As shown, according to the information after position adjustment and angle rotation adjustment, the verification code blocks to be verified are formed in the second order, and the visibility area is obtained on the Y axis in proportion, that is, Figure 3 The area within the dotted box is invisible to the client user.
[0090] Figure 4 FIG. 1 shows a schematic diagram of a picture block of a verification code block in a specific embodiment provided by the present invention. Figure 4As shown, since the segmented verification code picture is used to generate a verification code block, the non-adjacent edges of the picture blocks are connected. Taking the verification code picture block corresponding to the first verification code block as an example, the formula ImgList[0]=img[:,0:XList[0],:] represents the picture of the first verification code block, with a fixed width and RGB (color system) channel number. When the picture of the first verification code block is w0, that is, XList[0]=w0, then ImgList[0]=img[0:h+1,0:w0+1,:], and the range it represents is Figure 4 The range of the shaded part shown in the figure; when the range of the visibility area is (0.25h, 0.75h), the array dimension can be simplified to obtain ImgList[0]=img[0:h+1], the one-dimensional array length is h, that is, the image height, the client user's visibility area is img[0.25*h:0.75*h+1], and the visibility area assignment during rotation is expressed as: visImg[x]=img[(x+T)%h], T is the distance moved when sliding the cylinder up and down, and % is the remainder of h, thereby achieving the connection between the head and the tail.
[0091] In an optional embodiment of the present invention, step 16 includes:
[0092] Verify the position of the target verification code block and the position of the original verification code block in terms of position and / or inclusion of the image block;
[0093] If the verification results are consistent, the image block of the target verification code block is verified with the image block of the original verification code block. If they are consistent, the verification result is passed.
[0094] In this embodiment, the verification of the target verification code block of the client includes position verification and image block matching verification. The position verification of the target verification code block can be performed by verifying the number of the target verification code block with the number of the original verification code block. When the numbers are consistent, the position verification passes. When the numbers are inconsistent, the verification result can be directly fed back to the client as a failure. The position and image block of the target verification code block and the original verification code block are verified, and the verification method is simple and effective.
[0095] Match the image block of the target verification code block with the image block of the original verification code block. Preferably, the hash value of the image can be used to match the image block of the original verification code block with the image block of the target verification code block in sequence. If all match, the verification is successful, and the verification result is successful, and the verification result is sent to the client as successful; if the verification is not successful, the verification result is failed, and the verification result is sent to the client as failed; wherein, the hash value includes difference hash, mean hash, perceptual hash and wavelet hash, etc.
[0096] In a specific embodiment, the verification code image is divided into 5 blocks, which are numbered from X0 to X4. When the server generates the verification code block to be verified, the position and / or angular rotation of the original verification code block is adjusted, and the adjusted verification code block to be verified is renumbered from Y0 to Y4. The numbers are sent to the client along with the verification code block to be verified. After receiving the number of the target verification code block sent back by the client, Y0 to Y4 are replaced with X0 to X4 according to the corresponding rules when renumbering. When the number of the target verification code block is consistent with the number of the original verification code block, the position verification is passed; if not, the verification result can be directly fed back to the client as failure; as shown in Table 1:
[0097] Original verification code block X0 X1 X2 X3 X4 Verification code block to be verified X3 X1 X2 X0 X4 Renumbered verification code block to be verified Y0 Y1 Y2 Y3 Y4 Target verification code block Y3 Y1 Y2 Y0 Y4 The converted target verification code block X0 X1 X2 X3 X4
[0098] Table 1
[0099] As shown in Table 1, the original verification code blocks are numbered X0, X1, X2, X3, and X4 in sequence; the verification code blocks to be verified after position adjustment and / or angle rotation adjustment are numbered X3, X1, X2, X0, and X4 in sequence; before being sent to the client by the server, the verification code blocks to be verified are renumbered, and the renumbered blocks are Y0, Y1, Y2, Y3, and Y4 in sequence; the target verification code blocks submitted by the client are numbered Y3, Y1, Y2, Y0, and Y4 in sequence. According to the corresponding rules when renumbering the target verification code blocks submitted by the client, the target verification code blocks submitted by the client are numbered X0, X1, X2, X3, and X4, which are consistent with the numbers of the original verification code blocks. Therefore, the position verification result in Table 1 is passed;
[0100] Match the image block of the target verification code block with the image block of the original verification code block. First, grayscale the image block using the difference hash method to remove the color factor in the image block. After grayscale, there is only one channel, and the processing speed is faster. Adjust the image size to 9*8, ignore the aspect ratio of the image block of the original verification code block, which is more conducive to judging image similarity. Calculate the difference and generate a 64-bit hash value. The 64-bit hash value can be obtained by the formula p[x]>p[x+1]=1else0. Compare the hash values and use the Hamming distance to determine whether the hash values are the same. If they are the same, the verification result is passed and the verification result is sent to the client. If not, the verification result is failed and the verification result is sent to the client.
[0101] It should be noted that if color must be considered, it can also be processed separately according to RGB channels and then unified at the end; the difference is the difference between two adjacent numbers, and 9 values can get 8 differences.
[0102] Figure 5FIG1 shows a flow chart of a verification method for a verification code applied to a client provided by another embodiment of the present invention. Figure 5 As shown, the method includes the following steps:
[0103] Step 51, receiving the verification code block to be verified and prompt rule information;
[0104] Step 52: adjusting the position and / or rotation angle of the verification code block to be verified according to the prompt rule information to obtain a target verification code block;
[0105] Step 53: Send the target verification code block to the server;
[0106] Step 54: Receive the verification result of the target verification code block from the server.
[0107] In this embodiment, the user of the client receives the verification code block to be verified and the prompt rule information generated by the server, and adjusts the position and / or angle of the verification code block to be verified according to the prompt rule information to obtain a target verification code block; sends the target verification code block to the server for verification to obtain a verification result; when the verification of the verification code is correctly completed according to the prompt rule information, the verification result is passed; when the verification of the verification code is not correctly completed according to the prompt rule information, the verification result is failed.
[0108] Figure 6 The following is a flow chart showing the process of adjusting the position and / or rotation angle of a verification code block to be verified by a user according to an embodiment of the present invention. Figure 6 As shown, in a specific embodiment, the client obtains the vertical distance obtained by the user through gesture movement, thereby obtaining the value of T. Since the user can see the visibility area, the image within the visibility area can be assigned and displayed through visImg[x]=img[(x+T)%h], thereby enabling the verification code block to be verified to slide up and down arbitrarily. The user of the client can see several verification code blocks to be verified arranged in sequence along the X-axis direction, showing the visibility area of the verification code block to be verified generated by the server. Each verification code block to be verified can be slid up and down to achieve the purpose of rotating and adjusting the angle of the verification code block to be verified, and the purpose of previewing the surface area of the verification code block to be verified can be achieved; at the same time, the verification code block to be verified can also be dragged and swapped;
[0109] Optionally, the user slides the verification code block to be verified up and down to realize the angle rotation adjustment of the verification code block to be verified, and the picture images in the visible area are matched with each other through the angle rotation adjustment of the verification code block to be verified, and the adjustment operation is completed and submitted for verification. When the user adjusts the position of the verification code block to be verified, the verification code block a to be verified and the verification code block b to be verified are exchanged after the linkage relationship is created, and the effect of the angle rotation adjustment of all verification code blocks to be verified is reset, that is, the user needs to re-rotate each cylinder, the user needs to readjust, and there is a linkage relationship at this time, which increases the difficulty and complexity of the operation.
[0110] It should be noted that this method is a method corresponding to the above-mentioned method applied to the server. All implementation methods in the above-mentioned verification code verification method embodiment applied to the server are applicable to the embodiment of this method and can achieve the same technical effect.
[0111] Figure 7 FIG. 1 shows a schematic diagram of a verification device for a verification code applied to a server according to an embodiment of the present invention. Figure 7 As shown, the device 70 includes:
[0112] An acquisition module 71 is used to obtain a verification code image;
[0113] The processing module 72 is configured to segment the verification code image to obtain at least two original verification code blocks arranged in a first order; and rearrange the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order.
[0114] The transceiver module 73 is configured to send the verification code block to be verified and the prompt rule information to the client; and receive the target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information;
[0115] The processing module 72 is further configured to verify the positions and / or included image blocks of the target verification code block and the original verification code block, obtain a verification result, and send the verification result to the client.
[0116] Optionally, after segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order, the method further includes:
[0117] A cutting point list is generated based on the at least two original verification code blocks arranged in the first order; the elements in the cutting point list are the offsets corresponding to each original verification block, and the offsets are the offsets obtained by multiplying the average length of the original verification code blocks by the offset coefficient obtained by a third random function within a preset offset coefficient range.
[0118] Optionally, after rearranging the at least two original verification code blocks arranged in the first order, obtaining verification code blocks to be verified arranged in the second order includes:
[0119] Performing position adjustment and / or angle rotation adjustment on at least one of the at least two original verification code blocks arranged in the first order to obtain a verification code block to be verified arranged in the second order.
[0120] Optionally, performing position adjustment and / or rotation angle adjustment on at least one of the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in the second order includes:
[0121] For the at least two original verification code blocks arranged in the first order, using a first random function, generating an interchange list after adjusting the position of at least one original verification code block;
[0122] For the at least two original verification code blocks arranged in the first order, using a second random function, to generate a rotation list after the angle rotation adjustment is performed on at least one original verification code block;
[0123] According to the interchange list and the rotation list, position adjustment and angle rotation adjustment are performed on at least one original verification code block of the at least two original sub-verification code blocks to generate a verification code block to be verified.
[0124] Optionally, performing position adjustment and angle rotation adjustment on at least one of the at least two original sub-verification code blocks according to the swap list and the rotation list to generate a verification code block to be processed includes:
[0125] According to the swap list, traverse the at least two original verification code blocks, adjust the position of at least one original verification code block in the at least two original sub-verification code blocks, and obtain at least two original verification code blocks after position adjustment; according to the rotation list, traverse the at least two original verification code blocks after position adjustment, and obtain at least one original verification code block to be rotated and adjusted;
[0126] Determining whether at least one original verification code block has been position adjusted;
[0127] If at least one original verification code block has not been position-adjusted, performing angle rotation adjustment on the at least one original verification code block to obtain a verification code block to be verified;
[0128] If at least one original verification code block has been position-adjusted, the at least one original verification code block is subjected to angle rotation adjustment, and the position-adjusted original verification code block corresponding to the at least one original verification code block is subjected to angle rotation adjustment in the opposite direction to obtain a verification code block to be verified.
[0129] It should be noted that the device 70 is a device corresponding to the above method, and all implementation methods in the above verification code verification method embodiment are applicable to the embodiment of the device 70 and can also achieve the same technical effect.
[0130] Figure 8 FIG. 1 shows a schematic diagram of a verification device for a verification code applied to a client provided by an embodiment of the present invention. Figure 8 As shown, the device 80 includes:
[0131] The transceiver module 81 is used to receive the verification code block to be verified and the prompt rule information;
[0132] The processing module 82 is configured to adjust the position and / or rotation angle of the verification code block to be verified according to the prompt rule information, to obtain a target verification code block;
[0133] The transceiver module 81 is further configured to send the target verification code block to the server and receive a verification result of the target verification code block from the server.
[0134] It should be noted that the device 80 is a device corresponding to the above method, and all implementation methods in the above verification code verification method embodiment are applicable to the embodiment of the device 80 and can also achieve the same technical effect.
[0135] An embodiment of the present invention provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the verification code verification method in any of the above method embodiments.
[0136] Figure 9 The schematic diagram of the structure of the computing device provided by the embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computing device.
[0137] like Figure 9 As shown, the computing device may include: a processor, a communication interface, a memory, and a communication bus.
[0138] The processor, communication interface, and memory communicate with each other via a communication bus. The communication interface is used to communicate with other devices, such as client devices or other server network elements. The processor is used to execute a program, specifically, the steps described in the embodiment of the verification method for calculating a verification code for a device.
[0139] Specifically, the program may include program codes including computer operation instructions.
[0140] The processor may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.
[0141] Memory is used to store programs. The memory may include high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk storage.
[0142] The program can be specifically used to cause the processor to execute the verification method of the verification code in any of the above-mentioned method embodiments. The specific implementation of each step in the program can refer to the corresponding description of the corresponding steps and units in the above-mentioned verification method embodiments, and will not be repeated here. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working process of the above-mentioned devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, and will not be repeated here.
[0143] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other device. Various general-purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the embodiment of the present invention is not directed to any specific programming language. It should be understood that various programming languages can be utilized to implement the content of the embodiment of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the embodiment of the present invention.
[0144] In the description provided herein, numerous specific details are described. However, it is understood that embodiments of the present invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.
[0145] Similarly, it should be understood that in order to streamline the embodiments of the invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed approach should not be interpreted as reflecting an intention that the claimed embodiments of the invention require more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all of the features of the individual embodiments disclosed above. Accordingly, the claims that follow the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the invention.
[0146] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0147] Furthermore, those skilled in the art will appreciate that although some embodiments herein include certain features included in other embodiments but not other features, combinations of features from different embodiments are intended to be within the scope of the present invention and to form different embodiments. For example, in the claims below, any of the claimed embodiments may be used in any combination.
[0148] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components according to the embodiments of the present invention. The embodiments of the present invention can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing an embodiment of the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0149] It should be noted that the above embodiments illustrate rather than limit the embodiments of the invention, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The embodiments of the invention may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments should not be understood as limiting the order of execution unless otherwise specified.
Claims
1. A verification code verification method, characterized in that: Applied to a server, the method includes: Get the verification code image; Segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order; wherein an offset corresponding to each original verification code block is an offset obtained by multiplying an offset coefficient obtained by a third random function within a preset offset coefficient range by an average length of the original verification code block, and the offset corresponding to the original verification code block is used to determine a position of a cutting point; Rearranging the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order; The second order is an order obtained after position adjustment and / or angle rotation adjustment of the original verification code blocks; for at least one original verification code block to be angle-rotated, if at least one original verification code block has been position-adjusted, the at least one original verification code block is angle-rotated, and the corresponding original verification code block of the at least one original verification code block that has been position-adjusted is angle-rotated in the opposite direction; Sending the verification code block to be verified and prompt rule information to the client; receiving a target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information; Verify the position and / or included picture blocks of the target verification code block and the original verification code block to obtain a verification result, and send the verification result to the client.
2. The verification code verification method according to claim 1, characterized in that: After segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order, the method further includes: A cutting point list is generated according to the at least two original verification code blocks arranged in the first order; the elements in the cutting point list are offsets corresponding to each original verification code block.
3. The verification code verification method according to claim 1, characterized in that: After rearranging the at least two original verification code blocks arranged in the first order, obtaining verification code blocks to be verified arranged in the second order, comprising: Performing position adjustment and / or angle rotation adjustment on at least one of the at least two original verification code blocks arranged in the first order to obtain a verification code block to be verified arranged in the second order.
4. The verification code verification method according to claim 3, characterized in that: Adjusting the position and / or the rotation angle of at least one of the at least two original verification code blocks arranged in the first order to obtain a verification code block to be verified arranged in the second order includes: For the at least two original verification code blocks arranged in the first order, using a first random function, generating an interchange list after adjusting the position of at least one original verification code block; For the at least two original verification code blocks arranged in the first order, using a second random function, to generate a rotation list after the angle rotation adjustment is performed on at least one original verification code block; According to the interchange list and the rotation list, position adjustment and angle rotation adjustment are performed on at least one original verification code block of the at least two original sub-verification code blocks to generate a verification code block to be verified.
5. The verification code verification method according to claim 4, characterized in that: According to the swap list and the rotation list, performing position adjustment and angle rotation adjustment on at least one original verification code block of the at least two original sub-verification code blocks to generate a verification code block to be processed, comprising: According to the swap list, traverse the at least two original verification code blocks, adjust the position of at least one original verification code block in the at least two original sub-verification code blocks, and obtain at least two original verification code blocks after position adjustment; according to the rotation list, traverse the at least two original verification code blocks after position adjustment, and obtain at least one original verification code block to be rotated and adjusted; Determining whether at least one original verification code block has been position adjusted; If the position of at least one original verification code block has not been adjusted, then an angle rotation adjustment is performed on the at least one original verification code block to obtain a verification code block to be verified.
6. A verification code verification method, characterized in that: Applied to a client, the method includes: Receive the verification code block to be verified and prompt rule information; The server generates the verification code block to be verified through the following steps: Get the verification code image; Segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order; wherein an offset corresponding to each original verification code block is an offset obtained by multiplying an offset coefficient obtained by a third random function within a preset offset coefficient range by an average length of the original verification code block, and the offset corresponding to the original verification code block is used to determine the position of the segmentation point; and rearranging the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order; The second order is an order obtained after position adjustment and / or angle rotation adjustment of the original verification code blocks; for at least one original verification code block to be angle-rotated, if at least one original verification code block has been position-adjusted, the at least one original verification code block is angle-rotated, and the corresponding original verification code block of the at least one original verification code block that has been position-adjusted is angle-rotated in the opposite direction; According to the verification code block to be verified, and in accordance with the prompt rule information, the position and / or angle rotation adjustment of the verification code block to be verified is performed to obtain a target verification code block; Sending the target verification code block to the server; Receive the verification result of the target verification code block from the server.
7. A verification code verification device, characterized in that: Applied to a server, the device includes: Acquisition module, used to obtain verification code images; a processing module configured to segment the verification code image to obtain at least two original verification code blocks arranged in a first order; and rearrange the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order; The offset corresponding to each original verification code block is an offset obtained by multiplying an offset coefficient obtained by a third random function within a preset offset coefficient range by the average length of the original verification code block. The offset corresponding to the original verification code block is used to determine the position of the cutting point. The second order is an order obtained after position adjustment and / or angle rotation adjustment of the original verification code blocks; for at least one original verification code block to be angle-rotated, if at least one original verification code block has been position-adjusted, the at least one original verification code block is angle-rotated, and the corresponding original verification code block of the at least one original verification code block that has been position-adjusted is angle-rotated in the opposite direction; The transceiver module is configured to send the verification code block to be verified and the prompt rule information to the client; and receive the target verification code block submitted by the client according to the verification code block to be verified and the prompt rule information; The processing module is further configured to verify the positions and / or included image blocks of the target verification code block and the original verification code block, obtain a verification result, and send the verification result to the client.
8. A verification code verification device, characterized in that: Applied to a client, the device includes: The transceiver module is used to receive the verification code block to be verified and the prompt rule information; The server generates the verification code block to be verified through the following steps: Get the verification code image; Segmenting the verification code image to obtain at least two original verification code blocks arranged in a first order; wherein an offset corresponding to each original verification code block is an offset obtained by multiplying an offset coefficient obtained by a third random function within a preset offset coefficient range by an average length of the original verification code block, and the offset corresponding to the original verification code block is used to determine a position of a cutting point; Rearranging the at least two original verification code blocks arranged in the first order to obtain verification code blocks to be verified arranged in a second order; The second order is an order obtained after position adjustment and / or angle rotation adjustment of the original verification code blocks; for at least one original verification code block to be angle-rotated, if at least one original verification code block has been position-adjusted, the at least one original verification code block is angle-rotated, and the corresponding original verification code block of the at least one original verification code block that has been position-adjusted is angle-rotated in the opposite direction; a processing module, configured to adjust the position and / or rotation angle of the verification code block to be verified according to the prompt rule information, to obtain a target verification code block; The transceiver module is further configured to send the target verification code block to the server; and receive a verification result of the target verification code block from the server.
9. A computing device comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the verification method of the verification code according to any one of claims 1 to 5 or an operation corresponding to the verification method of the verification code according to claim 6.
10. A computer storage medium storing at least one executable instruction, wherein the executable instruction causes a processor to execute an operation corresponding to the verification method of a verification code according to any one of claims 1 to 5 or an operation corresponding to the verification method of a verification code according to claim 6.
Citation Information
Patent Citations
Verification code implementation method, electronic equipment and computer readable storage medium
CN113158167A