md5 加密

网上转的,测试一下OK。

    '16位或者32位MD5加密
    Public Function md5(ByVal str As String, ByVal code As Integer) As String
        If (code = 16) Then '16位md5加密码(取32位加密的9~25字符)
            Return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower.Substring(8, 16)
        Else '32位加密
            Return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower
        End If
    End Function

posted @ 2010-03-27 09:42  草根站长李小冲  阅读(262)  评论(0编辑  收藏  举报