⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 验证码的程序及原理.htm

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 HTM
📖 第 1 页 / 共 2 页
字号:
              = HexConv(Left(strRawKey, InStr(strRawKey, "|") - 1)) - 
              HexConv(intOffSet)<BR>strHexCrypData = Left(strCryptString, 
              Len(strCryptString) - (Len(strRawKey) + 
              1))<BR><BR><BR>arHexCharSet = Split(strHexCrypData, 
              Hex(intKey))<BR><BR>For i=0 to UBound(arHexCharSet)<BR>strRAW = 
              strRAW &amp; 
              Chr(HexConv(arHexCharSet(i))/intKey)<BR>Next<BR><BR>DeCryptString 
              = strRAW<BR>End Function<BR><BR><BR><BR>Private Function 
              HexConv(hexVar)<BR>Dim hxx, hxx_var, multiply <BR>IF hexVar 
              &lt;&gt; "" THEN<BR>hexVar = UCASE(hexVar)<BR>hexVar = 
              StrReverse(hexVar)<BR>DIM hx()<BR>REDIM hx(LEN(hexVar))<BR>hxx = 
              0<BR>hxx_var = 0<BR>FOR hxx = 1 TO LEN(hexVar)<BR>IF multiply = "" 
              THEN multiply = 1<BR>hx(hxx) = mid(hexVar,hxx,1)<BR>hxx_var = 
              (get_hxno(hx(hxx)) * multiply) + hxx_var<BR>multiply = (multiply * 
              16)<BR>NEXT<BR>hexVar = hxx_var<BR>HexConv = hexVar<BR>END 
              IF<BR>End Function<BR><BR>Private Function get_hxno(ghx)<BR>If ghx 
              = "A" Then<BR>ghx = 10<BR>ElseIf ghx = "B" Then<BR>ghx = 
              11<BR>ElseIf ghx = "C" Then<BR>ghx = 12<BR>ElseIf ghx = "D" 
              Then<BR>ghx = 13<BR>ElseIf ghx = "E" Then<BR>ghx = 14<BR>ElseIf 
              ghx = "F" Then<BR>ghx = 15<BR>End If<BR>get_hxno = ghx<BR>End 
              Function<BR><BR><BR>%&gt;</P>
              <P><BR>&lt;%<BR>randomize<BR>num = int(7999*rnd+2000) 
              '计数器的值<BR>num2 = 
              EncryptString(num)<BR>session("pwdt")=num<BR>%&gt;<BR>&lt;form 
              action="chk.asp" method=post&gt;<BR>请输入验证码: &lt;input type="text" 
              name="pwds"&gt;<BR>&lt;img 
              src="count.asp?sksid=&lt;%=num2%&gt;"&gt; &lt;input type=submit 
              value=提交&gt;<BR>&lt;/form&gt;</P>
              <P><BR>chk.asp<BR>&lt;%<BR>if 
              trim(request.form("pwds"))&lt;&gt;trim(session("pwdt")) 
              then<BR>%&gt;<BR>输入错误: 
              应该为:&lt;%=session("pwdt")%&gt;,可你输入的是:&lt;%=request.form("pwds")%&gt;<BR>&lt;%<BR>else<BR>%&gt;<BR>输入正确<BR>&lt;%end 
              if%&gt;</P>
              <P>count.asp</P>
              <P>&lt;!--#include file="num.asp"--&gt;</P>
              <P>&lt;%<BR>'### To encrypt/decrypt include this code in your page 
              <BR>'### strMyEncryptedString = EncryptString(strString)<BR>'### 
              strMyDecryptedString = DeCryptString(strMyEncryptedString)<BR>'### 
              You are free to use this code as long as credits remain in 
              place<BR>'### also if you improve this code let me 
              know.<BR><BR>Private Function 
              EncryptString(strString)<BR>'####################################################################<BR>'### 
              Crypt Function (C) 2001 by Slavic Kozyuk grindkore@yahoo.com 
              ###<BR>'### Arguments: strString &lt;--- String you wish to 
              encrypt ###<BR>'### Output: Encrypted HEX string 
              ###<BR>'####################################################################<BR><BR>Dim 
              CharHexSet, intStringLen, strTemp, strRAW, i, intKey, 
              intOffSet<BR>Randomize Timer<BR><BR>intKey = Round((RND * 1000000) 
              + 1000000) '##### Key Bitsize<BR>intOffSet = Round((RND * 1000000) 
              + 1000000) '##### KeyOffSet Bitsize<BR><BR>If IsNull(strString) = 
              False Then<BR>strRAW = strString<BR>intStringLen = 
              Len(strRAW)<BR><BR>For i = 0 to intStringLen - 1<BR>strTemp = 
              Left(strRAW, 1)<BR>strRAW = Right(strRAW, Len(strRAW) - 
              1)<BR>CharHexSet = CharHexSet &amp; Hex(Asc(strTemp) * 
              intKey)&amp; Hex(intKey)<BR>Next<BR><BR>EncryptString = CharHexSet 
              &amp; "|" &amp; Hex(intOffSet + intKey) &amp; "|" &amp; 
              Hex(intOffSet)<BR>Else<BR>EncryptString = ""<BR>End If<BR>End 
              Function<BR><BR><BR><BR><BR>Private Function 
              DeCryptString(strCryptString)<BR>'####################################################################<BR>'### 
              Crypt Function (C) 2001 by Slavic Kozyuk grindkore@yahoo.com 
              ###<BR>'### Arguments: Encrypted HEX stringt ###<BR>'### Output: 
              Decrypted ASCII string 
              ###<BR>'####################################################################<BR>'### 
              Note this function uses HexConv() and get_hxno() functions 
              ###<BR>'### so make sure they are not removed 
              ###<BR>'####################################################################<BR><BR>Dim 
              strRAW, arHexCharSet, i, intKey, intOffSet, strRawKey, 
              strHexCrypData<BR><BR><BR>strRawKey = Right(strCryptString, 
              Len(strCryptString) - InStr(strCryptString, "|"))<BR>intOffSet = 
              Right(strRawKey, Len(strRawKey) - InStr(strRawKey,"|"))<BR>intKey 
              = HexConv(Left(strRawKey, InStr(strRawKey, "|") - 1)) - 
              HexConv(intOffSet)<BR>strHexCrypData = Left(strCryptString, 
              Len(strCryptString) - (Len(strRawKey) + 
              1))<BR><BR><BR>arHexCharSet = Split(strHexCrypData, 
              Hex(intKey))<BR><BR>For i=0 to UBound(arHexCharSet)<BR>strRAW = 
              strRAW &amp; 
              Chr(HexConv(arHexCharSet(i))/intKey)<BR>Next<BR><BR>DeCryptString 
              = strRAW<BR>End Function<BR><BR><BR><BR>Private Function 
              HexConv(hexVar)<BR>Dim hxx, hxx_var, multiply <BR>IF hexVar 
              &lt;&gt; "" THEN<BR>hexVar = UCASE(hexVar)<BR>hexVar = 
              StrReverse(hexVar)<BR>DIM hx()<BR>REDIM hx(LEN(hexVar))<BR>hxx = 
              0<BR>hxx_var = 0<BR>FOR hxx = 1 TO LEN(hexVar)<BR>IF multiply = "" 
              THEN multiply = 1<BR>hx(hxx) = mid(hexVar,hxx,1)<BR>hxx_var = 
              (get_hxno(hx(hxx)) * multiply) + hxx_var<BR>multiply = (multiply * 
              16)<BR>NEXT<BR>hexVar = hxx_var<BR>HexConv = hexVar<BR>END 
              IF<BR>End Function<BR><BR>Private Function get_hxno(ghx)<BR>If ghx 
              = "A" Then<BR>ghx = 10<BR>ElseIf ghx = "B" Then<BR>ghx = 
              11<BR>ElseIf ghx = "C" Then<BR>ghx = 12<BR>ElseIf ghx = "D" 
              Then<BR>ghx = 13<BR>ElseIf ghx = "E" Then<BR>ghx = 14<BR>ElseIf 
              ghx = "F" Then<BR>ghx = 15<BR>End If<BR>get_hxno = ghx<BR>End 
              Function<BR><BR><BR>%&gt;</P>
              <P><BR>&lt;%<BR>Dim Image<BR>Dim Width, Height<BR>Dim num<BR>Dim 
              digtal<BR>Dim Length<BR>Dim sort<BR>Length = 4 '自定计数器长度</P>
              <P>Redim sort( Length )</P>
              <P>num=cint(DeCryptString(request.querystring("sksid")))<BR>digital 
              = ""<BR>For I = 1 To Length -Len( num ) '补0<BR>digital = digital 
              &amp; "0"<BR>Next<BR>For I = 1 To Len( num )<BR>digital = digital 
              &amp; Mid( num, I, 1 )<BR>Next<BR>For I = 1 To Len( digital 
              )<BR>sort(I) = Mid( digital, I, 1 )<BR>Next<BR>Width = 8 * Len( 
              digital ) '图像的宽度<BR>Height = 10 '图像的高度,在本例中为固定值</P>
              <P><BR>Response.ContentType="image/x-xbitmap"</P>
              <P>hc=chr(13) &amp; chr(10) </P>
              <P>Image = "#define counter_width " &amp; Width &amp; hc<BR>Image 
              = Image &amp; "#define counter_height " &amp; Height &amp; 
              hc<BR>Image = Image &amp; "static unsigned char counter_bits[]={" 
              &amp; hc</P>
              <P>For I = 1 To Height<BR>For J = 1 To Length<BR>Image = Image 
              &amp; a(sort(J),I) &amp; ","<BR>Next<BR>Next</P>
              <P>Image = Left( Image, Len( Image ) - 1 ) '去掉最后一个逗号<BR>Image = 
              Image &amp; "};" &amp; hc<BR>%&gt;<BR>&lt;%<BR>Response.Write 
              Image</P>
              <P>%&gt;</P>
              <P>num.asp</P>
              <P>&lt;%<BR>Dim a(10,10)</P>
              <P>a(0,1) = "0x3c" '数字0<BR>a(0,2) = "0x66"<BR>a(0,3) = 
              "0xc3"<BR>a(0,4) = "0xc3"<BR>a(0,5) = "0xc3"<BR>a(0,6) = 
              "0xc3"<BR>a(0,7) = "0xc3"<BR>a(0,8) = "0xc3"<BR>a(0,9) = 
              "0x66"<BR>a(0,10)= "0x3c"</P>
              <P>a(1,1) = "0x18" '数字1<BR>a(1,2) = "0x1c"<BR>a(1,3) = 
              "0x18"<BR>a(1,4) = "0x18"<BR>a(1,5) = "0x18"<BR>a(1,6) = 
              "0x18"<BR>a(1,7) = "0x18"<BR>a(1,8) = "0x18"<BR>a(1,9) = 
              "0x18"<BR>a(0,10)= "0x7e"</P>
              <P><BR>a(2,1) = "0x3c" '数字2<BR>a(2,2) = "0x66"<BR>a(2,3) = 
              "0x60"<BR>a(2,4) = "0x60"<BR>a(2,5) = "0x30"<BR>a(2,6) = 
              "0x18"<BR>a(2,7) = "0x0c"<BR>a(2,8) = "0x06"<BR>a(2,9) = 
              "0x06"<BR>a(2,10)= "0x7e"</P>
              <P>a(3,1) = "0x3c" '数字3<BR>a(3,2) = "0x66"<BR>a(3,3) = 
              "0xc0"<BR>a(3,4) = "0x60"<BR>a(3,5) = "0x1c"<BR>a(3,6) = 
              "0x60"<BR>a(3,7) = "0xc0"<BR>a(3,8) = "0xc0"<BR>a(3,9) = 
              "0x66"<BR>a(3,10)= "0x38"</P>
              <P>a(4,1) = "0x38" '数字4<BR>a(4,2) = "0x3c"<BR>a(4,3) = 
              "0x36"<BR>a(4,4) = "0x33"<BR>a(4,5) = "0x33"<BR>a(4,6) = 
              "0x33"<BR>a(4,7) = "0xff"<BR>a(4,8) = "0x30"<BR>a(4,9) = 
              "0x30"<BR>a(4,10)= "0xfe"</P>
              <P>a(5,1) = "0xfe" '数字5<BR>a(5,2) = "0xfe"<BR>a(5,3) = 
              "0x06"<BR>a(5,4) = "0x06"<BR>a(5,5) = "0x3e"<BR>a(5,6) = 
              "0x60"<BR>a(5,7) = "0xc0"<BR>a(5,8) = "0xc3"<BR>a(5,9) = 
              "0x66"<BR>a(5,10)= "0x3c"</P>
              <P>a(6,1) = "0x60" '数字6<BR>a(6,2) = "0x30"<BR>a(6,3) = 
              "0x18"<BR>a(6,4) = "0x0c"<BR>a(6,5) = "0x3e"<BR>a(6,6) = 
              "0x63"<BR>a(6,7) = "0xc3"<BR>a(6,8) = "0xc3"<BR>a(6,9) = 
              "0x66"<BR>a(6,10) ="0x3c"</P>
              <P>a(7,1) = "0xff" '数字7<BR>a(7,2) = "0xc0"<BR>a(7,3) = 
              "0x60"<BR>a(7,4) = "0x30"<BR>a(7,5) = "0x18"<BR>a(7,6) = 
              "0x18"<BR>a(7,7) = "0x18"<BR>a(7,8) = "0x18"<BR>a(7,9) = 
              "0x18"<BR>a(7,10)= "0x18"</P>
              <P>a(8,1) = "0x3c" '数字8<BR>a(8,2) = "0x66"<BR>a(8,3) = 
              "0xc3"<BR>a(8,4) = "0x66"<BR>a(8,5) = "0x3c"<BR>a(8,6) = 
              "0x66"<BR>a(8,7) = "0xc3"<BR>a(8,8) = "0xc3"<BR>a(8,9) = 
              "0x66"<BR>a(8,10)= "0x3c"</P>
              <P>a(9,1) = "0x3c" '数字9<BR>a(9,2) = "0x66"<BR>a(9,3) = 
              "0xc3"<BR>a(9,4) = "0xc3"<BR>a(9,5) = "0x66"<BR>a(9,6) = 
              "0x3c"<BR>a(9,7) = "0x18"<BR>a(9,8) = "0x0c"<BR>a(9,9) = 
              "0x06"<BR>a(9,10)= "0x03"</P>
              <P>%&gt;<BR><BR><BR></P></BLOCKQUOTE></TD></TR>
        <TR>
          <TD class=p4 vAlign=top width="50%">
            <BLOCKQUOTE>原作者:扬子<BR>来 源:开发者俱乐部<BR>共有4224位读者阅读过此文<BR>【<A 
              href="http://bbs.aspsky.net/list.asp?boardid=1">发表评论</A>】 
            </BLOCKQUOTE></TD>
          <TD class=p4 vAlign=top width="50%">
            <P>
            <LI><FONT color=#0772b1>上篇文章</FONT>:<A 
            href="http://www.aspsky.net/article/list.asp?id=2795">在线实时开通WEB及FTP源程序</A> 
            <BR>
            <LI><FONT color=#0772b1>下篇文章</FONT>:<A 
            href="http://www.aspsky.net/article/list.asp?id=2797">NextRecordset 
            和 GetRows 双簧合奏</A> </LI></TD></TR>
        <TR>
          <TD bgColor=#297dff class=p4 height=20 width="50%"><FONT 
            color=#ceffff>&nbsp;→ 本周热门</FONT></TD>
          <TD bgColor=#297dff class=p4 width="50%"><FONT color=#ceffff>&nbsp;→ 
            相关文章</FONT></TD></TR>
        <TR>
          <TD bgColor=#586011 colSpan=2 height=1><SPACER type="block" 
            width="1"></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR>
        <TR>
          <TD class=p4 vAlign=top width="50%">
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1510" 
            target=_top title="SQL Server 7.0 入门(一)">SQL Server 7.0 
            入门(...</A>[<FONT color=red>7238</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1540" 
            target=_top title=PHP4实际应用经验篇(1)>PHP4实际应用经验篇(1)</A>[<FONT 
            color=red>7135</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1536" 
            target=_top 
            title=无组件文件上传代码实例(支持多文件上传及文件和input域混合上传)>无组件文件上传代码实例(支持多文件上...</A>[<FONT 
            color=red>6029</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2557" 
            target=_top title=树型结构在ASP中的简单解决>树型结构在ASP中的简单解决</A>[<FONT 
            color=red>5757</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1545" 
            target=_top title=PHP4实际应用经验篇(6)>PHP4实际应用经验篇(6)</A>[<FONT 
            color=red>5599</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2563" 
            target=_top title=一个老个写的无组件上传>一个老个写的无组件上传</A>[<FONT 
            color=red>5013</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1542" 
            target=_top title=PHP4实际应用经验篇(3)>PHP4实际应用经验篇(3)</A>[<FONT 
            color=red>4731</FONT>]<BR></LI></TD>
          <TD class=p4 vAlign=top width="50%">
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2796">验证码的程序及原理</A><BR></LI></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR></TBODY></TABLE>
    <TD bgColor=#297dff width=1> </TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD bgColor=#297dff height=1><SPACER type="block" 
width="1"></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD align=middle height=30></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD align=middle class=p2 width="100%">
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
        <TBODY>
        <TR>
          <TD align=middle class=p2 width="100%">
            <P align=center><A 
            href="http://www.aspsky.net/produce/index.asp">客户服务</A> -- <A 
            href="http://www.aspsky.net/aspads.asp">广告合作</A> -- <A 
            href="http://www.aspsky.net/about.asp">关于本站</A> -- <A 
            href="http://www.aspsky.net/tell.asp">联系方法</A><BR><BR>动网先锋版权所有 <FONT 
            face=Verdana, size=1 Arial, Helvetica, sans-serif>Copyright &copy; 
            2000-2001 <B>AspSky<FONT color=#cc0000>.Net</FONT></B>, All Rights 
            Reserved .</FONT> 
</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER></CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -