亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

asp如何加密數據

九三
276
2021-02-20 13:29:33
欄目: 網絡安全

asp如何加密數據

在asp中使用MD5加密算法對數據進行加密,具體方法如下:

<%

Function hmac(data,key)

dim ipad,opad,k_ipad,k_opad,i

for i = 1 to ( 64 - len(key) )

key = key & chr(&H00)

next

'Response.Write(len(key))

ipad = "6666666666666666666666666666666666666666666666666666666666666666"

opad = "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"

k_ipad = strXor(ipad,key ) 'key Xor ipad

k_opad = strXor(opad,key ) 'key Xor opad

hmac =md5( k_opad & pack( md5( k_ipad & data ) ) )

End Function

Function strXor(strdata,strkey)

Dim strChar, iKeyChar, iStringChar, i,iCryptChar

for i = 1 to Len(strdata)

iKeyChar = Asc(mid(strkey,i,1))

iStringChar = Asc(mid(strdata,i,1))

iCryptChar = iKeyChar Xor iStringChar

strXor = strXor & Chr(iCryptChar)

next

End Function

Function ShowHex(data)

dim i

dim ch

l=lenB(data)

for i = 1 to l

ch=midB(data,i,1)

h=trim(hex(ascB(ch)))

if len(h)=1 then

h="0"+h

end if

ShowHex = ShowHex + h+" "

next

end Function

Function strtoHex(achar)

if Asc(achar) < 58 then

strtoHex = Asc(achar) - 48

else

strtoHex = Asc(achar) - 87

end if

End Function

Function pack(amd5)

dim i,n

dim abyte,hsum,lsum

n = len(amd5)/2

for i = 0 to n - 1

hsum = strtoHex(mid(amd5,2*i + 1,1)) * 16 + strtoHex(mid(amd5,2*i + 2,1))

if hsum > 127 and i < n - 1 then

i = i + 1

'Response.write(mid(amd5,2*i + 1,1) & mid(amd5,2*i + 2,1) )

lsum = strtoHex(mid(amd5,2*i + 1,1)) * 16 + strtoHex(mid(amd5,2*i + 2,1))

pack = pack & chr(hsum * 256 + lsum )

else

'Response.write(mid(amd5,2*i + 1,1) & mid(amd5,2*i + 2,1) )

pack = pack & chrw(hsum)

end if

next

End Function

Response.Write(md5(hmac("testdata","029a1228ea025cf897fe305715f3b794")))

%>

0
长宁区| 平江县| 铜川市| 东乡族自治县| 民乐县| 兴文县| 荣成市| 图们市| 南部县| 河津市| 出国| 林州市| 九台市| 罗平县| 杭锦后旗| 灵山县| 岱山县| 绥宁县| 漾濞| 托克托县| 桓台县| 宜良县| 吴旗县| 民和| 山西省| 厦门市| 通化县| 天长市| 二连浩特市| 望江县| 保德县| 华池县| 保靖县| 专栏| 海南省| 乐陵市| 广宗县| 措勤县| 梅河口市| 阿勒泰市| 新建县|