分享你我的心得.
共乘一片美好网络.

ASP字符串16进制互转

<%
‘字符串转十六进制
Function StrToHex(ByRef Str)
Dim Length
Dim Max
Dim strHex
Max = Len(Str)
For Length = 1 To Max
strHex = strHex & Right(“0” & Hex(Asc(Mid(Str, Length, 1))), 2)
Next
StrToHex = strHex
End function

‘十六进制转字符串
Function HexToStr(ByRef strHex)
Dim Length
Dim Max
Dim Str
Max = Len(strHex)
For Length = 1 To Max Step 2
Str = Str & Chr(“&h” & Mid(strHex, Length, 2))
Next
HexToStr = Str
End function
%>

<%
Dim y,h,s
y = “5F24E863C33D8237C9DEC4AAD17CFCE10832C2255B2301AFC168B9781E273823ADB8E2D4B2A867BE1891CC95A8998C42”
h = StrToHex(y)
s = HexToStr(h)
Response.Write(y &”<br>”)
Response.Write(h &”<br>”)
Response.Write(s &”<br>”)
%>

赞(0)
未经允许不得转载:小叶白龙博客 » ASP字符串16进制互转
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!