信安Word格式文档下载.docx
《信安Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《信安Word格式文档下载.docx(19页珍藏版)》请在冰豆网上搜索。
--#includefile="
Connections/con1.asp"
-->
md5.asp"
%
'
***Validaterequesttologintothissite.
MM_LoginAction=Request.ServerVariables("
URL"
)
IfRequest.QueryString<
>
"
"
ThenMM_LoginAction=MM_LoginAction+"
?
+Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("
textfield"
))
IfMM_valUsername<
Then
DimMM_fldUserAuthorization
DimMM_redirectLoginSuccess
DimMM_redirectLoginFailed
DimMM_loginSQL
DimMM_rsUser
DimMM_rsUser_cmd
MM_fldUserAuthorization="
MM_redirectLoginSuccess="
logok.asp"
MM_redirectLoginFailed="
logf.asp"
MM_loginSQL="
SELECTuname,password"
IfMM_fldUserAuthorization<
ThenMM_loginSQL=MM_loginSQL&
"
&
MM_fldUserAuthorization
MM_loginSQL=MM_loginSQL&
FROM[user]WHEREuname=?
ANDpassword=?
SetMM_rsUser_cmd=Server.CreateObject("
ADODB.Command"
MM_rsUser_cmd.ActiveConnection=MM_con1_STRING
MM_rsUser_cmd.CommandText=MM_loginSQL
MM_rsUser_cmd.Parameters.AppendMM_rsUser_cmd.CreateParameter("
param1"
200,1,50,MM_valUsername)'
adVarChar
param2"
200,1,50,MD5(Request.Form("
textfield2"
)))'
MM_rsUser_cmd.Prepared=true
SetMM_rsUser=MM_rsUser_cmd.Execute
IfNotMM_rsUser.EOFOrNotMM_rsUser.BOFThen
'
usernameandpasswordmatch-thisisavaliduser
Session("
MM_Username"
)=MM_valUsername
If(MM_fldUserAuthorization<
)Then
MM_UserAuthorization"
)=CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
)="
EndIf
ifCStr(Request.QueryString("
accessdenied"
))<
AndfalseThen
MM_redirectLoginSuccess=Request.QueryString("
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
Response.Redirect(MM_redirectLoginFailed)
EndIf
DOCTYPEhtmlPUBLIC"
-//W3C//DTDXHTML1.0Transitional//EN"
http:
//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
htmlxmlns="
//www.w3.org/1999/xhtml"
head>
metahttp-equiv="
Content-Type"
content="
text/html;
charset=utf-8"
/>
title>
无标题文档<
/title>
/head>
body>
formid="
form1"
name="
method="
POST"
action="
%=MM_LoginAction%>
<
tablewidth="
287"
border="
1"
tr>
tdwidth="
81"
用户名:
/td>
190"
labelfor="
/label>
inputtype="
text"
id="
/tr>
td>
密码:
tdcolspan="
2"
278"
119"
align="
center"
submit"
button"
value="
登录"
142"
button2"
重置"
/table>
/form>
/body>
/html>
二、Md5
PrivateConstBITS_TO_A_BYTE=8
PrivateConstBYTES_TO_A_WORD=4
PrivateConstBITS_TO_A_WORD=32
Privatem_lOnBits(30)
Privatem_l2Power(30)
PrivateFunctionLShift(lValue,iShiftBits)
IfiShiftBits=0Then
LShift=lValue
ExitFunction
ElseIfiShiftBits=31Then
IflValueAnd1Then
LShift=&
H80000000
LShift=0
ElseIfiShiftBits<
0OriShiftBits>
31Then
Err.Raise6
If(lValueAndm_l2Power(31-iShiftBits))Then
LShift=((lValueAndm_lOnBits(31-(iShiftBits+1)))*m_l2Power(iShiftBits))Or&
LShift=((lValueAndm_lOnBits(31-iShiftBits))*m_l2Power(iShiftBits))
EndFunction
PrivateFunctionRShift(lValue,iShiftBits)
RShift=lValue
IflValueAnd&
H80000000Then
RShift=1
RShift=0
RShift=(lValueAnd&
H7FFFFFFE)\m_l2Power(iShiftBits)
If(lValueAnd&
H80000000)Then
RShift=(RShiftOr(&
H40000000\m_l2Power(iShiftBits-1)))
PrivateFunctionRotateLeft(lValue,iShiftBits)
RotateLeft=LShift(lValue,iShiftBits)OrRShift(lValue,(32-iShiftBits))
PrivateFunctionAddUnsigned(lX,lY)
DimlX4
DimlY4
DimlX8
DimlY8
DimlResult
lX8=lXAnd&
lY8=lYAnd&
lX4=lXAnd&
H40000000
lY4=lYAnd&
lResult=(lXAnd&
H3FFFFFFF)+(lYAnd&
H3FFFFFFF)
IflX4AndlY4Then
lResult=lResultXor&
H80000000XorlX8XorlY8
ElseIflX4OrlY4Then
IflResultAnd&
H40000000Then
HC0000000XorlX8XorlY8
H40000000XorlX8XorlY8
lResult=lResultXorlX8XorlY8
AddUnsigned=lResult
PrivateFunctionmd5_F(x,y,z)
md5_F=(xAndy)Or((Notx)Andz)
PrivateFunctionmd5_G(x,y,z)
md5_G=(xAndz)Or(yAnd(Notz))
PrivateFunctionmd5_H(x,y,z)
md5_H=(xXoryXorz)
PrivateFunctionmd5_I(x,y,z)
md5_I=(yXor(xOr(Notz)))
PrivateSubmd5_FF(a,b,c,d,x,s,ac)
a=AddUnsigned(a,AddUnsigned(AddUnsigned(md5_F(b,c,d),x),ac))
a=RotateLeft(a,s)
a=AddUnsigned(a,b)
EndSub
PrivateSubmd5_GG(a,b,c,d,x,s,ac)
a=AddUnsigned(a,AddUnsigned(AddUnsigned(md5_G(b,c,d),x),ac))
PrivateSubmd5_HH(a,b,c,d,x,s,ac)
a=AddUnsigned(a,AddUnsigned(AddUnsigned(md5_H(b,c,d),x),ac))
PrivateSubmd5_II(a,b,c,d,x,s,ac)
a=AddUnsigned(a,AddUnsigned(AddUnsigned(md5_I(b,c,d),x),ac))
PrivateFunctionConvertToWordArray(sMessage)
DimlMessageLength
DimlNumberOfWords
DimlWordArray()
DimlBytePosition
DimlByteCount
DimlWordCount
ConstMODULUS_BITS=512
ConstCONGRUENT_BITS=448
lMessageLength=Len(sMessage)
lNumberOfWords=(((lMessageLength+((MODULUS_BITS-CONGRUENT_BITS)\BITS_TO_A_BYTE))\(MODULUS_BITS\BITS_TO_A_BYTE))+1)*(MODULUS_BITS\BITS_TO_A_WORD)
ReDimlWordArray(lNumberOfWords-1)
lBytePosition=0
lByteCount=0
DoUntillByteCount>
=lMessageLength
lWordCount=lByteCount\BYTES_TO_A_WORD
lBytePosition=(lByteCountModBYTES_TO_A_WORD)*BITS_TO_A_BYTE
lWordArray(lWordCount)=lWordArray(lWordCount)OrLShift(Asc(Mid(sMessage,lByteCount+1,1)),lBytePosition)
lByteCount=lByteCount+1
Loop
lWordArray(lWordCount)=lWordArray(lWordCount)OrLShift(&
H80,lBytePosition)
lWordArray(lNumberOfWords-2)=LShift(lMessageLength,3)
lWordArray(lNumberOfWords-1)=RShift(lMessageLength,29)
ConvertToWordArray=lWordArray
PrivateFunctionWordToHex(lValue)
DimlByte
DimlCount
ForlCount=0To3
lByte=RShift(lValue,lCount*BITS_TO_A_BYTE)Andm_lOnBits(BITS_TO_A_BYTE-1)
WordToHex=WordToHex&
Right("
0"
Hex(lByte),2)
Next
PublicFunctionMD5(sMessage)
m_lOnBits(0)=CLng
(1)
m_lOnBits
(1)=CLng(3)
m_lOnBits
(2)=CLng(7)
m_lOnBits(3)=CLng(15)
m_lOnBits(4)=CLng(31)
m_lOnBits(5)=CLng(63)
m_lOnBits(6)=CLng(127)
m_lOnBits(7)=CLng(255)
m_lOnBits(8)=CLng(511)
m_lOnBits(9)=CLng(1023)
m_lOnBits(10)=CLng(2047)
m_lOnBits(11)=CLng(4095)
m_lOnBits(12)=CLng(8191)
m_lOnBits(13)=CLng(16383)
m_lOnBits(14)=CLng(32767)
m_lOnBits(15)=CLng(65535)
m_lOnBits(16)=CLng(131071)
m_lOnBits(17)=CLng(262143)
m_lOnBits(18)=CLng(524287)
m_lOnBits(19)=CLng(1048575)
m_lOnBits(20)=CLng(2097151)
m_lOnBits(21)=CLng(4194303)
m_lOnBits(22)=CLng(8388607)
m_lOnBits(23)=CLng(16777215)
m_lOnBits(24)=CLng(33554431)
m_lOnBits(25)=CLng(67108863)
m_lOnBits(26)=CLng(134217727)
m_lOnBits(27)=CLng(268435455)
m_lOnBits(28)=CLng(536870911)
m_lOnBits(29)=CLng(1073741823)
m_lOnBits(30)=CLng(2147483647)
m_l2Power(0)=CLng
(1)
m_l2Power
(1)=CLng
(2)
m_l2Power
(2)=CLng(4)
m_l2Power(3)=CLng(8)
m_l2Power(4)=CLng(16)
m_l2Power(5)=CLng(32)
m_l2Power(6)=CLng(64)
m_l2Power(7)=CLng(128)
m_l2Power(8)=CLng(256)
m_l2Power(9)=CLng(512)
m_l2Power(10)=CLng(1024)
m_l2Power(11)=CLng(2048)
m_l2Power(12)=CLng(4096)
m_l2Power(13)=CLng(8192)
m_l2Power(14)=CLng(16384)
m_l2Power(15)=CLng(32768)
m_l2Power(16)=CLng(65536)
m_l2Power(17)=CLng(131072)
m_l2Power(18)=CLng(262144)
m_l2Power(19)=CLng(524288)
m_l2Power(20)=CLng(1048576)
m_l2Power(21)=CLng(2097152)
m_l2Power(22)=CLng(4194304)
m_l2Power(23)=CLng(8388608)
m_l2Power(24)=CLng(16777216)
m_l2Power(25)=CLng(33554432)
m_l2Power(26)=CLng(67108864)
m_l2Power(27)=CLng(134217728)
m_l2Power(28)=CLng(268435456)
m_l2Power(29)=CLng(536870912)
m_l2Power(30)=CLng(1073741824)
Dimx
Dimk
DimAA
DimBB
DimCC
DimDD
Dima
Dimb
Dimc
Dimd
ConstS11=7
ConstS12=12
ConstS13=17
ConstS14=22
Co