主题:[讨论]请教VB2005里的MD5加密(30分)
在vb2005里用下面代码算出的32位MD5值和http://www.chinaue.com/tool/md5/md5.htm
http://www.xmd5.org/Encrypt_cn.htm 里算出的不一样
Public Function Md5hash_String(ByVal InputString As String) As String
Dim MD5 As String = ""
Dim dataToHash As Byte() = (New System.Text.ASCIIEncoding).GetBytes(InputString)
Dim hashvalue As Byte() = CType(System.Security.Cryptography.CryptoConfig.CreateFromName("MD5"), System.Security.Cryptography.HashAlgorithm).ComputeHash(dataToHash)
Dim i As Integer
For i = 0 To 15
MD5 += Hex(hashvalue(i)).ToLower
Next
Return MD5
End Function
比如传入123456
代码算出的是 :e1adc3949ba59abbe56e057f2f883e
网上和工具算出的是:e10adc3949ba59abbe56e057f20f883e
请高手帮忙看看什么地方出错了,先谢谢了![em2]
http://www.xmd5.org/Encrypt_cn.htm 里算出的不一样
Public Function Md5hash_String(ByVal InputString As String) As String
Dim MD5 As String = ""
Dim dataToHash As Byte() = (New System.Text.ASCIIEncoding).GetBytes(InputString)
Dim hashvalue As Byte() = CType(System.Security.Cryptography.CryptoConfig.CreateFromName("MD5"), System.Security.Cryptography.HashAlgorithm).ComputeHash(dataToHash)
Dim i As Integer
For i = 0 To 15
MD5 += Hex(hashvalue(i)).ToLower
Next
Return MD5
End Function
比如传入123456
代码算出的是 :e1adc3949ba59abbe56e057f2f883e
网上和工具算出的是:e10adc3949ba59abbe56e057f20f883e
请高手帮忙看看什么地方出错了,先谢谢了![em2]