Verification code solution in ASP

zhaozj2021-02-16  87

A total of 4 pages: form.asp; chk.asp; num.asp; count.asp

Get an additional number. encryption!

Decoupted into XBM picture

Use session judgment

Form.asp

<%

'### TO Encrypt / Decrypt Include this Code in Your Page

'### strmyencryptedstring = encryptstring (strstring)

'### strmyDecryptedString = decryptstring (strmyencryptedstring)

'#### area free to use this code as long as credits recain 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, INTOFFSET

Randomize Timer

INTKEY = ROUND ((RND * 1000000) 1000000) '##### kY bitsize

INTOFFSET = ROUND ((RND * 1000000) 1000000) '##### Keyoffset Bitsize

IF isnull (strstring) = false kil

Strraw = strstring

INTSTRINGLEN = LEN (STRRAW)

For i = 0 to IntStringlen - 1

Strtemp = Left (Strraw, 1)

Strraw = Right (STRRAW, LEN (STRRAW) - 1)

Charhexset = Charhexset & HEX (ASC (Strtemp) * INTKEY) & HEX (intKey)

NEXT

Encryptstring = Charhexset & "| & HEX (INTOFFSET INTKEY) &" | "& HEX (INTOFFSET)

Else

Encryptstring = "" "

END IF

END 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 They area not removed ###

'######################################################## ###################

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

Strrawkey = Right (StrcryptString, Len (StrcryptString) - INSTR (StrcryptString, "|"))

INTOFFSET = Right (Strrawkey, Len (Strawkey) - 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 = Strraw

END FUNCTION

Private function hexconv ​​(HEXVAR)

DIM HXX, HXX_VAR, Multiply

IF Hexvar <> "" ""

HEXVAR = ucase (HEXVAR)

HEXVAR = Strreverse (HEXVAR)

DIM HX ()

Redim HX (Len (HEXVAR))

HXX = 0

HXX_VAR = 0

For hxx = 1 to len (HEXVAR)

If MULTIPLY = "" "Multiply = 1

HX (HXX) = MID (HEXVAR, HXX, 1)

HXX_VAR = (GET_HXNO (HX (HXX)) * Multiply) HXX_VAR

Multiply = (Multiply * 16)

NEXT

HEXVAR = HXX_VAR

HEXCONV = HEXVAR

END IF

END FUNCTION

Private function get_hxno (ghx)

IF ghx = "a" THEN

GHX = 10

Elseif ghx = "b" THEN

GHX = 11

Elseif ghx = "c" then

GHX = 12

Elseif GHX = "D" THEN

GHX = 13

Elseif GHX = "e" belove = 14

Elseif GHX = "f" THEN

GHX = 15

END IF

GET_HXNO = GHX

END FUNCTION

%>

<%

Randomize

Num = int (7999 * RND 2000) 'Counter value

Num2 = encryptstring (num)

Session ("PWDT") = NUM

%>

Please enter the verification code:

Chk.asp

<%

IF Trim (Request.form ("PWDS")) <> TRIM (Session ("PWDT")) THEN

%>

Enter an error: should be: <% = session ("PWDT")%>, but you can enter: <% = Request.form ("PWDS")%>

<%

Else

%>

Entered correctly

<% end if%>

Count.asp

<%

'### TO Encrypt / Decrypt Include this Code in Your Page

'### strmyencryptedstring = encryptstring (strstring)

'### strmyDecryptedString = decryptstring (strmyencryptedstring)

'#### area free to use this code as long as credits recain 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, INTOFFSET

Randomize Timer

INTKEY = ROUND ((RND * 1000000) 1000000) '##### kY bitsize

INTOFFSET = ROUND ((RND * 1000000) 1000000) '##### Keyoffset Bitsize

IF isnull (strstring) = false kil

Strraw = strstring

INTSTRINGLEN = LEN (STRRAW)

For i = 0 to IntStringlen - 1

Strtemp = Left (Strraw, 1)

Strraw = Right (STRRAW, LEN (STRRAW) - 1)

Charhexset = Charhexset & HEX (ASC (Strtemp) * INTKEY) & HEX (intKey)

NEXT

Encryptstring = Charhexset & "| & HEX (INTOFFSET INTKEY) &" | "& HEX (INTOFFSET)

Else

Encryptstring = "" "

END IF

END 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 They area not removed ###

'######################################################## ###################

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

Strrawkey = Right (StrcryptString, Len (StrcryptString) - INSTR (StrcryptString, "|"))

INTOFFSET = Right (Strrawkey, Len (Strawkey) - 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 = Strraw

END FUNCTION

Private function hexconv ​​(HEXVAR)

DIM HXX, HXX_VAR, Multiply

IF Hexvar <> "" ""

HEXVAR = ucase (HEXVAR)

HEXVAR = Strreverse (HEXVAR)

DIM HX ()

Redim HX (Len (HEXVAR))

HXX = 0

HXX_VAR = 0

For hxx = 1 to len (HEXVAR)

If MULTIPLY = "" "Multiply = 1

HX (HXX) = MID (HEXVAR, HXX, 1)

HXX_VAR = (GET_HXNO (HX (HXX)) * Multiply) HXX_VAR

Multiply = (Multiply * 16)

NEXT

HEXVAR = HXX_VAR

HEXCONV = HEXVAR

END IF

END FUNCTION

Private function get_hxno (ghx)

IF ghx = "a" THEN

GHX = 10

Elseif ghx = "b" THEN

GHX = 11

Elseif ghx = "c" then

GHX = 12

Elseif GHX = "D" THEN

GHX = 13

Elseif GHX = "e" then

GHX = 14

Elseif GHX = "f" THEN

GHX = 15

END IF

GET_HXNO = GHX

END FUNCTION

%>

<%

DIM image

Dim Width, Height

DIM NUM

DIM Digtal

DIM Length

DIM Sort

Length = 4 'Customary Counter Length

Redim Sort (Length)

Num = cint (decryptString (Request.QueryString ("SKSID")))))))))

Digital = ""

For i = 1 to length -len (num) 'supplement 0

Digital = DIGITAL & "0"

NEXT

For i = 1 to Len (NUM)

Digital = Digital & Mid (Num, I, 1)

NEXT

For i = 1 to Len (Digital)

Sort (i) = MID (Digital, i, 1)

NEXT

Width = 8 * len (digital) 'image width

Height = 10 'The height of the image, in this example is fixed value

Response.contentType = "image / x-xbitmap"

HC = CHR (13) & chr (10)

Image = "#define counter_width" & width & HC

Image = Image & "#define counter_height" & height & hc

Image = image & "static unsigned char all_bits [] = {" & hcfor i = 1 to Height

For J = 1 to Length

Image = image & a (sort (j), i) & ","

NEXT

NEXT

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" 'number 0

A (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 1

A (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 2

A (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" 'number 3

A (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 4

A (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 5

A (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 6

A (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 7

A (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 8

A (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, 8) = "0xc3"

A (8, 9) = "0x66"

A (8, 10) = "0x3c"

A (9, 1) = "0x3c" 'number 9

A (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-13291.html

New Post(0)