在asp.net里面加密密码的简单方法

代码如下:

imports system.web.Security

Public Class md
    Public Function mdaccess(ByVal password As String, ByVal mdx As String) As String
        mdaccess = FormsAuthentication.HashPasswordForStoringInConfigFile(password, mdx)
    End Function
End Class

这个函数的参数部份里password就是用户的原始密码,mdx是给出的加密算法的参数,这里只能有两个值,"MD5"和"SHA1",也就是这两种加密算法了.至于这个怎么用,不用多说了,就是为了把加密后的密码存入数据库,这样增加安全性,在对比密码时可对用户的输入密码进行同样的加密后再和数据库里的密文进行比较.
posted @ 2005-10-18 19:50  Aowind  阅读(1358)  评论(0编辑  收藏  举报