Program and principle of verification code

xiaoxiao2021-03-06  81

A total of 4 pages: form.asp; chk.asp; num.asp; count.asp Get an additional number. encryption! After decryption, it is used to use the session judgment.

Form.asp

<% '### To encrypt / decrypt include this code in your page' ### strMyEncryptedString = EncryptString (strString) '### strMyDecryptedString = DeCryptString (strMyEncryptedString)' ### You are free to use this code as long as Credits Remain in Place '### Also if you improve this code let me know.

Private function encryptstring (strstring) '####################################################################################################################################################################################################################################################################################### ################## ### Crypt Function (c) 2001 by Slavic Kozyuk Grindkore@yahoo.com ### '### Arguments: strstring <--- string you wish to encrypt ### '### output: Encrypted hex string ###' ############################################################################################################################################################################################################################################################### #############################################################

Dim Charhexset, IntStringlen, Strtemp, Strraw, I, INTKEY, INTOFFSETRANDOMIZE TIMER

INTKEY = ROUND ((RND * 1000000) 1000000) '##### Key BitsizeInToffset = Round ((RND * 1000000) 1000000)' #### kyoffset bitsize

IF isnull (strstring) = false trenstrraw = strstringintstringlen = LEN (STRRAW)

For i = 0 to INTSTRINGLEN - 1STRTEMP = Left (Strraw, 1) Strraw = Right (Strraw, Len (Straw) - 1) Charhexset = Charhexset & HEX (ASC (STRTEMP) * INTKEY) & HEX (intKey) NEXT

EncryptString = Charhexset & "|" & HEX (INTOFFSET INTKEY) & "| & HEX (INTOFFSET) ElseEncryptstring =" "End IFEND FUNCTION

Private function decryptstring (strcryptstring) '################################################################################################################################################################################################################################################################### ################## ### Crypt Function (c) 2001 by Slavic Kozyuk Grindkore@yahoo.com ### '### Arguments: Encrypted Hex Stringt ### '### Output: Decrypted ASCII String ###' ########################################################################################################################################################################################################################################################## ################################ ### Note this function uses hexconv ​​() And get_hxno () functions ### '### so make Sure the isy not removed ###' ##################################################################################################################################################################################################################################################################### ################################## DIM STRRAW, Arhexcharset, I, intKey, INTOFFSET, STRRAWKEY, STRHEXCRYPDATA

strRawKey = Right (strCryptString, Len (strCryptString) - InStr (strCryptString, "|")) intOffSet = Right (strRawKey, Len (strRawKey) - InStr (strRawKey, "|")) intKey = HexConv (Left (strRawKey, InStr ( Strrawkey, "|") - 1)) - HEXCONV (INTOFFSET) strhexcrypdata = left (strcryptstring) - (Len (Strrawkey) 1))

Arhexcharset = split (strhexcrypdata, hex (intKey))

For i = 0 to ubound (arhexcharset) strraw = strraw & chr (HEXCONV (Arhexcharset (i)) / intKey) Next

Decryptstring = STRRRAWEND FUNCTION

Private Function HexConv (hexVar) Dim hxx, hxx_var, multiply IF hexVar <> "" THENhexVar = UCASE (hexVar) hexVar = StrReverse (hexVar) DIM hx () REDIM hx (LEN (hexVar)) hxx = 0hxx_var = 0FOR hxx = 1 TO LEN (hexVar) IF multiply = "" THEN multiply = 1hx (hxx) = mid (hexVar, hxx, 1) hxx_var = (get_hxno (hx (hxx)) * multiply) hxx_varmultiply = (multiply * 16) NEXThexVar = hxx_varHexConv = Hexvarend IFEND FUNCTION

Private function get_hxno (ghx) if ghx = "a" lifeX = 10ELSEIF GHX = "b" lifehx = 11ELSEIF GHX = "c" belseif ghx = "c" belse = 12ELSEIF GHX = "d" lifeHX = 14ELSEIF GHX = "= 14ELSEIF GHX =" F "lifeHX = 15nd ifget_hxno = ghxend function%>

<% randomizenum = int (7999 * RND 2000) 'counter Num2 = EncryptString (NUM) Session ("PWDT") = Num%>

Please enter the verification code: Trim (Session ("PWDT")) THEN%> Enter error: should be: <% = session ("pwdt")%>, You entered: <% = Request.form ("PWDS")%> <% else%> Enter correct <% end if%>

Count.asp

<% '### To encrypt / decrypt include this code in your page' ### strMyEncryptedString = EncryptString (strString) '### strMyDecryptedString = DeCryptString (strMyEncryptedString)' ### You are free to use this code as long as Credits Remain in Place '### Also if you improve this code let me know.

Private function encryptstring (strstring) '####################################################################################################################################################################################################################################################################################### ################## ### Crypt Function (c) 2001 by Slavic Kozyuk Grindkore@yahoo.com ### '### Arguments: strstring <--- string you wish to encrypt ### '### output: Encrypted hex string ###' ############################################################################################################################################################################################################################################################### #############################################################

Dim Charhexset, INTSTRINGLEN, STRTEMP, STRRRAW, I, INTKEY, INTOFFSETRANDOMIZE TIMERINTKEY = ROUND ((RND * 1000000) 1000000) '##### k = z zintoffset = Round ((RND * 1000000) 1000000)' #### # Keyoffset Bitsize

IF isnull (strstring) = false trenstrraw = strstringintstringlen = LEN (STRRAW)

For i = 0 to INTSTRINGLEN - 1STRTEMP = Left (Strraw, 1) Strraw = Right (Strraw, Len (Straw) - 1) Charhexset = Charhexset & HEX (ASC (STRTEMP) * INTKEY) & HEX (intKey) NEXT

EncryptString = Charhexset & "|" & HEX (INTOFFSET INTKEY) & "| & HEX (INTOFFSET) ElseEncryptstring =" "End IFEND FUNCTION

Private function decryptstring (strcryptstring) '################################################################################################################################################################################################################################################################### ################## ### Crypt Function (c) 2001 by Slavic Kozyuk Grindkore@yahoo.com ### '### Arguments: Encrypted Hex Stringt ### '### Output: Decrypted ASCII String ###' ########################################################################################################################################################################################################################################################## ################################ ### Note this function uses hexconv ​​() And get_hxno () functions ### '### so make Sure the isy not removed ###' ##################################################################################################################################################################################################################################################################### #############################################################################

Dim Strraw, Arhexcharset, I, Intkey, Intoffset, Strrawkey, StrHexcrypdata

strRawKey = Right (strCryptString, Len (strCryptString) - InStr (strCryptString, "|")) intOffSet = Right (strRawKey, Len (strRawKey) - InStr (strRawKey, "|")) intKey = HexConv (Left (strRawKey, InStr ( Strrawkey, "|") - 1)) - HEXCONV (INTOFFSET) strhexcrypdata = left (strcryptstring) - (Len (Strrawkey) 1))

Arhexcharset = split (strhexcrypdata, hex (intKey))

For i = 0 to Ubound (arhexcharset) strraw = strraw & chr (HEXCONV (ArhexCharset (i)) / intKey) NextDecryptString = STRRRAWEND FUNCTION

Private Function HexConv (hexVar) Dim hxx, hxx_var, multiply IF hexVar <> "" THENhexVar = UCASE (hexVar) hexVar = StrReverse (hexVar) DIM hx () REDIM hx (LEN (hexVar)) hxx = 0hxx_var = 0FOR hxx = 1 TO LEN (hexVar) IF multiply = "" THEN multiply = 1hx (hxx) = mid (hexVar, hxx, 1) hxx_var = (get_hxno (hx (hxx)) * multiply) hxx_varmultiply = (multiply * 16) NEXThexVar = hxx_varHexConv = Hexvarend IFEND FUNCTION

Private function get_hxno (ghx) if ghx = "a" lifeX = 10ELSEIF GHX = "b" lifehx = 11ELSEIF GHX = "c" belseif ghx = "c" belse = 12ELSEIF GHX = "d" lifeHX = 14ELSEIF GHX = "= 14ELSEIF GHX =" F "lifeHX = 15nd ifget_hxno = ghxend function

%>

<% DIM IMAGTIM WIDTH, Heightdim Numdim DigtAldim lengthdim Sortlength = 4 'Customary Counter Length

Redim Sort (Length)

Num = CINT (Request.QueryString ("SKSID")))) Digital = "" for i = 1 to length -len (num) '补 0digital = Digital & "0" Nextfor i = 1 to Len (NUM) Digital = Digital & Mid (Num, I, 1) Nextfor I = 1 to Len (Digital) Sort (i) = MID (Digital, I, 1) NextWidth = 8 * LEN (DIGITAL) 'Image of the width = 10' image The height, in this case for fixed value

Response.contentType = "image / x-xbitmap"

HC = CHR (13) & chr (10)

Image = "#define counter_width" & Width & hcImage = Image & "#define counter_height" "static unsigned char counter_bits [] = {" & hcFor I = 1 To HeightFor J = & Height & hcImage = Image & 1 To LengthImage = Image & a (sort (j), i) & "," NextNext

Image = left (image, len (image) - 1) 'Remove the last comma image = image & "};" & hc%> <% response.write image

%>

Num.asp

<% DIM A (10, 10)

A (0, 1) = "0x3c" 'Digital 0A (0, 2) = "0x66" A (0, 3) = "0xC3" A (0, 4) = "0xc3" A (0, 5) = " 0xC3 "A (0, 6) =" 0xc3 "A (0, 7) =" 0xC3 "A (0, 8) =" 0xC3 "A (0, 9) =" 0x66 "A (0, 10) =" 0x3c "

A (1, 1) = "0x18" 'Number 1A (1, 2) = "0x1c" A (1, 3) = "0x18" A (1, 4) = "0x18" A (1, 5) = " 0x18 "A (1,6) =" 0x18 "A (1, 7) =" 0x18 "A (1, 8) =" 0x18 "A (1, 9) =" 0x18 "A (0, 10) =" 0x7e "

A (2, 1) = "0x3c" 'Number 2A (2, 2) = "0x66" A (2, 3) = "0x60" A (2, 4) = "0x60" A (2, 5) = " 0x30 "A (2, 6) =" 0x18 "A (2, 7) =" 0x0C "a (2, 8) =" 0x06 "A (2, 9) =" 0x06 "A (2, 10) =" 0x7e "

A (3, 1) = "0x3c" 'Digital 3A (3, 2) = "0x66" A (3, 3) = "0xc0" A (3, 4) = "0x60" A (3, 5) = " 0x1c "a (3, 6) =" 0x60 "A (3, 7) =" 0xc0 "A (3, 8) =" 0xc0 "A (3, 9) =" 0x66 "A (3, 10) =" 0x38 "

A (4, 1) = "0x38" 'Number 4A (4, 2) = "0x3c" A (4, 3) = "0x36" A (4, 4) = "0x33" A (4, 5) = " 0x33 "A (4, 6) =" 0x33 "A (4, 7) =" 0xFF "A (4, 8) =" 0x30 "A (4, 9) =" 0x30 "A (4, 10) =" 0xfe "a (5, 1) =" 0xfe "'number 5a (5, 2) =" 0xfe "A (5, 3) =" 0x06 "A (5, 4) =" 0x06 "A (5, 5) = "0x3e" A (5, 6) = "0x60" A (5, 7) = "0xc0" A (5, 8) = "0xc3" A (5, 9) = "0x66" A (5, 10) = "0x3c"

A (6, 1) = "0x60" 'Number 6A (6, 2) = "0x30" A (6, 3) = "0x18" A (6, 4) = "0x0c" A (6, 5) = " 0x3e "a (6,6) =" 0x63 "A (6, 7) =" 0xc3 "A (6, 8) =" 0xC3 "A (6, 9) =" 0x66 "A (6, 10) =" 0x3c "

A (7, 1) = "0xFF" 'Number 7A (7, 2) = "0xc0" A (7, 3) = "0x60" A (7, 4) = "0x30" A (7, 5) = " 0x18 "A (7, 6) =" 0x18 "A (7, 7) =" 0x18 "A (7, 8) =" 0x18 "A (7, 9) =" 0x18 "A (7, 10) =" 0x18 "

A (8, 1) = "0x3c" 'Number 8A (8, 2) = "0x66" A (8, 3) = "0xC3" A (8, 4) = "0x66" A (8, 5) = " 0x3C "A (8, 6) =" 0x66 "A (8, 7) =" 0xc3 "A (8) =" 0xc3 "A (8, 9) =" 0x66 "A (8, 10) =" 0x3c "

A (9, 1) = "0x3c" 'Number 9A (9, 2) = "0x66" A (9, 3) = "0xc3" A (9, 4) = "0xc3" A (9, 5) = " 0x66 "A (9, 6) =" 0x3c "A (9, 7) =" 0x18 "A (9, 8) =" 0x0c "a (9, 9) =" 0x06 "A (9, 10) =" 0x03 "

%>

转载请注明原文地址:https://www.9cbs.com/read-122718.html

New Post(0)