ASP-generated color variable-length verification code program

Source: Internet
Author: User
Tags bmp image chr variable
Program | Verify code Remember "Think of the Year" one morning in the past, see a friend of his own written verification code program, although his program is black and white have miscellaneous points, but in fact very easy to be cracked, but there are many people like ... No way, the afternoon of the study of a BMP picture, and then wrote the code, just did not publish, see today so many bad people in many forums registered users to send ads, so just posted out to share.

The characteristics of this code generation program are as follows:

First, color;

Second, BMP image color deeply 16, the resulting picture volume is smaller; (4-bit long verification code only hundreds of bytes)

Three, the length can be customized; (1 to 25 bits can be fixed, can also be changed to dynamic)

Four, background noise depth can be customized;

Please look at the code specifically

Note: The code does not have a setting for the dynamic network validation code session where. Want to use the friends themselves according to need to change, location in the code appears in the session ("Num") that line, changed to their own needs of the name on it. This verification code can also be used in any place where verification code is required. Not in the network forum also can.

Here is the Code section:
<--r>option Explicit
Response.Expires = 0
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-ctrol", "No-cache"
Response.ContentType = "Image/bmp"
Randomize Timer

Dim Text_data (9), Text_len,int_temp (), I,J,K,INT_TEMP2

' * * * Parameters Configuration Area * * *

Text_len = 4 ' Verification Code length (1-25-bit support)

''**********************

ReDim int_temp (text_len-1)

Text_data (0) = " 00000000000001111000001100110000110111000011011100001100110000111011000011101100001100110000011110000000000000 "
Text_data (1) = " 00000000000000011000000011100000111110000000011000000001100000000110000000011000000001100000000110000000000000 "
Text_data (2) = " 00000000000001111000001100110000110011000000001100000001100000001100000001100000001100000000111111000000000000 "
Text_data (3) = " 00000000000001111000001100110000110011000000001100000011100000000011000011001100001100110000011110000000000000 "
Text_data (4) = " 00000000000001100000000110000000011011000001101100000110110000110011000011111110000000110000000011000000000000 "
Text_data (5) = " 00000000000011111100001100000000110000000011000000001111100000000011000000001100000001100000111100000000000000 "
Text_data (6) = " 00000000000000111000000011000000011000000011111000001100110000110011000011001100001100110000011110000000000000 "
Text_data (7) = " 00000000000011111100000000110000000110000000011000000011000000001100000001100000000110000000011000000000000000 "
Text_data (8) = " 00000000000001111000001100110000110011000011101100000111100000110111000011001100001100110000011110000000000000 "
Text_data (9) = " 00000000000001111000001100110000110011000011001100001100110000011111000000011000000011000000011100000000000000 "

"Randomly generate your verification code below
Session ("Num") = ""
For I = 0 to Text_len-1
Int_temp (I) = Int (RND * 10)
Session ("num") = Session ("num") + Mid ("0123456789", Int_temp (I) +1,1)
Next

"The output file head points below
INT_TEMP2 = (text_len-1) \ 4 * (text_len-1)/4-(text_len-1) \ 4 * 4) * 44
Response.BinaryWrite ChrB (&h42) & ChrB (&AMP;H4D)
Response.BinaryWrite ChrB ((INT_TEMP2 + 206)/256-(INT_TEMP2 + 206) \ 256) * 256) & ChrB ((int_temp2 + 206) \ 256) ' ' Special bit
Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&h76) &A mp ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&h28) & ChrB (0) & ChrB (0) & ChrB (0)
Response.BinaryWrite ChrB (Text_len * 10) ' Special bit
Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&AMP;HB) & ChrB (0) & ChrB (0) & ChrB (0) &am P ChrB (&AMP;H1) & ChrB (0) & ChrB (&AMP;H4) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0)
Response.BinaryWrite ChrB ((INT_TEMP2 +)/256-(INT_TEMP2 +) \ 256) * 256) & ChrB ((INT_TEMP2 + 88) \ 256) ' Special Bit

Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & CHR B (0) & ChrB (0) & ChrB (0) & ChrB (+) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (a) & ChrB (0) &am P ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (& H80) & ChrB (0) & ChrB (0) & ChrB (&h80) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&AMP;H80) & ChrB (&AMP;H80) & ChrB (0) & ChrB (&h80) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&h80) & Ch RB (0) & ChrB (&h80) & ChrB (0)
Response.BinaryWrite ChrB (&h80) & ChrB (&h80) & ChrB (0) & ChrB (0) & ChrB (&h80) & ChrB ; H80) & ChrB (&h80) & ChrB (0) & ChrB (&AMP;HC0) & ChrB (&AMP;HC0) & ChrB (&AMP;HC0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & Amp ChrB (0) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & CHR B (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (0) & ChrB (0) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (&AMP;HFF) & ChrB (0)

"Output picture data below
For i = 0 Step-1
For j = 0 to Text_len-1
For k = 1 to 9 Step 2
If Mid (Text_data (Int_temp (j)), I * + k, 1) = "0" Then int_temp2 = Get_backcolor () * Else INT_TEMP2 = Get_forecolor () * 16
If Mid (Text_data (Int_temp (j)), I * + k + 1, 1) = "0" Then int_temp2 = int_temp2 + get_backcolor () Else INT_TEMP2 = in T_TEMP2 + Get_forecolor ()
Response.BinaryWrite ChrB (INT_TEMP2)
Next
Next
INT_TEMP2 = (TEXT_LEN/4-text_len \ 4) * 4
Select Case INT_TEMP2
Case 1
Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0)
Case 2
Response.BinaryWrite ChrB (0) & ChrB (0)
Case 3
Response.BinaryWrite ChrB (0)
End Select
Next

Function Get_backcolor ()
"Get a background color
If Int (Rnd *) = 0 Then ' NOTE: here Rnd * 30 is the size of the background noise, the greater the value, the less noise, the easier the picture to see
Get_backcolor = CInt (Mid ("00021209", Int (RND * 4) * 2 + 1,2))
Else
Get_backcolor = CInt (Mid ("081515151515", Int (RND * 6) * 2 + 1,2))
End If
End Function

Function Get_forecolor ()
"Get a front view
Get_forecolor = CInt (Mid ("00021209", Int (RND * 4) * 2 + 1,2))
End Function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.