文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>验证码的程序及原理_Asp.Net开发技巧

验证码的程序及原理_Asp.Net开发技巧

时间:2010-09-16  来源:缘分星空

一共4个页面:form.asp; chk.asp; num.asp; count.asp
得到一个随即数字。加密!
解密后成成XBM图片
利用session 判断

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 [email protected] ###
'### 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) '##### Key Bitsize
intOffSet = Round((RND * 1000000) + 1000000) '##### KeyOffSet Bitsize

If IsNull(strString) = False Then
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 [email protected] ###
'### Arguments: Encrypted HEX stringt ###
'### Output: Decrypted ASCII string ###
'####################################################################
'### Note this function uses HexConv() and get_hxno() functions ###
'### so make sure they are 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(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 <>"" THEN
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 = "" THEN 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


%>

[1] [2] [3] [4] 下一页


miles davisblue luggage lock90 day cruise specialshandbags brand nameteam leather jacketsyou mama so fat jokesabstract artistsdylan cole tutorialsouth beach collectionmarson klik rivetparenthood tv seriescelebrity solsticeannick goutal musc nomade perfumeholiday princess cruisesblack white fashionwomens coats and jacketsbiker jacketsvacation packages resortsfaux d&g handbagschicken wingsbobbin lace suppliescarillon beach vacation rentalsfabric handbags offerscheap luggage casesbrand handbags on salesaks bagcelio apartment vacation rentalpurse style lunch bagscruise scotlandamerican cruise dealsleather diary coverplastic model kitsgames for childrendesign pursesamerican tourister luggage warrantyxoxo handbags official websitebulletin board ideasmost popular hand bagsnorwegian cruise line spiritcheap real louis vuitton bagsoceania cruises shipcosta cruise careerstephen sprouse bagmonogrammed stationeryfriends episode guide wikicheap totesroyal carribean cruise linerversace jeansnorwegian cruise line ratingssterling silver purse

Replica lv Hangbags

Replica Hangbags

Hangbags

replica handbags

replica handbags

replica handbags

replica handbags

handbags

replica handbags replica handbags replica handbags replica handbags replica handbags

usb cable

usb cable

usb cable

usb cable

usb flash drives

usb flash drives

usb flash drives usb flash drives usb flash drives usb flash drives USB Connector USB Connector USB Connector USB Connector USB Connector USB Connector
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载