在asp.net里面加密密码

http://www.sina.com.cn 2008年06月19日 10:15  IT168.com

【IT168技术文档】

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",也就是这两种加密算法了.至于这个怎么用,不用多说了,就是为了把加密后的密码存入数据库,这样增加安全性,在对比密码时可对用户的输入密码进行同样的加密后再和数据库里的密文进行比较.

Powered By Google
·城市对话改革30年 ·新浪城市同心联动 ·诚招合作伙伴 ·企业邮箱畅通无阻