Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
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:
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:
Response.Expires = 0
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-ctrol", "No-cache"
Response.ContentType = "Image/bmp"
Dim Text_data (9), Text_len,int_temp (), I,J,K,INT_TEMP2
"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)
INT_TEMP2 = (TEXT_LEN/4-text_len \ 4) * 4
Select Case INT_TEMP2
Response.BinaryWrite ChrB (0) & ChrB (0) & ChrB (0)
Response.BinaryWrite ChrB (0) & ChrB (0)
Response.BinaryWrite ChrB (0)
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))
Get_backcolor = CInt (Mid ("081515151515", Int (RND * 6) * 2 + 1,2))
Function Get_forecolor ()
"Get a front view
Get_forecolor = CInt (Mid ("00021209", Int (RND * 4) * 2 + 1,2))
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.