Adding Clutter pixel ASP Verification code generator program

Source: Internet
Author: User
Tags generator

Call Createsafecode () ' Calls Createsafecode procedure
Sub Createsafecode () ' defines createsafecode procedures
The ' AddHeader method is used to add a special HTTP header to be sent to the client application
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-ctrol", "No-cache"
' The HTTP content type of the specified response is ' image/bmp '
Response.contenttype= "Image/bmp"
' generates random numbers because Rnd generates a number less than 1 but greater than or equal to 0, so 8999*rnd+1000 gets the
' Random number is a four-digit number
Randomize Timer
Safecode=cint (8999*rnd+1000)
' Save Safecode in Sessioncode (' Safecode ')
Session ("Safecode") =safecode
' defines a two-dimensional array that holds the character data
Dim Letter (10,20)

' To display the character ' 0 '
Letter (0,0) = "0000000000000000"
Letter (0,1) = "0000111110000000"
Letter (0,2) = "0001111111000000"
Letter (0,3) = "0011100011100000"
Letter (0,4) = "0011000001110000"
Letter (0,5) = "0111000000110000"
Letter (0,6) = "0110000000111000"
Letter (0,7) = "0110000000111000"
Letter (0,8) = "1110000000111000"
Letter (0,9) = "1100000000111000"
Letter (0,10) = "1100000000111000"
Letter (0,11) = "1110000000111000"
Letter (0,12) = "1110000000110000"
Letter (0,13) = "1110000000110000"
Letter (0,14) = "0110000000110000"
Letter (0,15) = "0111000001110000"
Letter (0,15) = "0011100001100000"
Letter (0,16) = "0001111111000000"
Letter (0,17) = "0000111110000000"
Letter (0,18) = "0000000000000000"
Letter (0,19) = "0000000000000000"

' To display the character ' 1 '
Letter (1,0) = "0000000000000000"
Letter (1,1) = "0000000111000000"
Letter (1,2) = "0000000111000000"
Letter (1,3) = "0000001110000000"
Letter (1,4) = "0000001100000000"
Letter (1,5) = "0000001100000000"
Letter (1,6) = "0000001100000000"
Letter (1,7) = "0000011100000000"
Letter (1,8) = "0000011100000000"
Letter (1,9) = "0000011100000000"
Letter (1,10) = "0000011000000000"
Letter (1,11) = "0000011000000000"
Letter (1,12) = "0000011000000000"
Letter (1,13) = "0000011000000000"
Letter (1,14) = "0000011000000000"
Letter (1,15) = "0000011000000000"
Letter (1,16) = "0000011000000000"
Letter (1,17) = "0000001000000000"
Letter (1,18) = "0000000000000000"
Letter (1,19) = "0000000000000000"
' To display the character ' 2 '
Letter (2,0) = "0000000000000000"
Letter (2,1) = "0000111111000000"
Letter (2,2) = "0001111111100000"
Letter (2,3) = "0011100001110000"
Letter (2,4) = "0111000001110000"
Letter (2,5) = "0111000001100000"
Letter (2,6) = "0110000001100000"
Letter (2,7) = "0000000011100000"
Letter (2,8) = "0000000111000000"
Letter (2,9) = "0000000111000000"
Letter (2,10) = "0000001100000000"
Letter (2,11) = "0000011100000000"
Letter (2,12) = "0000111000000000"
Letter (2,13) = "0001100000000000"
Letter (2,14) = "0001100000000000"
Letter (2,15) = "0011000001110000"
Letter (2,16) = "0110111111110000"
Letter (2,17) = "0111111111111000"
Letter (2,18) = "0111110000000000"
Letter (2,19) = "0000000000000000"

  The character to display "3"
 letter (3,0) = "0000000000000000"
 letter (3,1) = "0000111111100000"
  Letter (3,2) = "0011111111100000"
 letter (3,3) = "0111000011110000"
 letter (3,4) = "0110000001100000"
 letter (3,5) = "0100000011100000"
 letter (3,6) = "0000000011100000"
 letter (3,7) = " 0000000111000000 "
 letter (3,8) =" 0000001100000000 "
 letter (3,9) =" 0000011111000000 "
  Letter (3,10) = "0000010011100000"
 letter (3,11) = "0000000001110000"
 letter (3,12) = " 0000000001110000 "
 letter (3,13) =" 0000000001110000 "
 letter (3,14) =" 0000000001110000 "
  Letter (3,15) = "0000000001100000"
 letter (3,16) = "1110000011100000"
 letter (3,17) = " 1111111111000000 "
 letter (3,18) =" 0111111110000000 "
 letter (3,19) =" 0000000000000000 "

  The character to display "4"
 letter (4,0) = "0000000000000000"
 letter (4,1) = "0000000011100000"
  Letter (4,2) = "0000000111100000"
 letter (4,3) = "0000001110000000"
 letter (4,4) = "0000011101110000"
 letter (4,5) = "0000111001110000"
 letter (4,6) = "0000110001100000"
 letter (4,7) = " 0001100011100000 "
 letter (4,8) =" 0011100011000000 "
 letter (4,9) =" 0111000011000000 "
  Letter (4,10) = "0110000011000000"
 letter (4,11) = "0110000011000000"
 letter (4,12) = " 1100011111111000 "
 letter (4,13) =" 1111111111110000 "
 letter (4,14) =" 1111111110000000 "
  Letter (4,15) = "1110000110000000"
 letter (4,16) = "0000000111000000"
 letter (4,17) = " 0000000011000000 "
 letter (4,18) =" 0000000011000000 "
 letter (4,19) =" 0000000010000000 "

  The character to display "5"
 letter (5,0) = "0000000000000000"
 letter (5,1) = "0000110000010000"
  Letter (5,2) = "0001111111111000"
 letter (5,3) = "0001111111110000"
 letter (5,4) = "0001111000000000"
 letter (5,5) = "0001100000000000"
 letter (5,6) = "0011100000000000"
 letter (5,7) = " 0011100000000000 "
 letter (5,8) =" 0011111111000000 "
 letter (5,9) =" 0011111111100000 "
  Letter (5,10) = "0000000001100000"
 letter (5,11) = "0000000001100000"
 letter (5,12) = " 0000000001100000 "
 letter (5,13) =" 0000000001100000 "
 letter (5,14) =" 0000000001100000 "
  Letter (5,15) = "0000000001100000"
 letter (5,16) = "0000000111100000"
 letter (5,17) = " 0111111111000000 "
 letter (5,18) =" 0011111100000000 "
 letter (5,19) =" 0000000010000000 "

  The character to display "6"
 letter (6,0) = "0000000000000000"
 letter (6,1) = "0000001111000000"
  Letter (6,2) = "0000011110000000"
 letter (6,3) = "0000111000000000"
 letter (6,4) = "0001110000000000"
 letter (6,5) = "0011100000000000"
 letter (6,6) = "0011000000000000"
 letter (6,7) = " 0011000000000000 "
 letter (6,8) =" 0111111111000000 "
 letter (6,9) =" 0111111111100000 "
  Letter (6,10) = "0111000001110000"
 letter (6,11) = "0110000000110000"
 letter (6,12) = " 0110000000110000 "
 letter (6,13) =" 0110000000110000 "
 letter (6,14) =" 0110000000110000 "
  Letter (6,15) = "0111000001110000"
 letter (6,16) = "0011000001110000"
 letter (6,17) = " 0011111111100000 "
 letter (6,18) =" 0001111111000000 "
 letter (6,19) =" 0000000000000000 "

  The character to display "7"
 letter (7,0) = "0000000000000000"
 letter (7,1) = "0010011111111000"
  Letter (7,2) = "0111111111110000"
 letter (7,3) = "0111111001110000"
 letter (7,4) = "0000000001100000"
 letter (7,5) = "0000000011100000"
 letter (7,6) = "0000000011000000"
 letter (7,7) = " 0000000011000000 "
 letter (7,8) =" 0000000011000000 "
 letter (7,9) =" 0000000111000000 "
  Letter (7,10) = "0000000110000000"
 letter (7,11) = "0000000110000000"
 letter (7,12) = " 0000000110000000 "
 letter (7,13) =" 0000000110000000 "
 letter (7,14) =" 0000001110000000 "
  Letter (7,15) = "0000001110000000"
 letter (7,16) = "0000001110000000"
 letter (7,17) = " 0000000100000000 "
 letter (7,18) =" 0000000100000000 "
 letter (7,19) =" 0000000000000000 "

  The character to display "8"
 letter (8,0) = "0000000000000000"
 letter (8,1) = "0000111111000000"
  Letter (8,2) = "0001111111100000"
 letter (8,3) = "0011100001100000"
 letter (8,4) = "0011000001100000"
 letter (8,5) = "0111000001110000"
 letter (8,6) = "0111000001100000"
 letter (8,7) = " 0011000001100000 "
 letter (8,8) =" 0011110111100000 "
 letter (8,9) =" 0001111111100000 "
  Letter (8,10) = "0011100011110000"
 letter (8,11) = "0111000000110000"
 letter (8,12) = " 0111000000110000 "
 letter (8,13) =" 0110000000111000 "
 letter (8,14) =" 0110000000110000 "
  Letter (8,15) = "0110000000110000"
 letter (8,16) = "0111000001110000"
 letter (8,17) = " 0011111111110000 "
 letter (8,18) =" 0001111111000000 "
 letter (8,19) =" 0000000000000000 "

' To display the character ' 9 '
Letter (9,0) = "0000000000000000"
Letter (9,1) = "0001111111000000"
Letter (9,2) = "0011111111100000"
Letter (9,3) = "0111000011100000"
Letter (9,4) = "0111000001110000"
Letter (9,5) = "0110000000110000"
Letter (9,6) = "0110000000110000"
Letter (9,7) = "0110000000110000"
Letter (9,8) = "0110000000110000"
Letter (9,9) = "0111000001110000"
Letter (9,10) = "0011111111110000"
Letter (9,11) = "0001111111110000"
Letter (9,12) = "0000000001100000"
Letter (9,13) = "0000000001100000"
Letter (9,14) = "0000000011100000"
Letter (9,15) = "0000000111000000"
Letter (9,16) = "0000001110000000"
Letter (9,17) = "0000011100000000"
Letter (9,18) = "0001111000000000"
Letter (9,19) = "0000000000000000"


' 24-bit figure
' Output image file header
' Response.BinaryWrite ChrB & ChrB (a) & ChrB (a) & ChrB (M) & ChrB (0) & ChrB (0) & ChrB (0) ; ChrB (0) & ChrB (0) & ChrB (0) & ChrB (+) & ChrB (0) & ChrB (0) & ChrB (0)
' Output image information header
' Response.BinaryWrite ChrB & ChrB (0) & ChrB (0) & ChrB (0) & ChrB ($) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (a) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (1) & ChrB (0) &CHRB (a) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (M) & ChrB (0) & ChrB (0) & CHR B & ChrB (one) & ChrB (0) & ChrB (0) & ChrB (a) & ChrB (one) & ChrB (0) & ChrB (0) & ChrB (0) & Amp ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0)
' Output image data
' For itemp1=19 to 0 step-1 ' each row
' For Itemp2=1 to Len (safecode) ' every word
' For Itemp3=1 to 16 ' per pixel
' Response.BinaryWrite Vcolordata (Mid (safecode,itemp2,1), ITEMP1), itemp3,1)
' Next
' Next
' Next

' Show a 8-bit grayscale image
' Output image file header
Response.BinaryWrite ChrB & ChrB (a) & ChrB (a) & ChrB (9) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (+) & ChrB (4) & ChrB (0) & ChrB (0)
' Output image information header
Response.BinaryWrite ChrB (+) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB ($) & ChrB (0) & ChrB (0) & C HRB (0) & ChrB (a) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (1) & ChrB (0) &CHRB (8) & ChrB (0) &am P ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (5) & ChrB (0) & ChrB (0) & ChrB (18) & Amp CHRB & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (one) & ChrB (0) & ChrB () & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0)
' Output Image palette
For i = 0 to 255
Response.BinaryWrite ChrB (255-i) & ChrB (255-i) & ChrB (255-i) & ChrB (0)
Next
' Output image data
For each row of the itemp1=19 to 0 step-1 ' image
For Itemp2=1 to 4 ' images on display on every word
For itemp3=1 to 16 ' every pixel of each word
' Get Safecode itemp2 characters, save in Safecodeper
Safecodeper=mid (safecode,itemp2,1)
' Find the safecodeper corresponding array from the character data letter array, for example, 1 corresponding array of letters (1,0) to A (1,19), itemp specify the specific line
Safecodeletter=letter (SAFECODEPER,ITEMP1)
' Get pixel value

' Instead of code
' Add clutter pixels to the picture.
Pixel=mid (safecodeletter,itemp3,1) *255
If Rnd*99+1<5 then ' 5 is the probability of randomly generated clutter, you can modify
Response.BinaryWrite CHRB (128) ' The color of the noise is 128.
Else
Response.BinaryWrite ChrB (Pixel)
End If
' Instead of ending

Next
Next
Next
End Sub
%>

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.