QFSoft

FireTiger

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

Imports System.Text
Imports
   Private Function MD5Encrypt(ByVal EncrtyptStr As StringAs String

        
Dim md5 As New MD5CryptoServiceProvider
        
Dim Password As Byte() = (New ASCIIEncoding).GetBytes(EncrtyptStr)
        
Dim mdByte As Byte() = md5.ComputeHash(Password)

        
Return (New ASCIIEncoding).GetString(mdByte)

    
End Function
 

------------------------------------------

上面的那个,我试后好像会出现乱码
如果不行的话试试下的这个吧:
首先在引用里面添加一个System.Web.dll这个引用
Imports System.Web.Security
    Public Class MD5
        Public Function MD5(ByVal StrValue  As String)  As String
            MD5 = FormsAuthentication.HashPasswordForStoringInConfigFile(StrValue, "md5")
        End Function
    End Class
用的时候直接调用上面的类:S=md5("你要加密的值")

posted on 2007-06-18 08:55  MFKSoft  阅读(1110)  评论(1)    收藏  举报
web counter
web counter