A method and apparatus for authentication
By generating logically related multi-image CAPTCHAs, the problem of traditional CAPTCHAs being easily recognized by machines is solved, increasing the difficulty of cracking them while ensuring user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional CAPTCHAs are easily recognized by machines, resulting in a poor user experience. Furthermore, with the development of OCR and artificial intelligence technologies, the success rate of recognition has increased, making it difficult to balance the difficulty of cracking with the user experience.
The system generates CAPTCHAs with fixed and replaceable image display positions. The fixed position displays an image that cannot be changed, while the other positions display replaceable images. The CAPTCHAs are generated through logical association, and the machine cannot recognize the logical judgment.
It increases the difficulty for machines to crack CAPTCHAs, ensures user experience, avoids interference with the user verification process, and the logical association update increases the difficulty of cracking.
Smart Images

Figure CN114329412B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet technology, and in particular to a verification method and a verification device. Background Technology
[0002] Traditional CAPTCHAs rely on recognizing text, objects, and trajectories within images. They generate images using random characters, numbers, or objects, and then perform number, text, and object recognition within the image. For example, they might identify the content or the positional relationship between objects. Alternatively, they might present two images or one image with a trajectory, prompting the user to slide along the trajectory to the corresponding location. However, using artificial intelligence makes content recognition and trajectory position determination much easier.
[0003] In traditional CAPTCHA images, various techniques are used during the image generation process to prevent machine recognition, such as background interference, noise pixels, font deformation and font sticking, random character positions and indefinite numbers, color inversion, and even blurring the image to reduce the risk of machine recognition.
[0004] However, the following defects still exist:
[0005] 1) With the continuous development and innovation of OCR, artificial intelligence, machine learning and other technologies, the recognition success rate of traditional character-based image verification codes has been greatly improved, even surpassing the recognition ability of the human eye.
[0006] 2) Due to the use of various interference factors, although the recognition efficiency of the program's automatic recognition algorithm is reduced, the user experience for normal users is also getting worse. A balance cannot be achieved between user experience and the difficulty of cracking the software. Summary of the Invention
[0007] In view of the above problems, embodiments of the present invention are proposed to provide a verification method and a corresponding verification apparatus that overcome or at least partially solve the above problems.
[0008] To address the above problems, this invention discloses a verification method, the method comprising:
[0009] When a verification event is detected, a verification code to be displayed is generated; the verification code is set with at least two image display positions, including a fixed display position and other display positions, the fixed display position is used to display a first image that cannot be changed, and the other display positions are used to display a second image that can be changed.
[0010] Display the verification code;
[0011] In response to a replacement instruction for a second image in any other display position, replace any second image with a candidate second image to obtain an updated verification code;
[0012] In response to the verification command, the updated verification code is verified to obtain the verification result.
[0013] In one or more embodiments, generating the verification code to be displayed includes:
[0014] A target image set is obtained from a preset image database; the target image set includes at least two images with a positional order.
[0015] A first number of target image sequences, whose positions are consecutive, are selected from the at least two images; the first number is the same as the number of image display positions.
[0016] Take any one of the images in the target image sequence as the first image, and take the other images as the correct images for detecting whether the verification is successful;
[0017] Obtain a second number of arbitrary images from the image database, excluding the target image set, as the second image; the second number is the same as the number of the other display positions.
[0018] The position of the first image in the target image sequence is taken as the first position of the fixed display position in the preset verification code component, and the position of the second image in the target image sequence is taken as the second position of the other display positions in the verification code component;
[0019] The first image is added to the first position in the verification code component, and the second image is added to the second position respectively. Based on the position of the correct image in the target image sequence, the association relationship between the correct image and the other display positions is generated to obtain the verification code to be displayed.
[0020] In one or more embodiments, the image database includes at least one image set; wherein any image set is generated in the following manner:
[0021] Obtain the original resolution of the image to be processed;
[0022] The original resolution is scaled proportionally based on a preset first resolution to obtain a scaled image.
[0023] The scaled image is cropped based on a preset second resolution to obtain a cropped image.
[0024] The cropped image is divided into an average number based on a preset third number to obtain an image set; the image set includes the third number of segmented images, each segmented image has the same resolution and a unique order; the third number is not less than the number of all image display positions in the verification code component.
[0025] In one or more embodiments, replacing any second image with a candidate second image in response to a replacement instruction for a second image in any other display position includes:
[0026] In response to an update instruction for a second image in any other display position, the correct image associated with the other display position is obtained from the image database based on a preset probability.
[0027] If the correct image is successfully obtained, the correct image is used as the candidate second image to replace the second image;
[0028] If obtaining the correct image fails, the current image obtained will be used as the candidate second image to replace the second image.
[0029] In one or more embodiments, if obtaining the correct image fails, the method further includes:
[0030] Check whether the number of consecutive update instructions has reached a threshold.
[0031] If so, the preset probability corresponding to the next update instruction will be adjusted to 100%.
[0032] In one or more embodiments, the step of verifying the updated verification code in response to a verification command to obtain a verification result includes:
[0033] In response to the verification command, it is checked whether all the candidate second images corresponding to the other display positions are correct images;
[0034] If yes, the verification is considered successful; otherwise, the verification is considered unsuccessful.
[0035] Accordingly, embodiments of the present invention disclose a verification device, the device comprising:
[0036] A generation module is used to generate a verification code to be displayed when a verification event is detected. The verification code is provided with at least two image display positions, including a fixed display position and other display positions. The fixed display position is used to display a first image that cannot be changed, and the other display positions are used to display a second image that can be changed.
[0037] The display module is used to display the verification code;
[0038] The update module is used to replace any second image with a candidate second image in response to a replacement instruction for any other display position, thereby obtaining an updated verification code.
[0039] The verification module is used to verify the updated verification code in response to the verification command and obtain the verification result.
[0040] In one or more embodiments, the generation module includes:
[0041] The first acquisition submodule is used to acquire a target image set from a preset image database; the target image set includes at least two images with a positional order;
[0042] The selection submodule is used to select a first number of target image sequences that are sequentially ordered from the at least two images; the first number is the same as the number of image display positions.
[0043] The first processing submodule is used to take any one of the images in the target image sequence as the first image, and to take the other images as the correct images for detecting whether the verification is passed.
[0044] The second processing submodule is used to obtain a second number of arbitrary images from the image database, excluding the target image set, as the second image; the second number is the same as the number of the other display positions;
[0045] The third processing submodule is used to take the position of the first image in the target image sequence as the first position of the fixed display position in the preset verification code component, and take the position of the second image in the target image sequence as the second position of the other display positions in the verification code component.
[0046] The fourth processing submodule is used to add the first image to the first position in the verification code component, and add the second image to the second position respectively, and generate the association relationship between the correct image and the other display positions based on the position of the correct image in the target image sequence, so as to obtain the verification code to be displayed.
[0047] In one or more embodiments, the image database includes at least one image set; the apparatus further includes:
[0048] The acquisition module is used to obtain the original resolution of the image to be processed;
[0049] The scaling module is used to scale the original resolution proportionally based on a preset first resolution to obtain a scaled image.
[0050] The cropping module is used to crop the scaled image based on a preset second resolution to obtain a cropped image;
[0051] The splitting module is used to perform average segmentation on the cropped image based on a preset third number to obtain an image set; the image set includes the third number of segmented images, each segmented image has the same resolution and a unique sequential order; the third number is not less than the number of all image display positions in the verification code component.
[0052] In one or more embodiments, the update module includes:
[0053] The second acquisition submodule is used to, in response to an update instruction for the second image in any other display position, acquire the correct image that is associated with the other display position from the image database based on a preset probability.
[0054] The fifth processing submodule is configured to, if the correct image is successfully acquired, use the correct image as the candidate second image to replace the second image; and,
[0055] If obtaining the correct image fails, the current image obtained will be used as the candidate second image to replace the second image.
[0056] In one or more embodiments, it further includes:
[0057] The first detection submodule is used to detect whether the number of consecutive update instructions has reached a threshold if the acquisition of the correct image fails.
[0058] The adjustment submodule is used to adjust the preset probability corresponding to the next update instruction to 100%.
[0059] In one or more embodiments, the verification module includes:
[0060] The second detection submodule is used to detect, in response to the verification command, whether all the candidate second images corresponding to the other display positions are correct images;
[0061] The determination module is used to determine whether the verification passes or fails.
[0062] Accordingly, this invention discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various steps of the above-described verification method embodiments.
[0063] Accordingly, embodiments of the present invention disclose a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the various steps of the above-described verification method embodiments.
[0064] The embodiments of the present invention have the following advantages:
[0065] When a verification event is detected, a verification code to be displayed is generated. The verification code has at least two image display positions, including a fixed display position and other display positions. The fixed display position is used to display a first image that cannot be changed, and the other display positions are used to display a second image that can be changed. The verification code is then displayed. In response to a replacement instruction for the second image in any of the other display positions, any second image is replaced with a candidate second image, resulting in an updated verification code. In response to a verification instruction, the updated verification code is verified to obtain a verification result. Because there is a logical relationship between the multiple images in the verification code, and this logical relationship needs to be judged based on human cognition rather than simple machine recognition, the machine cannot make logical judgments on verification codes containing multiple images, thus increasing the difficulty for the machine to crack the verification code. At the same time, since no interference factors are needed, the user's verification process will not be interfered with, thus ensuring the user experience. Moreover, the logical relationship between the multiple images is updated every time the image is changed. This multi-level logical judgment is also unrecognizable by the machine, further increasing the difficulty for the machine to crack the verification code. Attached Figure Description
[0066] Figure 1 This is a flowchart illustrating the steps of an embodiment of the verification method of the present invention;
[0067] Figure 2 This is a verification code illustration of an embodiment of the verification method of the present invention. Figure 1 ;
[0068] Figure 3 This is a schematic diagram of image scaling according to an embodiment of the verification method of the present invention;
[0069] Figure 4 This is a schematic diagram of image cropping according to an embodiment of the verification method of the present invention;
[0070] Figure 5 This is a verification code illustration of an embodiment of the verification method of the present invention. Figure 2 ;
[0071] Figure 6 This is a verification code illustration of an embodiment of the verification method of the present invention. Figure 3 ;
[0072] Figure 7 This is a verification code illustration of an embodiment of the verification method of the present invention. Figure 4 ;
[0073] Figure 8 This is a verification code illustration of an embodiment of the verification method of the present invention. Figure 5 ;
[0074] Figure 9 This is a structural block diagram of an embodiment of the verification device of the present invention. Detailed Implementation
[0075] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0076] Reference Figure 1 The diagram illustrates a step flowchart of a verification method according to an embodiment of the present invention, which may specifically include the following steps:
[0077] Step 101: When a verification event is detected, a verification code to be displayed is generated; the verification code is set with at least two image display positions, the at least two image display positions include fixed display positions and other display positions, the fixed display positions are used to display a first image that cannot be changed, and the other display positions are used to display a second image that can be changed.
[0078] In this embodiment of the invention, a verification event can be any event that verifies a user's identity using a verification code. For example, when a user logs into an application, the application verifies the user's identity, so verifying the identity can be a verification event; similarly, when a user shops in an application, verification is performed during payment, so this verification can also be a verification event.
[0079] The application can be installed on a terminal, which can have the following characteristics:
[0080] (1) In terms of hardware, the device has a central processing unit, memory, input components, and output components. In other words, the device is often a microcomputer device with communication capabilities. In addition, it can have multiple input methods, such as keyboard, mouse, touch screen, microphone, and camera, and the input can be adjusted as needed. At the same time, the device often has multiple output methods, such as receiver, display screen, etc., which can also be adjusted as needed;
[0081] (2) In terms of software, the device must have an operating system, such as Windows Mobile, Symbian, Palm, Android, iOS, etc. At the same time, these operating systems are becoming increasingly open, and personalized applications developed based on these open operating system platforms are emerging in an endless stream, such as address books, calendars, notepads, calculators, and various games, which greatly meet the needs of personalized users;
[0082] (3) In terms of communication capabilities, the device has flexible access methods and high bandwidth communication performance, and can automatically adjust the selected communication method according to the selected service and the environment, thus facilitating user use. The device can support mobile communication based on 3GPP (3rd Generation Partnership Project), 4GPP (4th Generation Partnership Project), 5GPP (5th Generation Partnership Project), LTE (Long Term Evolution), and WIMAX (World Interoperability for Microwave Access), computer network communication based on TCP / IP (Transmission Control Protocol / Internet Protocol) and UDP (User Datagram Protocol), as well as short-range wireless transmission based on Bluetooth and infrared transmission standards. It not only supports voice services, but also a variety of wireless data services.
[0083] (4) In terms of functionality, the equipment places greater emphasis on humanization, personalization, and multi-functionality. With the development of computer technology, the equipment has shifted from a "device-centric" model to a "human-centric" model, integrating embedded computing, control technology, artificial intelligence technology, and biometric authentication technology, fully embodying the principle of human-centeredness. Due to the development of software technology, the equipment can be customized according to individual needs, becoming more personalized. At the same time, the equipment itself integrates numerous software and hardware components, making its functions increasingly powerful.
[0084] Furthermore, the generated verification code has at least two image display positions, which include a fixed display position and other display positions. The fixed display position is used to display an image that cannot be changed (denoted as the first image), while the other display positions are used to display images that can be changed (denoted as the second image), such as... Figure 2The generated CAPTCHA shown has four image display positions, namely: Figure 1 , Figure 2 , Figure 3 and Figure 4 .in, Figure 1 The first image is a 3-bit image. Figure 2 , Figure 3 and Figure 4 All images are second images.
[0085] It should be noted that the number of fixed display positions and the number of other display positions can be set according to actual needs. For example, if the verification code has 4 image display positions, it can include 1 fixed display position and 3 other display positions, or it can include 2 fixed display positions and 2 other display positions, or it can be set to other numbers. This embodiment of the invention does not limit this. For ease of description, this embodiment of the invention will be described in detail with the verification code having 4 image display positions, including 1 fixed display position and 3 other display positions.
[0086] In this embodiment of the invention, generating the verification code to be displayed includes:
[0087] A target image set is obtained from a preset image database; the target image set includes at least two images with a positional order.
[0088] A first number of target image sequences, whose positions are consecutive, are selected from the at least two images; the first number is the same as the number of image display positions.
[0089] Take any one of the images in the target image sequence as the first image, and take the other images as the correct images for detecting whether the verification is successful;
[0090] Obtain a second number of arbitrary images from the image database, excluding the target image set, as the second image; the second number is the same as the number of the other display positions.
[0091] The position of the first image in the target image sequence is taken as the first position of the fixed display position in the preset verification code component, and the position of the second image in the target image sequence is taken as the second position of the other display positions in the verification code component;
[0092] The first image is added to the first position in the verification code component, and the second image is added to the second position respectively. Based on the position of the correct image in the target image sequence, the association relationship between the correct image and the other display positions is generated to obtain the verification code to be displayed.
[0093] Specifically, when generating the CAPTCHA to be displayed, a target image set can be randomly selected from multiple image sets in a preset image database. This target image set includes at least two images, and the images have a positional order. The images can be combined in the order of their positions to form a complete image. For example, if the target image set A includes 5 images, labeled A1, A2, A3, A4, and A5 in positional order, then combining the 5 images in the order A1, A2, A3, A4, and A5 will result in a complete image. Any other combination of the 5 images in any other order will result in an incomplete image.
[0094] After determining the target image set, a first number of consecutive target image sequences are selected from the target image set. The first number is the same as the number of image display positions in the CAPTCHA. For example, continuing from the previous example, if the number of image display positions in the CAPTCHA is 4, then 4 consecutive target images are selected from the target image set as the target image sequence. Therefore, the selected target image sequence can be "A1, A2, A3, A4" or "A2, A3, A4, A5".
[0095] After determining the target image sequence, any image in the target image sequence can be used as the first image, and the other images in the target image sequence can be used as correct images. The correct images are used to detect whether the verification passes. For example, continuing the previous example, assuming the target image sequence is "A1, A2, A3, A4", when "A1" is used as the first image, then "A2, A3, A4" are used as correct images. "A2, A3, A4" are used to detect whether the verification passes in subsequent verifications, and the specific method will be detailed later. Alternatively, when "A2" is used as the first image, then "A1, A3, A4" are used as correct images. In practical applications, the position of the first image in the verification code can be set according to actual needs, and this embodiment of the invention does not impose any restrictions on this.
[0096] After determining the first image, a second number of arbitrary images can be selected from the image database as the second image. These second images do not belong to the target image set, and the second number is the same as the number of other display positions in the CAPTCHA. For example, continuing the previous example, assuming the target image sequence is "A1, A2, A3, A4", and "A1" is the first image, then the number of other display positions in the CAPTCHA is 4-1=3. Therefore, three images are randomly selected from the image database (excluding the target image set) as the second images. For example, continuing the previous example, if "A1" from the target image set A is used as the first image, then three more images are randomly selected: "B3" from image set B, "D2" from image set D, and "K5" from image set K as the second images.
[0097] After determining the first and second images, the position of the first image in the target image sequence is used as the first fixed display position in the preset CAPTCHA component, and the position of the second image in the target image sequence is used as the second position of other display positions in the CAPTCHA component. For example, continuing the previous example, if "A1" in the target image sequence "A1, A2, A3, A4" is used as the first image, and the position of "A1" in the target image sequence is the first one (i.e., the first position), then the first position can be used as the fixed display position in the CAPTCHA component (i.e., the first position). Figure 1 The second to fourth positions (i.e., the second position) will be used as the positions of the other display positions in the CAPTCHA component. Figure 2 , Figure 3 , Figure 4 (e.g., position 2) can be used as other display positions. Alternatively, if "A2" is used as the first image, then the second "A2" in the CAPTCHA component is used as the first position, and the first, third, and fourth "A2" in the CAPTCHA component are used as the second positions.
[0098] After determining the first and second positions, add the first image to the first position in the preset CAPTCHA component, and add the second image to each of the second positions. The second images can be added randomly. For example, continuing the previous example, if "A1" is the first image and "B3", "D2", and "K5" are the second images, then "A1" can be added to... Figure 1 Add "B3" to the position. Figure 2 Add "D2" to the position. Figure 3 Add "K5" to the specified position. Figure 4 Alternatively, you can add "A1" to the position; Figure 1 Add "D2" to the position. Figure 2 Add "K5" to the specified position. Figure 3 Add "B3" to the specified position. Figure 4 Bit.
[0099] Then, based on the position of the correct image in the target image sequence, the association between the correct image and each of the other display positions is generated. That is, the position of any correct image in the target image sequence is also the position of that correct image in the image display position of the CAPTCHA, and the association between that correct image and its display position is generated to obtain the CAPTCHA to be displayed. For example, continuing from the previous example, for the target image sequence "A1, A2, A3, A4",... Figure 1 This is a fixed display position. Figures 2-4 For other display positions, then, Figure 1 The position corresponding to "A1" is 2, and the correct image "A2" is the 2nd in the target image sequence. Therefore, generating "A2" and... Figure 2 The position of the correct image "A3" in the target image sequence is the 3rd. Therefore, generating "A3" and... Figure 3 Given the positional relationship of the bits, the correct image "A4" is the 4th in the target image sequence. Therefore, generating "A4" and... Figure 4 The relationship between the bits is obtained, thus yielding the following: Figure 2 The verification code shown.
[0100] In this embodiment of the invention, the image database includes at least one image set; wherein any image set is generated in the following manner:
[0101] Obtain the original resolution of the image to be processed;
[0102] The original resolution is scaled proportionally based on a preset first resolution to obtain a scaled image.
[0103] The scaled image is cropped based on a preset second resolution to obtain a cropped image.
[0104] The cropped image is divided into an average number based on a preset third number to obtain an image set; the image set includes the third number of segmented images, each segmented image has the same resolution and a unique order; the third number is not less than the number of all image display positions in the verification code component.
[0105] Specifically, the image database includes at least one generated image set. For any image set, during generation, the image to be processed can be obtained and its original resolution can be obtained. Then, the original resolution is scaled proportionally using a preset resolution (denoted as the first resolution). At least one of the scaled resolutions does not exceed the corresponding item in the first resolution, thus obtaining the scaled image.
[0106] For example, such as Figure 3 As shown, the preset first resolution is 100px*200px. When the original resolution of the image to be processed is 150px*600px, the scaling ratio can be calculated as 3 (600px / 200px) based on 200px, and then the original resolution is scaled proportionally to obtain a scaled image resolution of 50px*200px (200px does not exceed 200px in the first resolution); or the scaling ratio can be calculated as 1.5 (150px / 100px) based on 100px, and then the original resolution is scaled proportionally to obtain a scaled image resolution of 100px*400px (100px does not exceed 100px in the first resolution).
[0107] After obtaining the scaled image, it is cropped using a preset second resolution to obtain the cropped image used to generate the image set. For example, ... Figure 4 As shown, assuming the resolution of the scaled image is 100px*400px, and the preset second resolution is 100px*200px, since the width is the same, there is no need to crop the width, only the length. That is, randomly select 200px from 1px to 400px, which can be 101px to 300px or 152px to 351px, to obtain the cropped image.
[0108] Then, the cropped image is divided equally according to the third quantity to obtain an image set; the third quantity is not less than the total number of image display positions in the CAPTCHA component. For example, if the total number of image display positions in the CAPTCHA component is 4, then the third quantity must not be less than 4, such as 5. Then, the cropped image is divided equally into 5 parts to obtain an image set. Each segmented image has a unique sequential order. For example, continuing from the previous example, if the segmented images are A1, A2, A3, A4, and A5, then A1-A2-A3-A4-A5 is the unique sequential order of these 5 images.
[0109] For example, continuing from the previous example, if we divide 100px*200px into 5 equal parts, we can get 5 images of 100px*40px each, thus obtaining an image set of 5 images.
[0110] Of course, besides segmentation based on length, segmentation can also be based on width. For example, dividing a 100px * 200px image into 5 equal parts will result in 5 images of 20px * 200px each, thus creating an image set of 5 images. In practical applications, whether segmentation is based on length or width can be set according to actual needs, and this embodiment of the invention does not impose any restrictions on this.
[0111] Step 102: Display the verification code;
[0112] After generating the verification code to be displayed, the verification code can be displayed so that users can perform the corresponding operations to verify it.
[0113] Furthermore, to guide users on how to complete the verification process, prompts can be displayed during the verification process, such as... Figure 5 The verification code shown includes not only the various image display positions, but also the prompt message "Click to solve the puzzle". Figure 2 , 3 4. Make it Figure 1 "To form a complete image." Of course, the specific content of the prompt message can be set according to actual needs, and this embodiment of the invention does not limit this.
[0114] Step 103: In response to a replacement instruction for the second image in any other display position, replace any second image with a candidate second image to obtain an updated verification code;
[0115] After the verification code is displayed, users can change the images in other display positions within the verification code; that is, they can replace the displayed second image with a candidate second image to obtain an updated verification code. Each of the other display positions can have its image changed, for example, like... Figure 2 In the verification code shown, Figure 2 , Figure 3 and Figure 4 If the other three image display positions are selected, then the user can change the images in these three image display positions to obtain the updated verification code.
[0116] In an embodiment of the present invention, the step of replacing any second image with a candidate second image in response to a replacement instruction for any other display position includes:
[0117] In response to an update instruction for a second image in any other display position, the correct image associated with the other display position is obtained from the image database based on a preset probability.
[0118] If the correct image is successfully obtained, the correct image is used as the candidate second image to replace the second image;
[0119] If obtaining the correct image fails, the current image obtained will be used as the candidate second image to replace the second image.
[0120] Specifically, for any second image in another display position, in response to a user-triggered update command, the correct image related to that other display position is retrieved from the image database based on a preset probability. For example, continuing the previous example, when the user clicks on the verification code... Figure 2 When the position is specified, "A2" is retrieved from the image database based on a preset probability, such as 30%.
[0121] If the correct image is successfully acquired, then the second image in any other display position will be replaced with the correct image. For example, [the image will be replaced with the correct image]. Figure 2The second image in the display position is replaced with "A2"; if the correct image cannot be obtained, the second image in any other display position is replaced with the obtained current image. The current image can be any image other than the correct image and the first image corresponding to any other display position. For example, if the image database contains a total of 100 segmented images, and there are 98 images other than the correct image and the first image corresponding to any other display position, then when the correct image cannot be obtained, the obtained current image can be any one of the 98 images.
[0122] After updating the second image in each of the other display positions using the method described above, the user will receive the updated verification code. For example... Figure 6 As shown, this is the user's... Figure 2 middle Figure 2 Position and Figure 3 The updated verification code is obtained by updating the second image of the bit.
[0123] It should be noted that, in practical applications, the specific value of the preset probability can be set according to actual needs, and the embodiments of the present invention do not impose any restrictions on this.
[0124] In this embodiment of the invention, if obtaining the correct image fails, the method further includes:
[0125] Check whether the number of consecutive update instructions has reached a threshold.
[0126] If so, the preset probability corresponding to the next update instruction will be adjusted to 100%.
[0127] Specifically, since obtaining the correct image is probabilistic, there may be instances where the correct image is not obtained multiple times in a row, which can lead to a poor user experience. Therefore, after each update command is triggered, the number of times the update command is triggered can be counted. If the correct image is not obtained in this update, it is checked whether the number of consecutive update commands (including the current update command) has reached the threshold. If so, the preset probability corresponding to the next update command is adjusted to 100%.
[0128] For example, such as Figure 6 The verification code shown will trigger if the user clicks it 5 times consecutively (assuming a threshold of 5 clicks). Figure 4 If no correct image is obtained for any of the six clicks, then the preset probability for the next update instruction will be adjusted to 100%. This way, when the user clicks for the sixth time... Figure 4 When the threshold is reached, the correct image is obtained. Of course, in practical applications, the threshold number of attempts can be set according to actual needs, and this embodiment of the invention does not impose any restrictions on this.
[0129] Furthermore, to prevent the use of machine learning to determine the frequency threshold and thus exploit vulnerabilities, the frequency threshold can be adjusted at preset time intervals. For example, the frequency threshold can be randomly adjusted every 24 hours, with the random value ranging from 1 to 9. Alternatively, the frequency threshold can be adjusted at fixed time points, such as randomly adjusting the frequency threshold every Monday at 10:00 AM, with the random value ranging from 1 to 9. Of course, the specific time intervals, time points, and value ranges can be set according to actual needs, and this embodiment of the invention does not impose any limitations on them.
[0130] It's important to note that once the image in any other display position is replaced with the correct image, the correct image will not be locked. Users can still replace the correct image, and the probability of obtaining the correct image during replacement remains the same as before. This is because if a machine were to replace the image in the CAPTCHA, there's a possibility of multiple consecutive failures leading to eventual success, followed by locking the image, potentially allowing the machine to crack the CAPTCHA. The fact that the correct image is not locked avoids this situation.
[0131] Step 104: In response to the verification command, verify the updated verification code to obtain the verification result.
[0132] like Figure 7 As shown, in addition to prompts and various image display positions, the verification code may also include a virtual button to initiate verification. When the user clicks the virtual button, the verification instruction is triggered, the application verifies the updated verification code, and obtains the verification result as to whether the verification is successful.
[0133] In this embodiment of the invention, the step of verifying the updated verification code in response to a verification command to obtain a verification result includes:
[0134] In response to the verification command, it is checked whether all the candidate second images corresponding to the other display positions are correct images;
[0135] If yes, the verification is considered successful; otherwise, the verification is considered unsuccessful.
[0136] Specifically, in response to a user-triggered verification command, the application can check whether all candidate second images corresponding to the other display positions are correct images. For example, continuing from the previous example, the detection... Figure 2 Detect whether the candidate second image in the position is "A2" Figure 3 Detect whether the candidate second image in the position is "A3" Figure 2 If the candidate second image in the specified position is "A4", the verification is considered successful; otherwise, the verification is considered unsuccessful.
[0137] For example, when users... Figure 6 Verify using the verification code shown, because Figure 4 If the image in the image is not correct, the verification fails; when the user... Figure 8 If you verify the verification code shown, the verification will be successful.
[0138] When verification is successful, a "Verification successful" message can be generated, such as... Figure 8 As shown; when verification fails, a "Verification failed" message can be generated (not shown in the figure), and then the virtual button can continue to be displayed.
[0139] In this embodiment of the invention, when a verification event is detected, a verification code to be displayed is generated. The verification code has at least two image display positions, including a fixed display position and other display positions. The fixed display position is used to display a first image that cannot be replaced, and the other display positions are used to display a second image that can be replaced. The verification code is displayed. In response to a replacement instruction for the second image in any of the other display positions, any second image is replaced with a candidate second image to obtain an updated verification code. In response to a verification instruction, the updated verification code is verified to obtain a verification result. Because there is a logical relationship between the multiple images in the verification code, and this logical relationship needs to be judged based on human cognition rather than simple machine recognition, the machine cannot make logical judgments on verification codes containing multiple images, thereby increasing the difficulty for the machine to crack the verification code. At the same time, since no interference factors are needed, the user's verification process will not be interfered with, thus ensuring the user experience. Moreover, the logical relationship between the multiple images is updated every time the image is replaced. This multi-level logical judgment is also unrecognizable by the machine, further increasing the difficulty for the machine to crack the verification code.
[0140] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0141] Reference Figure 9 The diagram shows a structural block diagram of an embodiment of the verification device of the present invention, which may specifically include the following modules:
[0142] The generation module 901 is used to generate a verification code to be displayed when a verification event is detected; the verification code is provided with at least two image display positions, the at least two image display positions include a fixed display position and other display positions, the fixed display position is used to display a first image that cannot be changed, and the other display positions are used to display a second image that can be changed.
[0143] Display module 902 is used to display the verification code;
[0144] The update module 903 is used to replace any second image with a candidate second image in response to a replacement instruction for any other display position, thereby obtaining an updated verification code;
[0145] The verification module 904 is used to verify the updated verification code in response to the verification command and obtain the verification result.
[0146] In this embodiment of the invention, the generation module includes:
[0147] The first acquisition submodule is used to acquire a target image set from a preset image database; the target image set includes at least two images with a positional order;
[0148] The selection submodule is used to select a first number of target image sequences that are sequentially ordered from the at least two images; the first number is the same as the number of image display positions.
[0149] The first processing submodule is used to take any one of the images in the target image sequence as the first image, and to take the other images as the correct images for detecting whether the verification is passed.
[0150] The second processing submodule is used to obtain a second number of arbitrary images from the image database, excluding the target image set, as the second image; the second number is the same as the number of the other display positions;
[0151] The third processing submodule is used to take the position of the first image in the target image sequence as the first position of the fixed display position in the preset verification code component, and take the position of the second image in the target image sequence as the second position of the other display positions in the verification code component.
[0152] The fourth processing submodule is used to add the first image to the first position in the verification code component, and add the second image to the second position respectively, and generate the association relationship between the correct image and the other display positions based on the position of the correct image in the target image sequence, so as to obtain the verification code to be displayed.
[0153] In this embodiment of the invention, the image database includes at least one image set; the apparatus further includes:
[0154] The acquisition module is used to obtain the original resolution of the image to be processed;
[0155] The scaling module is used to scale the original resolution proportionally based on a preset first resolution to obtain a scaled image.
[0156] The cropping module is used to crop the scaled image based on a preset second resolution to obtain a cropped image;
[0157] The splitting module is used to perform average segmentation on the cropped image based on a preset third number to obtain an image set; the image set includes the third number of segmented images, each segmented image has the same resolution and a unique sequential order; the third number is not less than the number of all image display positions in the verification code component.
[0158] In this embodiment of the invention, the update module includes:
[0159] The second acquisition submodule is used to, in response to an update instruction for the second image in any other display position, acquire the correct image that is associated with the other display position from the image database based on a preset probability.
[0160] The fifth processing submodule is configured to, if the correct image is successfully acquired, use the correct image as the candidate second image to replace the second image; and,
[0161] If obtaining the correct image fails, the current image obtained will be used as the candidate second image to replace the second image.
[0162] In this embodiment of the invention, it further includes:
[0163] The first detection submodule is used to detect whether the number of consecutive update instructions has reached a threshold if the acquisition of the correct image fails.
[0164] The adjustment submodule is used to adjust the preset probability corresponding to the next update instruction to 100%.
[0165] In this embodiment of the invention, the verification module includes:
[0166] The second detection submodule is used to detect, in response to the verification command, whether all the candidate second images corresponding to the other display positions are correct images;
[0167] The determination module is used to determine whether the verification passes or fails.
[0168] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0169] This invention also provides an electronic device, comprising:
[0170] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described verification method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0171] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described verification method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0172] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0173] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0174] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0175] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0177] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the present invention.
[0178] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0179] The verification method and verification device provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A verification method, characterized in that, The method includes: When a verification event is detected, a verification code to be displayed is generated. The verification code has at least two image display positions, including a fixed display position and other display positions. The fixed display position is used to display a first image that cannot be replaced, and the other display positions are used to display a second image that can be replaced. There is a logical relationship between the first image and the second image. The first image and the second image both originate from an image set in a preset image database. The logical relationship means that the second image is spliced with the first image in terms of spatial position and content to restore a complete image. Display the verification code; In response to an update instruction for a second image in any other display position, the correct image associated with the other display position is obtained from the image database based on a preset probability. If the correct image is successfully obtained, the correct image is used as a candidate second image to replace the second image; If obtaining the correct image fails, the current image obtained will be used as a candidate second image to replace the second image; Obtain the updated verification code, and the logical relationship between the updated first image and the second image; In response to the verification command, the updated verification code is verified to obtain the verification result.
2. The verification method according to claim 1, characterized in that, The generation of the verification code to be displayed includes: A target image set is obtained from a preset image database; the target image set includes at least two images with a positional order. A first number of target image sequences, whose positions are consecutive, are selected from the at least two images; the first number is the same as the number of image display positions. Take any one of the images in the target image sequence as the first image, and take the other images as the correct images for detecting whether the verification is successful; Obtain a second number of arbitrary images from the image database, excluding the target image set, as the second image; the second number is the same as the number of the other display positions. The position of the first image in the target image sequence is taken as the first position of the fixed display position in the preset verification code component, and the position of the second image in the target image sequence is taken as the second position of the other display positions in the verification code component; The first image is added to the first position in the verification code component, and the second image is added to the second position respectively. Based on the position of the correct image in the target image sequence, the association relationship between the correct image and the other display positions is generated to obtain the verification code to be displayed.
3. The verification method according to claim 2, characterized in that, The image database includes at least one image set; wherein any image set is generated in the following manner: Obtain the original resolution of the image to be processed; The original resolution is scaled proportionally based on a preset first resolution to obtain a scaled image. The scaled image is cropped based on a preset second resolution to obtain a cropped image. The cropped image is divided into an average number based on a preset third number to obtain an image set; the image set includes the third number of segmented images, each segmented image has the same resolution and a unique order; the third number is not less than the number of all image display positions in the verification code component.
4. The verification method according to claim 1, characterized in that, If obtaining the correct image fails, the method further includes: Check whether the number of consecutive update instructions has reached a threshold. If so, the preset probability corresponding to the next update instruction will be adjusted to 100%.
5. The verification method according to claim 1, characterized in that, The step of responding to a verification command by verifying the updated verification code and obtaining a verification result includes: In response to the verification command, it is checked whether all the candidate second images corresponding to the other display positions are correct images; If yes, the verification is considered successful; otherwise, the verification is considered unsuccessful.
6. A verification device, characterized in that, The device includes: A generation module is used to generate a verification code to be displayed when a verification event is detected. The verification code has at least two image display positions, including a fixed display position and other display positions. The fixed display position is used to display a first image that cannot be replaced, and the other display positions are used to display a second image that can be replaced. There is a logical relationship between the first image and the second image. The first image and the second image both originate from an image set in a preset image database. The logical relationship means that the second image is spliced with the first image in terms of spatial position and content to restore a complete image. The display module is used to display the verification code; The update module is used to replace any second image with a candidate second image in response to a replacement instruction for any other display position, to obtain the updated verification code, and the logical association between the updated first image and the second image. The verification module is used to verify the updated verification code in response to the verification command and obtain the verification result; The update module includes: The second acquisition submodule is used to, in response to an update instruction for the second image in any other display position, acquire the correct image that is associated with the other display position from the image database based on a preset probability. The fifth processing submodule is configured to, if the correct image is successfully acquired, replace the second image with the correct image as a candidate second image; and, If obtaining the correct image fails, the current image obtained will be used as a candidate second image to replace the second image.
7. The verification device according to claim 6, characterized in that, The generation module includes: The first acquisition submodule is used to acquire a target image set from a preset image database; the target image set includes at least two images with a positional order; The selection submodule is used to select a first number of target image sequences that are sequentially ordered from the at least two images; the first number is the same as the number of image display positions. The first processing submodule is used to take any one of the images in the target image sequence as the first image, and to take the other images as the correct images for detecting whether the verification is passed. The second processing submodule is used to obtain a second number of arbitrary images from the image database, excluding the target image set, as the second image; the second number is the same as the number of the other display positions; The third processing submodule is used to use the position of the first image in the target image sequence as the fixed display position; The fourth processing submodule is used to add the first image to the fixed display position in the preset verification code component, and add the second image to the other display positions respectively, and generate the association relationship between the correct image and the other display positions based on the position of the correct image in the target image sequence, so as to obtain the verification code to be displayed.
8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the verification method as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the verification method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method, device and system for identity verification
CN104580104A
Login verification method and device and electronic equipment
CN110730152A