Wrote a PHP identification code of small program-welcome everyone to row bricks.
Recent research on some of the breakthrough verification Code knowledge, recorded. On the one hand is a summary of these days learning knowledge to help themselves understand, on the other hand hope to study the technical students in this area to help, but also want to attract the attention of website managers, in the provision of verification code more considerations. Because just contact this knowledge, understanding is relatively simple, there are mistakes again inevitably, welcome to shoot bricks.
The role of verification Code: effectively prevent a hacker to a particular registered user with a specific program of brute force to make a continuous landing attempt. In fact, modern verification code is generally to prevent the machine batch registration, prevent the machine batch post reply. At present, many websites in order to prevent users to use the robot automatic registration, login, irrigation, have adopted the Verification Code technology.
The so-called verification Code, is a series of randomly generated numbers or symbols, to generate a picture, the picture with some interference pixels (to prevent OCR), by the user to identify the identification of the verification code information, input form submitted to the site verification, verification success to use a function.
Our most common verification code
1, four digits, a random number string, the most primitive verification code, the verification function is almost zero.
2, random Digital Image verification code. The characters on the picture are quite good, some may add some random interferon, some are random character color, the verification function is better than the previous one. People who do not have basic graphics and image knowledge can not be broken!
3. Random numbers in various image formats + random uppercase English letters + random interference pixels + random position.
4, the Chinese character is the current registration of the latest verification code, randomly generated, fight more difficult, affecting the user experience, so, the general application of the relatively few.
For the sake of simplicity, the main object of our explanation this time is the 2nd type, we first look at several kinds of online more common such verification code picture.
These three styles, basically can represent 2 of the type of verification code mentioned, initially looks like the first picture is the most easy to crack, the second, the third more difficult, the fourth hardest.
The real situation? In fact, these three kinds of image crack the same difficulty.
The first picture, the easiest, the picture background and numbers are all using the same color, the character is regular, the character position is uniform.
The second picture, seemingly not easy, in fact, careful study will find its rules, background color and interferon no matter how changes, verify the character is regular, the color is the same, so it is very easy to exclude interferon, as long as the non-character pigment completely excluded.
The third picture, seemingly more complex, handles the above mentioned background color and the interferon has been changing, the validation character color is also changing, and the color of each character is different. Seemingly unable to break through this verification code, this article, on a type of verification code as an example, the fourth picture, the students engage in their own.
The fourth picture, in addition to the features mentioned in the third picture, added two lines of interference rate in the text, seemingly difficult actually, it is easy to remove.
Verification code identification is generally divided into the following steps:
1. Remove the font
2. Two value
3. Calculating features
4. Control Sample
1: Remove the font
Identification verification code, after all, is not a professional OCR recognition, and, because each site verification code is different, so, the most common method is to establish the signature library of this verification code. To go to the matrix, we need to download a few more pictures, so that these pictures, including all the characters, we have the letters here only pictures, so as long as the collection of images including 0-9 can be.
2: Two value
Binary is the verification on the image on the number of each pixel with a number of 1, the other part is expressed in 0. In this way, each digital font can be calculated, and the fonts are recorded as key.
3: Calculation feature
The image to be recognized, binary, to get the picture characteristics.
4: Control Sample
Compare the image signature of step 3 with the matrix of the verification code to get the number on the verified image.
Using this method, the identification of the verification code can basically achieve 100%.
Through the above steps, you may have said, and did not find how to remove interferon ah! In fact, the method of removing interferon is very simple, an important feature of interferon is that it can not affect the display effect of the verification code, so when making interferon, its RGB may be lower or higher than a certain value, such as the image I gave to the example, interferon RGB values are not more than 125, so, So we can easily get rid of interferon.
------Solution--------------------
I've conceived a verification code.
Mister into a set of strings ... Plus a little change ... That is the current common method
And do some special processing on the disturbance.
Bitmap using random number ... All colors are random.
Mix two images
To produce an image of a similar relief or shade.
Its color is relative and chaotic ~ only a few vague boundary orientations
So it can't be binary.
can only use the blur of the human brain to complete ~
But there is no time to realize ~ and less efficient
------Solution--------------------
Verification code displays the number of Chinese characters capitalized, enter the Arabic numerals, to verify
------Solution--------------------
Support a bit!
Not bad
------Solution--------------------
From the perspective of art, not too complicated, otherwise difficult to see. Beautiful background plus a few numbers, can be several color numbers, you can. At the same time, the place is small, the height of 11 to 15 pixels is just right, big ugly.
Landlord you want to give me more points, now poor, score too little. They are tens of thousands of points, not missing.
------Solution--------------------
Is this a sub-point?
------Solution--------------------
The top
------Solution--------------------
!
------Solution--------------------
Study.
------Solution--------------------
Study the
------Solution--------------------
Http://blog.csdn.net/luojxun/archive/2008/09/27/2979694.aspx
The generated random code landlord method is not recognized. Oh
------Solution--------------------
Oh, have time to look at the east of reCAPTCHA foreigners, it is called a
------Solution--------------------
Does not work very much, if is the onclick excitation layer rewrite you this recognition is useless. If the verification code written as a serial cipher card type has no picture at all, just fill in the two-dimensional array. is not recognizable.
------Solution--------------------
Do not know the landlord write to do what use? If it is me, the cost of the heart is better than sleep a lazy sleep ...
------Solution--------------------
Pay attention.
------Solution--------------------
Study the
------Solution--------------------
References:
will increase the two value of the difficulty, hehe, but in theory, the human brain can complete the fuzzy completion,
The machine can also be completed, perhaps the effect is poor.