争怎路由网:是一个主要分享无线路由器安装设置经验的网站,汇总WiFi常见问题的解决方法。

ASP 验证码的程序及原理

时间:2024/6/17作者:未知来源:争怎路由网人气:

") - 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

%>

<%
randomize
num = int(7999*rnd+2000) '计数器的值
num2 = EncryptString(num)
session("pwdt")=num
%>
<form action="chk.asp" method=post>
请输入验证码: <input type="text" name="pwds">
<img src="count.asp?sksid=<%=num2%>"> <input type=submit value=提交>
</form>

chk.asp
<%
if trim(request.form("pwds"))<>trim(session("pwdt")) then
%>
输入错误: 应该为:<%=session("pwdt")%>,可你输入的是:<%=request.form("pwds")%>
<%
else
%>
输入正确
<%end if%>

count.asp
<!--#include file="num.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, 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 & "

关键词:ASP 验证码的程序及原理




Copyright © 2012-2018 争怎路由网(http://www.zhengzen.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版