WO2016169437A1 - 验证图片的生成方法、装置以及服务器 - Google Patents

验证图片的生成方法、装置以及服务器 Download PDF

Info

Publication number
WO2016169437A1
WO2016169437A1 PCT/CN2016/079418 CN2016079418W WO2016169437A1 WO 2016169437 A1 WO2016169437 A1 WO 2016169437A1 CN 2016079418 W CN2016079418 W CN 2016079418W WO 2016169437 A1 WO2016169437 A1 WO 2016169437A1
Authority
WO
WIPO (PCT)
Prior art keywords
area
verification
picture
verification code
color
Prior art date
Application number
PCT/CN2016/079418
Other languages
English (en)
French (fr)
Inventor
罗斌
侯鑫
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2016169437A1 publication Critical patent/WO2016169437A1/zh
Priority to US15/443,234 priority Critical patent/US10439818B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/36User authentication by graphic or iconic representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • G06F21/46Structures or tools for the administration of authentication by designing passwords or checking the strength of passwords
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09CCIPHERING OR DECIPHERING APPARATUS FOR CRYPTOGRAPHIC OR OTHER PURPOSES INVOLVING THE NEED FOR SECRECY
    • G09C5/00Ciphering apparatus or methods not provided for in the preceding groups, e.g. involving the concealment or deformation of graphic data such as designs, written or printed messages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3226Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using a predetermined code, e.g. password, passphrase or PIN
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2133Verifying human interaction, e.g., Captcha

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, and a server for generating a verification picture.
  • CAPTCHA Completely Automated Public Turing test to tell Computers and Humans Apart
  • verification code is a publicly-automated program that can be used to distinguish whether a user is a machine or a person.
  • the server will send a verification picture to the user's terminal and ask the user to input the verification picture.
  • a verification code is included to determine that the user performing the operation is a person, not a machine. To this end, the server needs to be a verification picture before issuing the verification picture to the terminal used by the user.
  • the initial picture containing the verification code is generated, and then the initial picture is noise-scrambled to obtain the verification picture.
  • any of the following methods may be included:
  • the first way is to obtain an initial picture containing the verification code; generate a noise point in the entire picture area of the initial picture to obtain a verification picture.
  • the second way get the initial picture containing the verification code; generate the verification code in the initial picture Become a noise point and get a verification picture.
  • the noise point on the entire verification picture can be well filtered by the median filtering method. Therefore, when the noise point is included in the entire picture area of the verification picture, the machine can filter out the noise points in the verification picture by the median filtering method and identify the verification code therein.
  • the expansion algorithm in the image processing field has a good adhesion effect, the machine can relatively easily filter out the noise points generated on the verification code by the expansion algorithm, thereby identifying the verification code in the verification picture.
  • the verification pictures generated by the above two methods are relatively high risk of being cracked by the machine, and the anti-cracking ability is not strong.
  • the embodiment of the invention provides a method, a device and a server for generating a verification picture.
  • the technical solution is as follows:
  • a method for generating a verification picture comprising:
  • a device for generating a verification picture comprising:
  • An obtaining module configured to obtain an initial picture including a verification code
  • a selecting module configured to select a first area in the initial picture, where the first area includes at least a part of the content of the verification code
  • a first generating module configured to generate a first noise point on the verification code included in the first area
  • a second generating module configured to generate a second noise point in the second region of the initial picture, to obtain Verifying the picture, the second area is an area other than the first area in the initial picture.
  • a server comprising:
  • One or more processors are One or more processors.
  • the memory stores one or more programs, the one or more programs being configured to be executed by the one or more processors, the one or more programs including instructions for:
  • the machine By generating a first noise point on the verification code in some areas in the initial picture and generating a second noise point on the background of the picture in other areas, the machine cannot filter out the noise points in the verification picture by some simple algorithms. Thereby increasing the difficulty of the machine identification verification code, reducing the risk that the verification code is cracked by the machine, and having a strong anti-cracking capability.
  • FIG. 1 is a flowchart of a method for generating a verification picture according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for generating a verification picture according to another embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a verification picture according to another embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an application environment of a method for generating a verification picture according to another embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a device for generating a verification picture according to another embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a first generation module according to another embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a first selecting unit according to another embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a second generation module according to another embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a device for generating a verification picture according to another embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a server according to another embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for generating a verification picture according to an embodiment of the present invention.
  • a method for generating a verification picture according to an embodiment of the present invention includes the following steps:
  • the method provided by the embodiment of the present invention generates a second noise point on a verification code in some areas in the initial picture, and generates a second noise point on a picture background in other areas, so that the machine cannot filter through some simple algorithms.
  • the difficulty of the machine identification verification code is increased, the risk of the verification code being broken by the machine is reduced, and the anti-hacking capability is strong.
  • the first noise point is generated on the verification code included in the first area, including:
  • randomly selecting a plurality of first pixel points on the verification code included in the first area including:
  • the pixel is treated as a first pixel.
  • generating a second noise point in the second region of the initial picture comprises:
  • the method further includes:
  • the signature of the verification code is generated using a specified encryption algorithm, wherein the signature is used to determine whether the answer submitted by the user according to the verification picture matches the verification code.
  • FIG. 2 is a flowchart of a method for generating a verification picture according to another embodiment of the present invention.
  • the method process provided by the embodiment of the present invention includes:
  • any picture when obtaining the initial picture including the verification code, any picture may be acquired first; then, a preset or randomly generated verification code is added to the picture to obtain an initial picture.
  • the background color of the arbitrarily acquired picture may be a solid color.
  • the picture can be a white picture, or a pink picture, and the like.
  • the embodiment of the present invention is not specifically limited.
  • the verification code can Think of any of Chinese characters, letters, and numbers.
  • the verification code is a digital verification code, or a letter verification code or the like.
  • the verification code may also be a combination of at least two of letters, numbers, or Chinese characters.
  • the verification code may be a combination of letters and numbers, or a combination of letters and Chinese characters, or a combination of letters, numbers, and Chinese characters.
  • the embodiment of the present invention is also not specifically limited.
  • the verification code can be black, blue, etc., and the color of the verification code is different from the background color of the acquired picture.
  • the colors of the respective letters may be the same or different.
  • the color of each partial region of each letter may be the same or different.
  • the first area in the initial picture There are many ways to select the first area in the initial picture. For example, an area may be randomly selected in the initial picture as the first area. Alternatively, the area selected by the user in the initial image is obtained, and the area selected by the user is taken as the first area or the like.
  • the selected first area when the verification picture is generated, includes a part of the content or all the contents of the verification code.
  • the first area may include one letter, two letters, or a partial area in one letter, etc., of course, in another embodiment, the first area It can also include all four letters.
  • the embodiment of the present invention does not limit the shape of the first region.
  • the first area may be a circular area, an elliptical area, a rectangular area, or the like.
  • the embodiment of the present invention does not limit the area of the first area, and the first area only needs to be a sub-area of the initial picture.
  • the embodiment of the present invention implements by generating some noise points in the initial picture when generating the verification picture.
  • the noise point generated on the verification code included in the first area is referred to as a first noise point.
  • the manner of generating the first noise point on the verification code included in the first area includes, but is not limited to, by the following steps 2031 and 2032:
  • the number of the first pixel points is not specifically limited in the embodiment of the present invention.
  • the number of first pixel dots may be a specified percentage of the total number of pixel points in the verification code in the first region. Wherein, the specified percentage may be fifty percent, thirty percent, and the like.
  • a random number may be generated, and according to the The relationship between the random number and the specified value is used to determine whether the pixel is a first pixel.
  • a random number when randomly selecting a pixel point, a random number may be generated according to the specified random function, and it is determined whether the random number is greater than a specified value; when the random number is greater than a specified value, the pixel point is taken as a first pixel point.
  • the designated random function may be a function capable of generating a number including 1 to 100, or a function capable of generating a value between 0 and 1.
  • the specified value is related to the specified random function and the specified percentage. For example, when the specified percentage is fifty percent and the random function is a function capable of generating a number including between 1 and 100, the specified value may be 50 or the like. When the specified random function is a function capable of generating a value between 0 and 1, when the specified percentage is thirty percent, the specified value may be 0.3 or the like.
  • the specific color type of the first color is not specifically limited in the embodiment of the present invention.
  • the first color is different from the color of the verification code in the first area. For example, when the color of the verification code in the initial picture is black and the background color is white, multiple first pixels can be rendered. Dyed in pink, white, etc.
  • the principle of the step is the same as the principle in the above step 2031.
  • the principle of the step is the same as the principle in the step 2032.
  • the embodiment of the present invention is not specifically limited.
  • the format of the verification picture includes, but is not limited to, JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphic Format), GIF (Graphic Interchange Format), or BMP. Any of (Bitmap, bitmap).
  • the first noise point is generated on the verification code included in the first area, and the second noise point is generated in the second area.
  • the second noise point may be generated in the second area, and then the first noise point is generated on the verification code included in the first area; and may also be included in the first area at the same time.
  • the first noise point is generated on the verification code, and the second noise point is generated in the second area.
  • a circular area including a partial verification code may be randomly acquired as the first area; then, the first area is The plurality of first pixels on the included verification code are rendered in black, and the plurality of second pixels in the second region other than the first region in the initial picture are rendered as white.
  • FIG. 3 is a schematic diagram of a verification picture according to another embodiment of the present invention.
  • the background color of the initial image is black, and the color of the verification code is white.
  • the verification picture generated by the above steps 201 to 204 is as shown in FIG. 3(a).
  • the picture processed by the median filtering method is shown in FIG. 3(b).
  • the picture processed by the expansion picture by the expansion algorithm is as shown in (c) of FIG. It can be seen from the figure (b) in FIG. 3 and the figure (c) in FIG. 3 that the verification picture obtained by the method provided by the embodiment of the present invention does not easily filter out the noise point by the median filtering method and the expansion algorithm.
  • the verification code is obtained, so it is not easy to be recognized by the machine, and the anti-cracking ability of the verification picture is enhanced. Further, when the verification picture is used to verify the operation of the user, it is possible to ensure that the operator is a natural person, not a machine, and thus the safety of the operation can be improved.
  • the generated verification image may be used to verify the user, and the process may include: providing a verification image to the user, and verifying the answer after receiving the answer submitted by the user according to the verification image. If the answer is consistent with the verification code, the verification is passed, and if the answer is inconsistent with the verification code, the verification fails. Applying the verification image generated in the above steps to other verification occasions such as authentication can greatly improve the security of verification and reduce the attack of malicious users.
  • the specified encryption algorithm includes, but is not limited to, an MD5 (Message Digest Algorithm 5) algorithm, and the like, and the embodiment of the present invention does not limit the type of the specified encryption algorithm.
  • MD5 Message Digest Algorithm 5
  • the specified encryption algorithm may be used to calculate the signature of the user submitting the answer, and determine Whether the signature of the user submitting the answer matches the signature of the verification code. If the signature of the user submitting the answer matches the signature of the verification code, it is determined that the user passes the verification; if the signature of the user submitting the answer does not match the signature of the verification code, it is determined that the user has not passed the verification.
  • the verification picture generated by the method provided by the embodiment of the present invention can be applied to any verification occasion, and is used to distinguish whether the performer performing the operation is a natural person or a machine.
  • the verification picture can be applied to the case of login, the occasion of posting, the occasion of replying to a message, the occasion of posting a comment, the case of downloading a file, the case of voting, and the like.
  • the embodiment of the present invention is not specifically limited.
  • FIG. 4 shows a schematic diagram of an application environment of a method for generating a verification picture.
  • the application environment includes a terminal 401, a web (web) server 402, an authentication server 403, and a verification picture generation server 404.
  • the connection between the terminal 401 and the web server 402, between the web server and the verification server 403, and between the verification server 403 and the verification picture generation server 404 are connected through a network.
  • the network can be a wired network or a wireless network.
  • the embodiment of the present invention innovates at the verification picture generation server 404, so that the verification picture generation server 404 can generate a plurality of verification pictures through the above steps 201 to 204.
  • the verification server 403 can be configured to generate a signature corresponding to the verification code in each verification picture by the above step 205.
  • the signature can also be generated by the verification picture generation server 404.
  • the web server 402 requests the verification server 403 to verify the picture.
  • the verification server 403 pulls one of the generated verification pictures from the verification picture generation server 404, generates a signature of the verification code included in the verification picture, and transmits the verification picture to the web server 402, which is verified by the web server 402. The picture is sent to the terminal 401.
  • the terminal 401 After receiving the verification picture, the terminal 401 obtains the verification code input by the user according to the verification picture, submits the verification code to the web server 402, and submits the verification code to the verification server 403 by the web server 402. After receiving the verification code input by the user, the verification server 403 generates a signature corresponding to the verification code input by the user by specifying an encryption algorithm, wherein the specified encryption algorithm is the same as the specified encryption algorithm used when the verification server 403 generates the signature of the verification code.
  • the verification server 403 matches the signature corresponding to the verification code input by the user with the signature of the verification code in the verification picture, when determining the user input
  • the signature corresponding to the verification code matches the signature of the verification code in the verification picture, it is determined that the user who performed the operation is a person, not a machine.
  • the user corresponding to the terminal 401 can perform the operation.
  • the above process only illustrates the verification process by using different servers.
  • the functions of the respective servers may be integrated into one server, so that the above verification process is implemented by the integrated server.
  • the functions of the respective servers described above may be integrated by the verification picture generation server 404 or the verification server 403, and the above-described verification process may be performed.
  • the terminal 401 may be a desktop computer, a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, and an MP4 (Moving Picture Experts Group Audio).
  • Layer IV dynamic imaging experts compress standard audio layers 3) players, laptop portable computers, wearable devices such as smart bracelets.
  • the method provided by the embodiment of the present invention generates a second noise point on a verification code in some areas in the initial picture, and generates a second noise point on a picture background in other areas, so that the machine cannot filter through some simple algorithms.
  • the difficulty of the machine identification verification code is increased, the risk of the verification code being broken by the machine is reduced, and the anti-hacking capability is strong.
  • FIG. 5 is a schematic structural diagram of a device for generating a verification picture according to another embodiment of the present invention.
  • the device for generating a verification picture is used to execute the method for generating a verification picture provided by the embodiment corresponding to FIG. 1 or FIG. 2 .
  • the device for generating the verification picture includes:
  • An obtaining module 501 configured to acquire an initial picture that includes a verification code
  • the selecting module 502 is configured to select a first area in the initial picture, where the first area includes at least a part of the content of the verification code;
  • a first generating module 503, configured to generate a first noise point on the verification code included in the first area
  • the second generation module 504 is configured to generate a second noise point in the second region of the initial picture to obtain a verification picture, where the second area is an area other than the first area in the initial picture.
  • the device provided by the embodiment of the present invention generates the verification code in some areas in the initial picture.
  • the first noise point, and the second noise point is generated on the background of the picture in other areas, so that the machine cannot filter out the noise points in the verification picture by some simple algorithms, thereby increasing the difficulty of the machine identification verification code and reducing the verification code.
  • the risk of being cracked by the machine has a strong ability to prevent cracking.
  • the first generation module 503 includes:
  • a first selecting unit 5031 configured to randomly select a plurality of first pixel points on the verification code included in the first area
  • the first rendering unit 5032 is configured to render the plurality of first pixel points into the first color to obtain a plurality of first noise points, wherein the first color is different from the color of the verification code in the first area.
  • the first selecting unit 5031 includes:
  • Generating subunit 50311, configured to generate a random number according to a specified random function when any pixel point is selected
  • a determining subunit 50312 configured to determine whether the random number is greater than a specified value
  • the determining subunit 50313 is configured to use the pixel point as a first pixel point when the random number is greater than the specified value.
  • the second generation module 504 includes:
  • a second selecting unit 5041 configured to randomly select a plurality of second pixel points in the second region of the initial image
  • the second rendering unit 5042 is configured to render the plurality of second pixel points into the second color to obtain a plurality of second noise points, wherein the second color is different from the color of the second region.
  • the apparatus for generating a verification picture further includes:
  • the third generation module 505 is configured to generate a signature of the verification code by using a specified encryption algorithm, where the signature is used to determine whether the answer submitted by the user according to the verification picture matches the verification code.
  • the verification picture generating apparatus when generating the verification picture, the verification picture generating apparatus provided in the foregoing embodiment is only illustrated by the division of each functional module, and in actual application, the function may be allocated by different function modules as needed. Upon completion, the internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the verification provided by the above embodiment The image generating device and the server and the method for generating the verification image are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • FIG. 10 is a schematic structural diagram of a server, which may be used to perform the method for generating a verification picture provided by the embodiment corresponding to FIG. 1 or FIG. 2, according to an exemplary embodiment.
  • server 1000 includes a processing component 1022 that further includes one or more processors, and memory resources represented by memory 1032 for storing instructions executable by processing component 1022, such as an application.
  • An application stored in memory 1032 can include one or more modules each corresponding to a set of instructions.
  • the processing component 1022 is configured to execute instructions to perform the method of generating the verification picture provided by the embodiment corresponding to FIG. 1 or FIG. 2 above.
  • Server 1000 may also include a power component 10210 configured to perform power management of server 1000, a wired or wireless network interface 1050 configured to connect server 1000 to the network, and an input/output (I/O) interface 1058.
  • Server 1000 can operate based on an operating system stored in memory 1032, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
  • one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for:
  • a second noise point is generated in the second region of the initial picture to obtain a verification picture, wherein the second area is an area other than the first area in the initial picture.
  • the memory of the server further includes the following operations.
  • the instructions are: generating a first noise point on the verification code included in the first area, including:
  • the memory of the server further includes an instruction for performing: randomly selecting a plurality of verification codes included in the first area
  • the first pixel including:
  • the pixel is treated as a first pixel.
  • the memory of the server further includes an instruction for: generating a second noise point in the second region of the initial picture, include:
  • the memory of the server further includes an instruction for performing the following operations: After verifying the image, it also includes:
  • the signature of the verification code is generated using the specified encryption algorithm, and the signature is used to determine whether the answer submitted by the user according to the verification image matches the verification code.
  • the server provided by the embodiment of the present invention generates a first noise point by using a verification code included in a first area selected in an initial image, and generates a second noise in a second area other than the first area in the initial picture.
  • the point makes the machine unable to filter out the noise points in the verification picture by some simple algorithms, thereby increasing the difficulty of the machine identification verification code, reducing the risk that the verification code is cracked by the machine, and having strong anti-cracking ability.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
  • non-transitory computer readable storage medium comprising instructions, such as a memory comprising instructions executable by a processor in a terminal to perform the above-described embodiment of FIG. 2A or FIG.
  • the method of generating a verification picture shown in the example may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

一种验证图片的生成方法、装置以及服务器,属于计算机技术领域。上述方法通过在初始图片某些区域内的验证码上生成第一噪声点,而在其他区域内的图片背景上生成第二噪声点,使得机器无法通过一些简单算法滤除验证图片中的噪声点,增加了机器识别验证码的难度,降低了验证码被机器破解的风险,具有较强的防破解能力。

Description

验证图片的生成方法、装置以及服务器
本申请要求于2015年4月23日提交中国专利局、申请号为2015101979911、发明名称为“验证图片的生成方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机技术领域,特别涉及一种验证图片的生成方法、装置以及服务器。
背景技术
全自动区分计算机和人类的图灵测试(CAPTCHA,Completely Automated Public Turing test to tell Computers and Humans Apart),俗称验证码,是一种可以用于区分使用者是机器还是人的公共全自动程序。为了防止某些怀有恶意的使用者使用机器自动进行登录、发布信息、下载等操作,在使用者进行相关操作时,服务器会向使用者所在终端下发验证图片,并要求使用者输入验证图片中包括的验证码,以确定进行操作的使用者是人,而不是机器。为此,在向使用者使用的终端下发验证图片之前,服务器需要先生成验证图片。
为了避免被机器识别,在生成验证图片时,会先生成包含验证码的初始图片,再对初始图片进行噪声加扰,以得到验证图片。具体地,可以包括以下任一种方式:
第一种方式:获取包含验证码的初始图片;在该初始图片的整个图片区域生成噪声点,得到验证图片。
第二种方式:获取包含验证码的初始图片;在该初始图片中的验证码上生 成噪声点,得到验证图片。
在实现本发明的过程中,发明人发现现有技术至少存在以下问题:
通常,通过中值滤波法可以很好地滤除在整个验证图片上的噪声点。因此,当验证图片的整个图片区域中包括噪声点时,机器可以通过中值滤波法滤除验证图片中的噪声点,并识别出其中的验证码。另外,由于图像处理领域中的膨胀算法有很好的粘连效果,因此,机器通过膨胀算法可以比较容易地滤除在验证码上生成的噪声点,从而识别出验证图片中的验证码。综上,上述两种方式生成的验证图片,被机器破解的风险比较高,防破解能力不强。
发明内容
为了降低被机器破解的风险,提高防破解能力,本发明实施例提供了一种验证图片的生成方法、装置以及服务器。所述技术方案如下:
第一方面,提供了一种验证图片的生成方法,所述方法包括:
获取包含验证码的初始图片;
在所述初始图片中选取一个第一区域,所述第一区域包含所述验证码的至少一部分内容;
在所述第一区域中所包含的验证码上生成第一噪声点;
在所述初始图片的第二区域中生成第二噪声点,得到验证图片,所述第二区域为所述初始图片中除所述第一区域以外的区域。
第二方面,提供了一种验证图片的生成装置,所述装置包括:
获取模块,用于获取包含验证码的初始图片;
选取模块,用于在所述初始图片中选取一个第一区域,所述第一区域包含所述验证码的至少一部分内容;
第一生成模块,用于在所述第一区域中所包含的验证码上生成第一噪声点;
第二生成模块,用于在所述初始图片的第二区域中生成第二噪声点,得到 验证图片,所述第二区域为所述初始图片中除所述第一区域以外的区域。
第三方面,提供了一种服务器,所述服务器包括:
一个或多个处理器;和
存储器;
所述存储器存储有一个或多个程序,所述一个或多个程序被配置成由所述一个或多个处理器执行,所述一个或多个程序包含用于进行以下操作的指令:
获取包含验证码的初始图片;
在所述初始图片中选取一个第一区域,所述第一区域包含所述验证码的至少一部分内容;
在所述第一区域中所包含的验证码上生成第一噪声点;
在所述初始图片的第二区域中生成第二噪声点,得到验证图片,所述第二区域为所述初始图片中除所述第一区域以外的区域。
本发明实施例提供的技术方案带来的有益效果是:
通过在初始图片中某些区域内的验证码上生成第一噪声点,而在其他区域内的图片背景上生成第二噪声点,使得机器无法通过一些简单算法滤除验证图片中的噪声点,从而增加了机器识别验证码的难度,降低了验证码被机器破解的风险,具有较强的防破解能力。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明一实施例提供的一种验证图片的生成方法的流程图;
图2是本发明另一实施例提供的一种验证图片的生成方法的流程图;
图3是本发明另一实施例提供的一种验证图片的示意图;
图4是本发明另一实施例提供的一种验证图片的生成方法的应用环境示意图;
图5是本发明另一实施例提供的一种验证图片的生成装置的结构示意图;
图6是本发明另一实施例提供的一种第一生成模块的结构示意图;
图7是本发明另一实施例提供的一种第一选取单元的结构示意图;
图8是本发明另一实施例提供的一种第二生成模块的结构示意图;
图9是本发明另一实施例提供的一种验证图片的生成装置的结构示意图;
图10是本发明另一实施例提供的一种服务器的结构示意图。
具体实施方式
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。
图1是本发明一实施例提供的一种验证图片的生成方法的流程图。参见图1,本发明实施例提供的验证图片的生成方法包括如下步骤:
101、获取包含验证码的初始图片。
102、在初始图片中选取一个第一区域,其中,第一区域包含验证码的至少一部分内容。
103、在第一区域中所包含的验证码上生成第一噪声点。
104、在初始图片的第二区域中生成第二噪声点,得到验证图片,其中,第二区域为初始图片中除第一区域以外的区域。
本发明实施例提供的方法,通过在初始图片中某些区域内的验证码上生成第一噪声点,而在其他区域内的图片背景上生成第二噪声点,使得机器无法通过一些简单算法滤除验证图片中的噪声点,从而增加了机器识别验证码的难度,降低了验证码被机器破解的风险,具有较强的防破解能力。
在另一个实施例中,在第一区域中所包含的验证码上生成第一噪声点,包括:
随机选取第一区域中所包含的验证码上的多个第一像素点;
将多个第一像素点渲染为第一颜色,得到多个第一噪声点,其中,第一颜色与第一区域中验证码的颜色不同。
在另一个实施例中,随机选取第一区域中所包含的验证码上的多个第一像素点,包括:
在选取任一像素点时,根据指定随机函数生成一个随机数;
判断随机数是否大于指定数值;
当随机数大于指定数值时,将像素点作为一个第一像素点。
在另一个实施例中,在初始图片的第二区域中生成第二噪声点,包括:
随机选取初始图像的第二区域中的多个第二像素点;
将多个第二像素点渲染为第二颜色,得到多个第二噪声点,其中,第二颜色与第二区域的颜色不同。
在另一个实施例中,得到验证图片之后,还包括:
使用指定加密算法,生成验证码的签名,其中,签名用于确定用户根据验证图片提交的答案与验证码是否匹配。
上述所有可选技术方案,均可按照任意结合形成本发明的可选实施例,在此不再一一赘述。
结合图1所对应实施例的内容,图2是本发明另一实施例提供的一种验证图片的生成方法的流程图。参见图2,本发明实施例提供的方法流程包括:
201、获取包含验证码的初始图片。
其中,在获取包含验证码的初始图片时,可以先获取任意一张图片;然后,在该图片中添加预先设定或随机生成的验证码,得到初始图片。具体地,为了便于用户后续识别验证图片中的验证码,任意获取的图片的背景颜色可以为纯色。例如,该图片可以为一张白色图片,或为一张粉色图片等。
另外,关于验证码的类型,本发明实施例不作具体限定。例如,验证码可 以为汉字、字母、数字中的任一种。例如,验证码为数字验证码,或者为字母验证码等。另外,验证码还可以为字母、数字或汉字等中至少两种的组合。例如,验证码可以为字母和数字的组合,或者为字母和汉字的组合,还可以为字母、数字和汉字的组合等。
进一步地,关于验证码的颜色,本发明实施例同样不作具体限定。例如,验证码可以为黑色、蓝色等,保证验证码的颜色与获取到的图片的背景颜色不同即可。其中,当验证码包含多个字母时,各个字母的颜色可以相同,也可以不同。另外,每个字母的各部分区域的颜色可以相同,也可以不同。
202、在初始图片中选取一个第一区域,其中,第一区域包含验证码的至少一部分内容。
关于在初始图片中选取第一区域的方式,可以有很多种。例如,可以在初始图片中随机选取一个区域,作为第一区域。或者,获取用户在初始图像中选中的区域,将用户选中的区域作为第一区域等。
另外,本发明实施例在生成验证图片时,选取的第一区域中包含验证码的一部分内容或全部内容。例如,如果初始图片中的验证码总共包含四个字母,则第一区域中可以包含一个字母、两个字母,或者一个字母中的部分区域等,当然,在另一实施例中,第一区域中还可以包括所有四个字母。
进一步地,本发明实施例不对第一区域的形状进行限定。例如,该第一区域可以为圆形区域、椭圆区域、矩形区域等。本发明实施例不对第一区域的面积进行限定,该第一区域只需要为初始图片的子区域即可。
203、在第一区域中所包含的验证码上生成第一噪声点。
为了增加机器识别的难度,本发明实施例在生成验证图片时,通过在初始图片中生成一些噪声点来实现。为了便于描述,将在第一区域中所包含的验证码上生成的噪声点称为第一噪声点。
关于在第一区域中所包含的验证码上生成第一噪声点的方式,包括但不限于通过如下步骤2031和步骤2032来实现:
2031、随机选取第一区域中所包含的验证码中的多个第一像素点。
关于第一像素点的数量,本发明实施例不作具体限定。例如,第一像素点点的数量可以占第一区域内验证码中像素点总数量的指定百分比。其中,该指定百分比可以为百分之五十、百分之三十等。
其中,在随机选取第一区域中所包含的验证码中的多个第一像素点时,为了控制该一像素点点的数量,在选取任一像素点时,可以生成一个随机数,并根据该随机数与指定数值之间的关系来确定是否将该像素点作为一个第一像素点。
具体地,在随机选取像素点时,可以根据指定随机函数生成一个随机数,并判断该随机数是否大于指定数值;当该随机数大于指定数值时,将像素点作为一个第一像素点。
其中,该指定随机函数可以为一个能够生成包括1至100之间数字的函数,也可以为一个能够生成介于0与1之间的数值的函数等。另外,指定数值与指定随机函数及指定百分比相关。例如,当指定百分比为百分之五十,且随机函数为一个能够生成包括1至100之间数字的函数时,该指定数值可以为50等。当指定随机函数为一个能够生成介于0与1之间的数值的函数,指定百分比为百分之三十时,该指定数值可以为0.3等。
2032、将多个第一像素点渲染为第一颜色,得到多个第一噪声点,其中,第一颜色与第一区域中验证码的颜色不同。
其中,在将多个第一像素点渲染为第一颜色时,可以将该多个第一像素点的RGB值转变为第一颜色的RGB值。例如,如果第一颜色的R=125,G=56,B=72,则可以通过将多个第一像素点的颜色由初始图片上验证码的颜色转变为R为125,G为56,B为72的像素点。
关于第一颜色的具体颜色类型,本发明实施例不作具体限定。为了能够对机器识别造成干扰,该第一颜色与第一区域中验证码的颜色不同。例如,当初始图片中验证码的颜色为黑色、背景颜色为白色时,可以将多个第一像素点渲 染为粉色、白色等。
204、在初始图片的第二区域中生成第二噪声点,得到验证图片,其中,第二区域为初始图片中除第一区域以外的区域。
其中,在初始图片的第二区域中生成第二噪声点时,包括但不限于通过如下步骤2041和步骤2042来实现:
2041、随机选取初始图像的第二区域中的多个第二像素点。
该步骤的原理同上述步骤2031中的原理一致,具体可参见上述步骤2031中的内容,此处不再赘述。
2042、将多个第二像素点渲染为第二颜色,得到多个第二噪声点,其中,第二颜色与第二区域的颜色不同。
该步骤的原理同步骤2032中的原理一致,具体可参见上述步骤2032中的内容,此处不再赘述。
关于验证图片的格式,本发明实施例不作具体限定。具体地,验证图片的格式包括但不限于为JPEG(Joint Photographic Experts Group,联合图像专家小组)、PNG(Portable Network Graphic Format,图像文件存储格式)、GIF(Graphic Interchange Format,图形交换格式)或BMP(Bitmap,位图)中的任一种。
需要说明的是,本发明实施例仅以先在第一区域中所包含的验证码上生成第一噪声点,再在第二区域中生成第二噪声点为例进行了说明。然而,在具体实施时,也可以先在第二区域中生成第二噪声点,再在第一区域中所包含的验证码上生成第一噪声点;还可以同时在第一区域中所包含的验证码上生成第一噪声点,并在第二区域中生成第二噪声点,本发明对上述步骤的执行顺序不做具体限定。
为了便于理解,下面以一个具体的例子说明一下本发明实施例提供的验证图片的生成方法。
例如,如果初始图片的背景颜色为黑色、验证码的颜色为白色,则可以先随机获取一个包括部分验证码的圆形区域作为第一区域;然后,将第一区域中 所包含的验证码上的多个第一像素点渲染为黑色,将初始图片中除第一区域以外的第二区域中的多个第二像素点渲染为白色。通过这些步骤,实现了在初始图片中的任一个第一区域中的验证码及第二区域中添加了噪声点。
图3是本发明另一实施例提供的一种验证图片的示意图。如图3所示,该初始图像的背景颜色为黑色,验证码的颜色为白色,通过上述步骤201至步骤204生成的验证图片如图3中的(a)图所示。将该验证图片通过中值滤波法处理后的图片如图3中的(b)图所示。将该验证图片通过膨胀算法处理后的图片如图3中的(c)图所示。由图3中的(b)图和图3中的(c)图可得,通过本发明实施例提供的方法得到的验证图片,不容易通过中值滤波法和膨胀算法滤除其中的噪声点而得到验证码,因此,不容易被机器识别,增强了验证图片的防破解能力。进一步地,当该验证图片用于对用户的操作进行验证时,能够确保操作者为自然人,而非机器,因而能够提高操作的安全性。
进一步地,在步骤204之后,可以应用生成的验证图片对使用者进行验证,起过程可以包括:向使用者提供验证图片,在接收到使用者根据验证图片提交的答案后,对该答案进行验证,如果答案与验证码一致,则验证通过,如果答案与验证码不一致,则验证不通过。将上述步骤所生成的验证图片应用于身份验证等其他验证场合,可以大大提高验证的安全性,减少了恶意使用者的攻击。
205、使用指定加密算法,生成验证码的签名,其中,签名用于确定用户根据验证图片提交的答案与验证码是否匹配。
其中,指定加密算法包括但不限于为MD5(Message-Digest Algorithm 5,信息摘要算法5)算法等,本发明实施例不对指定加密算法的类型进行限定。
具体地,当使用指定加密算法生成验证码的签名后,在使用该验证图片对用户进行验证时,在用户根据验证图片提交答案后,可以使用该指定加密算法计算用户提交答案的签名,并判断用户提交答案的签名是否与验证码的签名匹配。如果用户提交答案的签名与验证码的签名匹配,则确定用户通过验证;如果用户提交答案的签名与验证码的签名不匹配,则确定用户未通过验证。
进一步地,通过本发明实施例提供的方法生成的验证图片可以应用于任意验证场合,用于区分执行操作的执行者为自然人还是机器。例如,该验证图片可以应用于登录的场合、发帖的场合、回复消息的场合、发表评论的场合、下载文件的场合、投票的场合等。关于验证图片的使用场合,本发明实施例不作具体限定。
如图4所示,其示出了一种验证图片的生成方法的应用环境示意图。如图4所示,该应用环境包括终端401、web(网页)服务器402、验证服务器403和验证图片生成服务器404。其中,终端401和web服务器402之间、web服务器与验证服务器403之间、验证服务器403与验证图片生成服务器404之间通过网络连接。该网络可以为有线网络,也可以为无线网络。
结合上述应用环境,本发明实施例在验证图片生成服务器404处进行了创新,使得验证图片生成服务器404可以通过上述步骤201至步骤204生成多个验证图片。另外,验证服务器403可以用于通过上述步骤205生成每个验证图片中的验证码对应的签名。当然,签名也可以由验证图片生成服务器404生成。
具体地,终端401对应的用户在进行一定的操作,如登录操作、投票操作等时,可以通过操作对应的URL(Uniform Resource Locator,统一资源定位符)访问web服务器402。web服务器402确定用户的访问操作后,向验证服务器403请求验证图片。此时,验证服务器403从验证图片生成服务器404拉取其生成的一个验证图片,并生成该验证图片包括的验证码的签名,以及将该验证图片发送至web服务器402,由web服务器402将验证图片发送至终端401。终端401接收该验证图片后,获取用户根据该验证图片输入的验证码后,将该验证码提交至web服务器402,由web服务器402将该验证码提交至验证服务器403。验证服务器403接收用户输入的验证码后,通过指定加密算法生成用户输入的验证码对应的签名,其中,该指定加密算法与验证服务器403生成验证码的签名时使用的指定加密算法相同。接下来,验证服务器403将用户输入的验证码对应的签名与验证图片中的验证码的签名进行匹配,当确定用户输入 的验证码对应的签名与验证图片中的验证码的签名匹配时,确定执行该操作的使用者为人,而并非机器。此时,终端401对应的用户可以执行该操作。
当然,上述过程仅以各个不同的服务器配合来实现验证过程进行了说明,然而,在具体实施时,各个服务器的功能也可以集成在一个服务器,从而由该集成的服务器来实现上述验证过程。例如,可以由验证图片生成服务器404或者验证服务器403集成上述各个服务器的功能,并执行上述验证过程。
另外,上述终端401可以为台式计算机、智能手机、平板电脑、电子书阅读器、MP3(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)播放器、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面3)播放器、膝上型便携计算机、可穿戴设备如智能手环等。
本发明实施例提供的方法,通过在初始图片中某些区域内的验证码上生成第一噪声点,而在其他区域内的图片背景上生成第二噪声点,使得机器无法通过一些简单算法滤除验证图片中的噪声点,从而增加了机器识别验证码的难度,降低了验证码被机器破解的风险,具有较强的防破解能力。
图5是本发明另一实施例提供的一种验证图片的生成装置的结构示意图,该验证图片的生成装置用于执行上述图1或图2所对应实施例提供的验证图片的生成方法。参见图5,该验证图片的生成装置包括:
获取模块501,用于获取包含验证码的初始图片;
选取模块502,用于在初始图片中选取一个第一区域,其中,第一区域包含验证码的至少一部分内容;
第一生成模块503,用于在第一区域中所包含的验证码上生成第一噪声点;
第二生成模块504,用于在初始图片的第二区域中生成第二噪声点,得到验证图片,其中,第二区域为初始图片中除第一区域以外的区域。
本发明实施例提供的装置,通过在初始图片中某些区域内的验证码上生成 第一噪声点,而在其他区域内的图片背景上生成第二噪声点,使得机器无法通过一些简单算法滤除验证图片中的噪声点,从而增加了机器识别验证码的难度,降低了验证码被机器破解的风险,具有较强的防破解能力。
在另一个实施例中,参见图6,第一生成模块503包括:
第一选取单元5031,用于随机选取第一区域中所包含的验证码上的多个第一像素点;
第一渲染单元5032,用于将多个第一像素点渲染为第一颜色,得到多个第一噪声点,其中,第一颜色与第一区域中验证码的颜色不同。
在另一个实施例中,参见图7,第一选取单元5031包括:
生成子单元50311,用于在选取任一像素点时,根据指定随机函数生成一个随机数;
判断子单元50312,用于判断随机数是否大于指定数值;
确定子单元50313,用于当随机数大于指定数值时,将像素点作为一个第一像素点。
在另一个实施例中,参见图8,第二生成模块504包括:
第二选取单元5041,用于随机选取初始图像的第二区域中的多个第二像素点;
第二渲染单元5042,用于将多个第二像素点渲染为第二颜色,得到多个第二噪声点,其中,第二颜色与第二区域的颜色不同。
在另一个实施例中,参见图9,验证图片的生成装置还包括:
第三生成模块505,用于使用指定加密算法,生成验证码的签名,其中,签名用于确定用户根据验证图片提交的答案与验证码是否匹配。
需要说明的是:上述实施例提供的验证图片的生成装置在生成验证图片时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的验证 图片的生成装置及服务器与验证图片的生成方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
图10是根据一示例性实施例示出的一种服务器的结构示意图,该服务器可以用于执行上述图1或图2所对应实施例提供的验证图片的生成方法。参照图10,服务器1000包括处理组件1022,其进一步包括一个或多个处理器,以及由存储器1032所代表的存储器资源,用于存储可由处理组件1022的执行的指令,例如应用程序。存储器1032中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1022被配置为执行指令,以执行上述图1或图2所对应实施例提供的验证图片的生成方法。
服务器1000还可以包括一个电源组件10210被配置为执行服务器1000的电源管理,一个有线或无线网络接口1050被配置为将服务器1000连接到网络,和一个输入输出(I/O)接口1058。服务器1000可以操作基于存储在存储器1032的操作***,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。
其中,一个或者一个以上程序存储于存储器中,且经配置以由一个或者一个以上处理器执行,所述一个或者一个以上程序包含用于进行以下操作的指令:
获取包含验证码的初始图片;
在初始图片中选取一个第一区域,其中,第一区域包含验证码的至少一部分内容;
在第一区域中所包含的验证码上生成第一噪声点;
在初始图片的第二区域中生成第二噪声点,得到验证图片,其中,第二区域为初始图片中除第一区域以外的区域。
假设上述为第一种可能的实施方式,则在第一种可能的实施方式作为基础而提供的第二种可能的实施方式中,服务器的存储器中还包含用于执行以下操 作的指令:在第一区域中所包含的验证码上生成第一噪声点,包括:
随机选取第一区域中所包含的验证码上的多个第一像素点;
将多个第一像素点渲染为第一颜色,得到多个第一噪声点,其中,第一颜色与第一区域中验证码的颜色不同。
在第二种可能的实施方式作为基础而提供的第三种可能的实施方式中,服务器的存储器中还包含用于执行以下操作的指令:随机选取第一区域中所包含的验证码上的多个第一像素点,包括:
在选取任一像素点时,根据指定随机函数生成一个随机数;
判断随机数是否大于指定数值;
当随机数大于指定数值时,将像素点作为一个第一像素点。
在第一种可能的实施方式作为基础而提供的第四种可能的实施方式中,服务器的存储器中还包含用于执行以下操作的指令:在初始图片的第二区域中生成第二噪声点,包括:
随机选取初始图像的第二区域中的多个第二像素点;
将多个第二像素点渲染为第二颜色,得到多个第二噪声点,其中,第二颜色与第二区域的颜色不同。
在第一种至第四种可能的实施方式中的任一种可能的实施方式作为基础而提供的第五种可能的实施方式中,服务器的存储器中还包含用于执行以下操作的指令:得到验证图片之后,还包括:
使用指定加密算法,生成验证码的签名,签名用于确定用户根据验证图片提交的答案与验证码是否匹配。
本发明实施例提供的服务器,通过在初始图像中选取的第一区域中所包含的验证码上生成第一噪声点,并在初始图片中除第一区域外的第二区域中生成第二噪声点,使得机器无法通过一些简单算法滤除验证图片中的噪声点,从而增加了机器识别验证码的难度,降低了验证码被机器破解的风险,具有较强的防破解能力。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器,上述指令可由终端中的处理器执行以完成上述图2A实施例或图3实施例所示出的验证图片的生成方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (15)

  1. 一种验证图片的生成方法,其特征在于,所述方法包括:
    获取包含验证码的初始图片;
    在所述初始图片中选取一个第一区域,所述第一区域包含所述验证码的至少一部分内容;
    在所述第一区域中所包含的验证码上生成第一噪声点;
    在所述初始图片的第二区域中生成第二噪声点,得到验证图片,所述第二区域为所述初始图片中除所述第一区域以外的区域。
  2. 根据权利要求1所述的方法,其特征在于,所述在所述第一区域中所包含的验证码上生成第一噪声点,包括:
    随机选取所述第一区域中所包含的验证码上的多个第一像素点;
    将所述多个第一像素点渲染为第一颜色,得到多个第一噪声点,所述第一颜色与所述第一区域中验证码的颜色不同。
  3. 根据权利要求2所述的方法,其特征在于,所述随机选取所述第一区域中所包含的验证码上的多个第一像素点,包括:
    在选取任一像素点时,根据指定随机函数生成一个随机数;
    判断所述随机数是否大于指定数值;
    当所述随机数大于所述指定数值时,将所述像素点作为一个第一像素点。
  4. 根据权利要求1所述的方法,其特征在于,所述在所述初始图片的第二区域中生成第二噪声点,包括:
    随机选取所述初始图像的第二区域中的多个第二像素点;
    将所述多个第二像素点渲染为第二颜色,得到多个第二噪声点,所述第二 颜色与所述第二区域的颜色不同。
  5. 根据权利要求1至4中任一权利要求所述的方法,其特征在于,所述得到验证图片之后,还包括:
    使用指定加密算法,生成所述验证码的签名,所述签名用于确定用户根据验证图片提交的答案与所述验证码是否匹配。
  6. 一种验证图片的生成装置,其特征在于,所述装置包括:
    获取模块,用于获取包含验证码的初始图片;
    选取模块,用于在所述初始图片中选取一个第一区域,所述第一区域包含所述验证码的至少一部分内容;
    第一生成模块,用于在所述第一区域中所包含的验证码上生成第一噪声点;
    第二生成模块,用于在所述初始图片的第二区域中生成第二噪声点,得到验证图片,所述第二区域为所述初始图片中除所述第一区域以外的区域。
  7. 根据权利要求6所述的装置,其特征在于,所述第一生成模块包括:
    第一选取单元,用于随机选取所述第一区域中所包含的验证码上的多个第一像素点;
    第一渲染单元,用于将所述多个第一像素点渲染为第一颜色,得到多个第一噪声点,所述第一颜色与所述第一区域中验证码的颜色不同。
  8. 根据权利要求7所述的装置,其特征在于,所述第一选取单元包括:
    生成子单元,用于在选取任一像素点时,根据指定随机函数生成一个随机数;
    判断子单元,用于判断所述随机数是否大于指定数值;
    确定子单元,用于当所述随机数大于所述指定数值时,将所述像素点作为 一个第一像素点。
  9. 根据权利要求6所述的装置,其特征在于,所述第二生成模块包括:
    第二选取单元,用于随机选取所述初始图像的第二区域中的多个第二像素点;
    第二渲染单元,用于将所述多个第二像素点渲染为第二颜色,得到多个第二噪声点,所述第二颜色与所述第二区域的颜色不同。
  10. 根据权利要求6至9中任一权利要求所述的装置,其特征在于,所述装置还包括:
    第三生成模块,用于使用指定加密算法,生成所述验证码的签名,所述签名用于确定用户根据验证图片提交的答案与所述验证码是否匹配。
  11. 一种服务器,其特征在于,所述服务器包括:
    一个或多个处理器;和
    存储器;
    所述存储器存储有一个或多个程序,所述一个或多个程序被配置成由所述一个或多个处理器执行,所述一个或多个程序包含用于进行以下操作的指令:
    获取包含验证码的初始图片;
    在所述初始图片中选取一个第一区域,所述第一区域包含所述验证码的至少一部分内容;
    在所述第一区域中所包含的验证码上生成第一噪声点;
    在所述初始图片的第二区域中生成第二噪声点,得到验证图片,所述第二区域为所述初始图片中除所述第一区域以外的区域。
  12. 根据权利要求11所述的服务器,其特征在于,所述存储器中还包含用 于执行以下操作的指令:随机选取所述第一区域中所包含的验证码上的多个第一像素点;
    将所述多个第一像素点渲染为第一颜色,得到多个第一噪声点,所述第一颜色与所述第一区域中验证码的颜色不同。
  13. 根据权利要求12所述的服务器,其特征在于,所述存储器中还包含用于执行以下操作的指令:在选取任一像素点时,根据指定随机函数生成一个随机数;判断所述随机数是否大于指定数值;当所述随机数大于所述指定数值时,将所述像素点作为一个第一像素点。
  14. 根据权利要求11所述的服务器,其特征在于,所述存储器中还包含用于执行以下操作的指令:随机选取所述初始图像的第二区域中的多个第二像素点;将所述多个第二像素点渲染为第二颜色,得到多个第二噪声点,所述第二颜色与所述第二区域的颜色不同。
  15. 根据权利要求11-14任一项所述的服务器,其特征在于,所述存储器中还包含用于执行以下操作的指令:使用指定加密算法,生成所述验证码的签名,所述签名用于确定用户根据验证图片提交的答案与所述验证码是否匹配。
PCT/CN2016/079418 2015-04-23 2016-04-15 验证图片的生成方法、装置以及服务器 WO2016169437A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/443,234 US10439818B2 (en) 2015-04-23 2017-02-27 Captcha image generation method and apparatus, and server

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510197991.1 2015-04-23
CN201510197991.1A CN106157344B (zh) 2015-04-23 2015-04-23 验证图片的生成方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/443,234 Continuation US10439818B2 (en) 2015-04-23 2017-02-27 Captcha image generation method and apparatus, and server

Publications (1)

Publication Number Publication Date
WO2016169437A1 true WO2016169437A1 (zh) 2016-10-27

Family

ID=57144446

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/079418 WO2016169437A1 (zh) 2015-04-23 2016-04-15 验证图片的生成方法、装置以及服务器

Country Status (3)

Country Link
US (1) US10439818B2 (zh)
CN (1) CN106157344B (zh)
WO (1) WO2016169437A1 (zh)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9129102B2 (en) * 2012-03-23 2015-09-08 Paypal, Inc. Hardening security images
CN106157344B (zh) * 2015-04-23 2020-11-10 深圳市腾讯计算机***有限公司 验证图片的生成方法及装置
CN106355072B (zh) * 2016-08-19 2019-02-22 沈建国 三维模型验证码的实现方法及其装置
CN107241320A (zh) * 2017-05-26 2017-10-10 微梦创科网络科技(中国)有限公司 一种基于图像的人机鉴别方法及鉴别***
CN109933970B (zh) * 2017-12-15 2022-12-27 深圳市腾讯计算机***有限公司 一种图形验证码检测方法、装置及存储介质
CN108647683B (zh) * 2018-04-28 2021-08-17 浙江大学 一种基于频域加噪的字符对抗验证码生成方法和***
US10817596B2 (en) * 2018-06-13 2020-10-27 Nanning Fugui Precision Industrial Co., Ltd. Image based authentication code method, server, and authentication code system
CN109117624A (zh) * 2018-08-03 2019-01-01 上海掌门科技有限公司 生成验证码图像的方法、电子设备和计算机可读介质
KR102010360B1 (ko) * 2018-10-08 2019-08-14 넷마블 주식회사 색각 이상 판단 장치 및 방법
WO2020158539A1 (ja) * 2019-01-30 2020-08-06 ソニー株式会社 暗号化装置、暗号化方法
JP7342961B2 (ja) * 2019-09-24 2023-09-12 日本電気株式会社 情報収集装置、情報収集方法、及びプログラム
US11074340B2 (en) 2019-11-06 2021-07-27 Capital One Services, Llc Systems and methods for distorting CAPTCHA images with generative adversarial networks
CN111125672A (zh) * 2019-12-30 2020-05-08 广东智媒云图科技股份有限公司 一种图像验证码的生成方法及装置
CN112231676A (zh) * 2020-10-09 2021-01-15 ***股份有限公司 图形验证码生成、显示、验证方法、装置、设备及存储介质
CN112417419B (zh) * 2020-11-20 2022-12-13 北京字节跳动网络技术有限公司 一种验证码处理方法、装置、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183458A (zh) * 2007-12-20 2008-05-21 腾讯科技(深圳)有限公司 图片验证码生成方法和图片验证码生成装置
CN101923702A (zh) * 2010-08-25 2010-12-22 郝红卫 一种图片验证码的生成方法
US20110197268A1 (en) * 2010-02-05 2011-08-11 Yahoo! Inc. Captchas that include overlapped characters, projections on virtual 3d surfaces, and/or virtual 3d objects
CN102298763A (zh) * 2010-06-28 2011-12-28 腾讯科技(北京)有限公司 一种图片验证码的生成方法及***
CN102884509A (zh) * 2010-05-14 2013-01-16 微软公司 覆盖人类交互证明***和技术
CN104852889A (zh) * 2014-02-18 2015-08-19 腾讯科技(深圳)有限公司 图片验证码生成方法和***、验证方法和客户端及服务器

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05252388A (ja) * 1992-03-05 1993-09-28 Matsushita Electric Ind Co Ltd ノイズ除去装置
KR101126510B1 (ko) * 2004-01-06 2012-03-29 톰슨 라이센싱 시각적 인증 패턴을 검출하고 분석하여 사용하는 개선된기술
WO2008149904A1 (ja) * 2007-06-05 2008-12-11 Olympus Corporation 画像信号処理装置および画像信号処理プログラム
CN101197678B (zh) * 2007-12-27 2011-04-06 腾讯科技(深圳)有限公司 图片验证码生成方法和图片验证码生成装置
US20100046790A1 (en) * 2008-08-22 2010-02-25 Koziol Anthony R Method and system for generating a symbol identification challenge
US8925057B1 (en) * 2009-02-06 2014-12-30 New Jersey Institute Of Technology Automated tests to distinguish computers from humans
US8209743B1 (en) * 2010-03-09 2012-06-26 Facebook, Inc. CAPTCHA image scramble
US8640212B2 (en) * 2010-05-27 2014-01-28 Red Hat, Inc. Securing passwords with CAPTCHA based hash when used over the web
WO2012107879A2 (en) * 2011-02-10 2012-08-16 Site Black Box Ltd. DISTINGUISH VALID USERS FROM BOTS, OCRs AND THIRD PARTY SOLVERS WHEN PRESENTING CAPTCHA
CN102831568B (zh) * 2012-08-03 2014-07-09 网易(杭州)网络有限公司 一种生成验证码图片的方法和装置
CN103870725B (zh) * 2012-12-13 2017-02-15 华为技术有限公司 一种验证码的生成验证方法和装置
CN106157344B (zh) * 2015-04-23 2020-11-10 深圳市腾讯计算机***有限公司 验证图片的生成方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183458A (zh) * 2007-12-20 2008-05-21 腾讯科技(深圳)有限公司 图片验证码生成方法和图片验证码生成装置
US20110197268A1 (en) * 2010-02-05 2011-08-11 Yahoo! Inc. Captchas that include overlapped characters, projections on virtual 3d surfaces, and/or virtual 3d objects
CN102884509A (zh) * 2010-05-14 2013-01-16 微软公司 覆盖人类交互证明***和技术
CN102298763A (zh) * 2010-06-28 2011-12-28 腾讯科技(北京)有限公司 一种图片验证码的生成方法及***
CN101923702A (zh) * 2010-08-25 2010-12-22 郝红卫 一种图片验证码的生成方法
CN104852889A (zh) * 2014-02-18 2015-08-19 腾讯科技(深圳)有限公司 图片验证码生成方法和***、验证方法和客户端及服务器

Also Published As

Publication number Publication date
US20170170967A1 (en) 2017-06-15
CN106157344B (zh) 2020-11-10
CN106157344A (zh) 2016-11-23
US10439818B2 (en) 2019-10-08

Similar Documents

Publication Publication Date Title
WO2016169437A1 (zh) 验证图片的生成方法、装置以及服务器
CN108804884B (zh) 身份认证的方法、装置及计算机存储介质
US9813441B2 (en) Detecting and breaking CAPTCHA automation scripts and preventing image scraping
US10726111B2 (en) Increased security using dynamic watermarking
WO2017101865A1 (zh) 一种数据处理方法和装置
TWI616821B (zh) Bar code generation method, bar code based authentication method and related terminal
US10007776B1 (en) Systems and methods for distinguishing among human users and software robots
US10127373B1 (en) Systems and methods for distinguishing among human users and software robots
US20160241592A1 (en) Identification of trusted websites
US10395022B2 (en) Access control for a resource
US8485428B1 (en) Systems and methods for providing security information about quick response codes
JP2015115079A (ja) 認証入力方法および装置
WO2018059033A1 (zh) 一种验证方法、服务器和***
CN105162604A (zh) 一种基于特征图像识别的验证方法、服务器及***
CN106203141A (zh) 一种应用的数据处理方法和装置
US20230208878A1 (en) Systems and Methods for Tracking and Identifying Phishing Website Authors
CN109388447B (zh) 一种界面绘制和图像处理方法、装置、终端及服务器
CN114567510A (zh) 登录认证方法、装置、设备及存储介质
AU2017412612B2 (en) Systems and methods for distinguishing among human users and software robots
Jin et al. Ar captcha: Recognizing robot by augmented reality
US20240028727A1 (en) Steganographic modification detection and mitigation for enhanced enterprise security
CN113285808B (zh) 一种身份信息核验方法、装置、设备和存储介质
US11240267B1 (en) Identifying and blocking fraudulent websites
CN109951431B (zh) 验证方法、***、电子设备及计算机可读介质
US20230316806A1 (en) Fiducial mark document sharing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16782584

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11/04/2018)

122 Ep: pct application non-entry in european phase

Ref document number: 16782584

Country of ref document: EP

Kind code of ref document: A1