CN101183458A - Picture validation code generating method and device - Google Patents

Picture validation code generating method and device Download PDF

Info

Publication number
CN101183458A
CN101183458A CNA2007103016228A CN200710301622A CN101183458A CN 101183458 A CN101183458 A CN 101183458A CN A2007103016228 A CNA2007103016228 A CN A2007103016228A CN 200710301622 A CN200710301622 A CN 200710301622A CN 101183458 A CN101183458 A CN 101183458A
Authority
CN
China
Prior art keywords
random
validation code
picture validation
pixel
pixel position
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CNA2007103016228A
Other languages
Chinese (zh)
Other versions
CN101183458B (en
Inventor
王亮
王建宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Tencent Computer Systems Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN2007103016228A priority Critical patent/CN101183458B/en
Publication of CN101183458A publication Critical patent/CN101183458A/en
Application granted granted Critical
Publication of CN101183458B publication Critical patent/CN101183458B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a generating method for image checking codes and a generating device for image checking codes. The generating method comprises following steps: the position of a random pixel and a changing pixel value corresponding with the position of the random pixel are determined; a value of a pixel on the position of the random pixel in image checking codes is changed for the changing pixel value. The invention has the advantages of effective prevention of brutal force attack and improvement in safety of image checking codes.

Description

Picture validation code generation method and picture validation code generating apparatus
Technical field
The present invention relates to network application (Application) technical field, more particularly, the present invention relates to a kind of picture validation code generation method and picture validation code generating apparatus.
Background technology
Universal day by day along with computing machine and computer network, the internet has been deep into the every field of people's work, studying and living.Network development also brings various challenges when facilitating.Some unique people can utilize the improper in large quantities use network of robot program free resource, for example mass-send spam etc., and server usefulness is greatly reduced.Also the someone utilizes program constantly to send the services request response, carries out " saturation attack " to reach the purpose that makes the service paralysis.Even the somebody attempts utilizing means such as Brute Force to carry out virtual assets theft etc.For avoiding above-mentioned malicious act, design one cover can allow the computing machine resolution information automatically be that it is extremely important just to seem from reasonable user or the robot program's of improper use instrument.
The fundamental purpose of picture validation code is that resolution network service user is the program or the mankind.Picture validation code is the picture that a width of cloth contains character, can require the user to answer and show which literal in this pictures.For fear of by automatic program identification, in picture validation code, literal is twisted usually, add some noises simultaneously.Current procedure is still not high to the discrimination of this literal, and is human then can correctly be familiar with literal on the picture, has preferable literal recognition capability.Utilize picture validation code mechanism, what can praise answer is human, is considered to program and answer wrong meeting always, thus difference bona fide use person and malice user, and carry out the corresponding subsequent operation thus respectively.
Picture validation code more and more becomes a kind of widely-used instrument that identity is assert in the network service.Along with the development of artificial intelligence and image understanding technology, machine is more and more stronger to the recognition capability of character in the image.Picture validation code need guarantee to improve constantly the ability that anti-machine program cracks under the identifiable prerequisite of human vision.
Facts have proved that for the monocase that splits, the machine recognition rate is almost near perfect under the prior art from image.The difficulty of increase separating character from picture becomes the anti-important means of security that cracks and improve.
Yet, emerge some people at present and utilized limited this limitation of identifying code storehouse picture number, employ ceaselessly input validation sign indicating number of manpower, utilize the repeatability of identifying code picture to carry out Brute Force.
Existing identifying code system generates the identifying code picture library that comprises a large amount of identifying code pictures in advance, and the user submits the checking request at every turn, and the identifying code system chooses an identifying code picture at random and is handed down to the user from the identifying code picture library.If customer group is very big, visit an identifying code webpage simultaneously such as several hundred million users, with respect to the huge user who pulls identifying code, the identifying code picture library that the identifying code system generates in advance just becomes very little, the result is exactly that the probability of the identical identifying code picture that pulls of same user becomes big, and to have a lot all be repetition to identifying code like this.The cracker is according to these characteristics, can manually import several identifying code corresponding characters earlier, the picture that runs into repetition is directly submitted the identifying code character of hand-kept before to, so just can walk around from picture and to extract character and carry out identifying code and crack, thereby cause very big potential safety hazard.
Summary of the invention
The embodiment of the invention proposes a kind of picture validation code generation method, to improve the security of picture validation code.
The embodiment of the invention proposes a kind of picture validation code generating apparatus, to improve the security of picture validation code.
Technical scheme of the present invention is as follows:
A kind of picture validation code generation method, this method comprises:
Determine that the random pixel position reaches the change pixel value corresponding to this random pixel position;
The pixel value of this random pixel position in the picture validation code is changed to described change pixel value.
A kind of picture validation code generating apparatus, this device comprises: random pixel determining unit and pixel value change unit, wherein:
The random pixel determining unit is used for determining that the random pixel position reaches the change pixel value corresponding to this random pixel position;
Pixel value change unit is used for the pixel value of this random pixel position of picture validation code is changed to this change pixel value.
From technique scheme as can be seen, in embodiments of the present invention, determine that at first the random pixel position reaches the change pixel value corresponding to this random pixel position, and then the pixel value of this random pixel position in the picture validation code is changed to described change pixel value.This shows, use after the embodiment of the invention that because the pixel of picture validation code has obtained change, so the unique identification value of all picture validation codes (such as MD5 value, perhaps crc value) is different.Like this, even the picture validation code character in the picture validation code storehouse is identical,, also be different picture validation codes for machine, crack thereby can effectively oppose violence, increased and cracked difficulty, improved the security of picture validation code.
Also have, the embodiment of the invention also provides the picture validation code generation method at the png file layout, can further oppose violence effectively to crack, and increase and crack difficulty.
In addition, the embodiment of the invention adopts the method for picked at random pixel coordinate position, PLTE color position, pixel value, color value, has increased the cost and the cost that adopt the violence method to crack.
Description of drawings
Fig. 1 generates the method flow synoptic diagram according to picture validation code of the present invention;
Fig. 2 is the picture validation code generation method flow synoptic diagram according to the embodiment of the invention;
Fig. 3 is according to picture validation code generating apparatus structural representation of the present invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention express clearlyer, the present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
In embodiments of the present invention, the picture validation code generation method of a kind of effective strick precaution based on the too high Brute Force of picture repetition rate proposed.At first, determine that the random pixel position reaches the change pixel value corresponding to this random pixel position, the pixel value with this random pixel position in the picture validation code changes to described change pixel value then, thereby effectively prevents Brute Force, increases to crack difficulty.
Fig. 1 generates the method flow synoptic diagram according to picture validation code of the present invention.
As shown in Figure 1, this method comprises:
Step 101: determine that the random pixel position reaches the change pixel value corresponding to this random pixel position;
Can determine the random pixel position by the mode of determining pixel coordinate at random here.Such as, location of pixels horizontal ordinate at first definite picture validation code chooses scope and the location of pixels ordinate is chosen scope, choose at described location of pixels horizontal ordinate then and generate the horizontal ordinate of random number in the scope as described random pixel position, choose in the scope at described location of pixels ordinate again and generate the ordinate of random number, determine this random pixel position with the horizontal ordinate and the ordinate of the random pixel that generated at last as described random pixel position.
Wherein, can change at least one passage in R, the G of this random pixel position original pixel value and the B passage, to form the change pixel value of described random pixel position.
Alternatively, also can completely random generate a change pixel value.
If completely random generates a change pixel value, can specifically carry out following steps: at first in the scope of [0,255], generate three random numbers; Then respectively with three random numbers that generated form R, G, three Color Channels of B}, utilizing should { the B} Color Channel be as the change pixel value of this random pixel position for R, G.
Step 102: the pixel value of this random pixel position in the picture validation code is changed to described change pixel value.
The file layout of identifying code picture can have a lot, is specifically as follows jpeg file, png file, JPG file, gif file or BMP file or the like.
Though more than enumerate out some concrete identifying code picture formats, it will be appreciated by those of skill in the art that the present invention is not limited to above-mentioned form, but go for identifying code picture format arbitrarily.
If the identifying code picture format is the png file layout, the embodiment of the invention can also be made amendment the purpose that further reaching opposes violence cracks by the color value to the PLTE field of png file.
Particularly, identifying code picture of picked at random from the identifying code picture library at first, find PLTE field in this file according to the png file layout, and read the number of all colours that is comprised in this png file, in this number of color scope, generate a position and color value at random, and this locational color value is revised as the random color value of generation, with as the picture validation code that generates, and then should be handed down to the user by amended identifying code picture.
In more detail, at first determine the PLTE field number of color S of this png file, in the scope of [0, S], generate random number x again, and generate color value P at random; And will repair from the color value of x byte of PLTE sign beginning and change to P.Wherein in the Png file layout, comprise modules such as png file identification, header, PLTE palette, data block, end block in order.Wherein, PLTE palette module has comprised all colours information of using in this png picture.Such as: sexadecimal string 50 4C 54 45 are PLTE sign corresponding in the png file, 4 byte character strings before this PLTE sign are the palette data length that the PLTE field is comprised, unit is a byte, as 00 00 00 27 explanation palette data length is 39 bytes, i.e. 13 number of colours (each color takies 3 bytes with R, G, B form).
These characteristics based on the png file layout, elder generation's identifying code picture of picked at random from the picture validation code storehouse, in this png file, search sexadecimal string 50 4C 54 45, read the data content of preceding 4 bytes in this position, just can obtain the length s of PLTE field palette data.Like this, the scope of choosing of color position is for { 0, s} can adopt random algorithm to generate 1 random number then, the random number of this generation is for needing to revise the position x of color, color value is by { three passages of B} form are formed for R, G, the bound of each passage (Circular measure) be limited to { 0 up and down, 255} adopts random algorithm to generate 1 random number again, and this random number is for revising the value P of a passage of color position.
Then, will be revised as P from the Color Channel value of the x byte of PLTE sign beginning, thereby can generate new picture validation code, and this new picture validation code will be handed down to the user.
Describe a specific embodiment below again in detail at flow process shown in Figure 1.
Fig. 2 is the picture validation code generation method flow synoptic diagram according to the embodiment of the invention.
As shown in Figure 2, this method comprises:
Step 201: generate random pixel position coordinates and random pixel value.
, can pre-define the scope of choosing of location of pixels coordinate here, wherein horizontal ordinate is limited to { 0 up and down, picture is wide }, ordinate is limited to { 0, the picture height } up and down, and adopting random algorithm to generate 2 random numbers, these 2 random numbers are for needing to revise coordinate { x0, the y0} of pixel.
The random pixel value by { three passages of B} form are formed for R, G, and { 0,255} adopts random algorithm to generate 3 random numbers to the bound of the bound of each passage (Circular measure) again, and these 3 random numbers are for needing to revise pixel value { R0, G0, the B0} of pixel.
Step 202: select an identifying code picture in the picture validation code storehouse at random.
Step 203: the pixel value that changes the random pixel position of this identifying code picture is this random pixel value.
Here, take out coordinate in this identifying code picture the pixel value that x0, y0} are ordered, and its be set to new pixel value R0, G0, B0}, thus can generate new picture validation code, and this new picture validation code is handed down to the user.
The embodiment of the invention has also proposed a kind of picture validation code generating apparatus.
Fig. 3 is according to picture validation code generating apparatus structural representation of the present invention.
As shown in Figure 3, this device comprises random pixel determining unit 301 and pixel value change unit 302, wherein:
Random pixel determining unit 301 is used for determining that the random pixel position reaches the change pixel value corresponding to this random pixel position;
Pixel value change unit 302 is used for the pixel value of this random pixel position of picture validation code is changed to this change pixel value.
Wherein, described random pixel generation unit 301, the location of pixels horizontal ordinate that is used for determining picture validation code chooses scope and the location of pixels ordinate is chosen scope, choose in the scope at described location of pixels horizontal ordinate and to generate the horizontal ordinate of random number as described random pixel, choose in the scope at described location of pixels ordinate and to generate the ordinate of random number, and determine this random pixel position with the horizontal ordinate and the ordinate of this random pixel of being generated as described random pixel.
Described random pixel generation unit 302 is used for generating three random numbers in the scope in [0,255], and forms with three random numbers that generated respectively that { three Color Channels of B} are as the change pixel value of this random pixel position for R, G.
When picture validation code was the png file, this device may further include PLTE field color processing unit,
Described PLTE field color processing unit is used for determining the PLTE field number of color S of this png file generating number x at random and generate color value P at random in the scope of [0, S], and will repair from the color value of x byte of PLTE sign beginning and change to P.
In sum, in embodiments of the present invention, determine that at first the random pixel position reaches the change pixel value corresponding to this random pixel position, and then the pixel value of this random pixel position in the picture validation code is changed to described change pixel value.Like this, the embodiment of the invention has guaranteed that the unique identification value of all picture validation codes is (such as the MD5 value, perhaps crc value) be different, even the character in the picture validation code is identical, for machine, also be different picture validation codes, crack thereby effectively oppose violence, increased and cracked difficulty, improved the security of picture validation code.
In addition, the embodiment of the invention also provides the picture validation code generation method of revising PLTE field color value at the png file layout, can further oppose violence effectively and crack, and increase and crack difficulty.
In addition, the embodiment of the invention adopts the method for picked at random pixel coordinate position, PLTE color position, pixel value, color value, has increased the cost and the cost that adopt the violence method to crack.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (11)

1. a picture validation code generation method is characterized in that, this method comprises:
Determine that the random pixel position reaches the change pixel value corresponding to this random pixel position;
The pixel value of this random pixel position in the picture validation code is changed to described change pixel value.
2. picture validation code generation method according to claim 1 is characterized in that, described definite random pixel position comprises:
Determine that location of pixels horizontal ordinate in the picture validation code is chosen scope and the location of pixels ordinate is chosen scope;
Choose in the scope at described location of pixels horizontal ordinate and to generate the horizontal ordinate of random number, choose at described location of pixels ordinate and generate the ordinate of random number in the scope as described random pixel position as described random pixel position;
Horizontal ordinate and ordinate with the random pixel that generated are determined this random pixel position.
3. picture validation code generation method according to claim 1 is characterized in that, the change pixel value of described definite random pixel position comprises:
In the scope of [0,255], generate three random numbers;
Form with three random numbers that generated respectively that { three Color Channels of B} are as the change pixel value of this random pixel position for R, G.
4. picture validation code generation method according to claim 1 is characterized in that, the change pixel value of described definite random pixel position comprises:
Change at least one Color Channel in R, the G of this random pixel position original pixel value and the B Color Channel, to form the change pixel value of described random pixel position.
5. picture validation code generation method according to claim 1 is characterized in that, described picture validation code is the png file, and this method further comprises:
Determine the PLTE field number of color S of this png file;
In the scope of [0, S], generate random number x, and generate color value P at random;
To repair from the color value of x byte of PLTE sign beginning and change to described P.
6. according to each described picture validation code generation method among the claim 1-5, it is characterized in that described picture validation code is jpeg file, png file, JPG file, gif file or BMP file.
7. a picture validation code generating apparatus is characterized in that, this device comprises: random pixel determining unit and pixel value change unit, wherein:
The random pixel determining unit is used for determining that the random pixel position reaches the change pixel value corresponding to this random pixel position;
Pixel value change unit is used for the pixel value of this random pixel position of picture validation code is changed to this change pixel value.
8. picture validation code generating apparatus according to claim 7 is characterized in that,
Described random pixel generation unit, the location of pixels horizontal ordinate that is used for determining picture validation code chooses scope and the location of pixels ordinate is chosen scope, choose in the scope at described location of pixels horizontal ordinate and to generate the horizontal ordinate of random number as described random pixel, choose in the scope at described location of pixels ordinate and to generate the ordinate of random number, and determine this random pixel position with the horizontal ordinate and the ordinate of this random pixel of being generated as described random pixel.
9. picture validation code generating apparatus according to claim 7 is characterized in that,
Described random pixel generation unit is used for generating three random numbers in the scope in [0,255], and forms with three random numbers that generated respectively that { three Color Channels of B} are as the change pixel value of this random pixel position for R, G.
10. picture validation code generating apparatus according to claim 7 is characterized in that, described picture validation code is the png file, and this device further comprises PLTE field color processing unit,
Described PLTE field color processing unit is used for determining the PLTE field number of color S of this png file generating number x at random and generate color value P at random in the scope of [0, S], and will repair from the color value of x byte of PLTE sign beginning and change to P.
11. according to each described picture validation code generating apparatus among the claim 7-10, it is characterized in that,
Described picture validation code is jpeg file, png file, JPG file, gif file or BMP file.
CN2007103016228A 2007-12-20 2007-12-20 Picture validation code generating method and device Active CN101183458B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007103016228A CN101183458B (en) 2007-12-20 2007-12-20 Picture validation code generating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007103016228A CN101183458B (en) 2007-12-20 2007-12-20 Picture validation code generating method and device

Publications (2)

Publication Number Publication Date
CN101183458A true CN101183458A (en) 2008-05-21
CN101183458B CN101183458B (en) 2010-12-15

Family

ID=39448721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007103016228A Active CN101183458B (en) 2007-12-20 2007-12-20 Picture validation code generating method and device

Country Status (1)

Country Link
CN (1) CN101183458B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102298763A (en) * 2010-06-28 2011-12-28 腾讯科技(北京)有限公司 Method and system for generating picture identifying code
CN102882681A (en) * 2012-09-18 2013-01-16 张仁平 Method and system adopting number of image elements as security code
CN103188263A (en) * 2013-03-22 2013-07-03 百度在线网络技术(北京)有限公司 Verification method, system and device
CN103312512A (en) * 2013-06-07 2013-09-18 深圳第七大道网络技术有限公司 Image verification code generating method, image verification code generating device, identity verification method and identity verification device
CN103902875A (en) * 2014-03-04 2014-07-02 百度在线网络技术(北京)有限公司 Verification code image generating method and device and verification method and device
US20150009235A1 (en) * 2012-02-27 2015-01-08 Rohde & Schwarz Gmbh & Co. Kg Method and apparatus for displaying ordinate abscissa value pairs on a display device
CN105323065A (en) * 2014-07-21 2016-02-10 腾讯科技(深圳)有限公司 Safety verification method and device
WO2016169437A1 (en) * 2015-04-23 2016-10-27 腾讯科技(深圳)有限公司 Verification picture generation method and device, and server
CN106161023A (en) * 2015-04-02 2016-11-23 深圳市腾讯计算机系统有限公司 Auth response method and system based on picture validation code
CN111125672A (en) * 2019-12-30 2020-05-08 广东智媒云图科技股份有限公司 Method and device for generating image verification code

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102298763A (en) * 2010-06-28 2011-12-28 腾讯科技(北京)有限公司 Method and system for generating picture identifying code
US9396516B2 (en) * 2012-02-27 2016-07-19 Rohde & Schwarz Gmbh & Co. Kg Method and apparatus for displaying ordinate abscissa value pairs on a display device
US20150009235A1 (en) * 2012-02-27 2015-01-08 Rohde & Schwarz Gmbh & Co. Kg Method and apparatus for displaying ordinate abscissa value pairs on a display device
CN102882681A (en) * 2012-09-18 2013-01-16 张仁平 Method and system adopting number of image elements as security code
CN103188263A (en) * 2013-03-22 2013-07-03 百度在线网络技术(北京)有限公司 Verification method, system and device
CN103312512A (en) * 2013-06-07 2013-09-18 深圳第七大道网络技术有限公司 Image verification code generating method, image verification code generating device, identity verification method and identity verification device
CN103312512B (en) * 2013-06-07 2016-03-02 深圳第七大道网络技术有限公司 A kind of generation method of picture validation code and device, auth method and device
CN103902875A (en) * 2014-03-04 2014-07-02 百度在线网络技术(北京)有限公司 Verification code image generating method and device and verification method and device
CN105323065A (en) * 2014-07-21 2016-02-10 腾讯科技(深圳)有限公司 Safety verification method and device
CN106161023A (en) * 2015-04-02 2016-11-23 深圳市腾讯计算机系统有限公司 Auth response method and system based on picture validation code
CN106161023B (en) * 2015-04-02 2019-11-05 深圳市腾讯计算机系统有限公司 Auth response method and system based on picture validation code
WO2016169437A1 (en) * 2015-04-23 2016-10-27 腾讯科技(深圳)有限公司 Verification picture generation method and device, and server
US10439818B2 (en) 2015-04-23 2019-10-08 Tencent Technology (Shenzhen) Company Limited Captcha image generation method and apparatus, and server
CN111125672A (en) * 2019-12-30 2020-05-08 广东智媒云图科技股份有限公司 Method and device for generating image verification code

Also Published As

Publication number Publication date
CN101183458B (en) 2010-12-15

Similar Documents

Publication Publication Date Title
CN101183458B (en) Picture validation code generating method and device
JP6220407B2 (en) Document classification using multi-scale text fingerprinting
CN101197678B (en) Picture identifying code generation method and generation device
CN112861648B (en) Character recognition method, character recognition device, electronic equipment and storage medium
CN112989348B (en) Attack detection method, model training method, device, server and storage medium
CN109214159B (en) User information protection system and method for terminal face recognition cloud service
CN104899499A (en) Internet image search based Web verification code generation method
CN102893576A (en) Method and device for mitigating cross-site vulnerabilities
CN107819748B (en) Anti-cracking verification code implementation method and device
CN113704781A (en) File secure transmission method and device, electronic equipment and computer storage medium
CN106357682A (en) Phishing website detecting method
CN110417746A (en) Cross-site scripting attack defence method, device, equipment and storage medium
CN114626079A (en) File viewing method, device, equipment and storage medium based on user permission
CN115664859B (en) Data security analysis method, device, equipment and medium based on cloud printing scene
JP2012182737A (en) Secret data leakage preventing system, determining apparatus, secret data leakage preventing method and program
CN115268799B (en) Storage method and device based on cloud service
CN116561777A (en) Data processing method and device
Valentim et al. Augmenting phishing squatting detection with GANs
CN113536782B (en) Sensitive word recognition method and device, electronic equipment and storage medium
CN115001768A (en) Data interaction method, device and equipment based on block chain and storage medium
KR20220152167A (en) A system and method for detecting phishing-domains in a set of domain name system(dns) records
CN114513355A (en) Malicious domain name detection method, device, equipment and storage medium
CN113992390A (en) Phishing website detection method and device and storage medium
CN106506614A (en) The generation method of mobile terminal identification code, generating means and mobile terminal
CN114723400B (en) Service authorization management method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20151218

Address after: The South Road in Guangdong province Shenzhen city Fiyta building 518057 floor 5-10 Nanshan District high tech Zone

Patentee after: Shenzhen Tencent Computer System Co., Ltd.

Address before: Shenzhen Futian District City, Guangdong province 518044 Zhenxing Road, SEG Science Park 2 East Room 403

Patentee before: Tencent Technology (Shenzhen) Co., Ltd.