| 用户组 : 上将 |
| 等级 : 商业用户 |
自封 : 无 |
| 发帖 : 24 |
| 积分 : 1054 |
| 金钱 : 1054 |
| 威望 : 1 |
| 注册 : 2006-8-18 2:11 |
|
|
第
1
楼
|
Private Function MD5(ByVal strSource As String, ByVal Code As Int16) As String
'这里用的是ascii编码密码原文,如果要用汉字做密码,可以用UnicodeEncoding,但会与ASP中的MD5函数不兼容
Select Case Code
Case 16 '选择16位字符的加密结果
MD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strSource, "MD5").ToLower().Substring(8, 16)
Case 32 '选择32位字符的加密结果
MD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strSource, "MD5").ToLower()
Case Else 'Code错误时,返回全部字符串,即32位字符
MD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strSource, "MD5").ToLower()
End Select
End Function
|
|