bin.base64和bin.hex编码与解码

Function EncodeBase64(bytesData)
Dim objXd
Set objXd=Server.CreateObject("msxml.domdocument")
Call objXd.loadXml("<root/>")
objXd.DocumentElement.DataType="bin.base64"
objXd.DocumentElement.NodeTypedValue=bytesData
EncodeBase64=objXd.DocumentElement.text
End Function
Function Base64Decode(strData)
Dim objXd
Set objXd=Server.CreateObject("msxml.domdocument")
Call objXd.loadXml("<root/>")
objXd.DocumentElement.DataType="bin.base64"
objXd.DocumentElement.text=strData
Base64Decode=objXd.DocumentElement.NodeTypedValue
End Function

Function Save2Local(imgs,tofile)
Set objStream=Server.CreateObject("Adodb.Stream")
objStream.Mode=3
objStream.Type=1
objStream.Open
objStream.Write imgs
objStream.SaveToFile tofile,2
objStream.Close
Set objStream=Nothing
End Function

 

上面的bin.base64换成bin.hex就可以解hex的了

 

参考:

http://www.hdfu.net/down.html

http://www.yc-edu.org/netpeixun/2631.html

http://zhidao.baidu.com/question/347852000.html

 

你可能感兴趣的:(编码,解码,bin.base64,bin.hex)