会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
内蒙古峰回路转armyfeng
博客园
首页
新随笔
联系
管理
订阅
c#利用Security加密解密口令
先需要using System.Web.Security;
MD5加密口令
#region
MD5加密口令
public
static
string
encrypt(
string
spass)
{
if
(spass.Length
>
0
)
{
string
encryptpass
=
FormsAuthentication.HashPasswordForStoringInConfigFile(spass,
"
MD5
"
);
return
encryptpass;
}
else
{
return
"
96E79218965EB72C92A549DD5A330112
"
;
//
默认密码设为空
}
}
#endregion
可选择性加密口令,MD5Hash16,MD5Hash32,Sha1Hash
#region
可选择性加密口令,MD5Hash16,MD5Hash32,Sha1Hash
public
static
string
UserPassFormat(
string
sPass,
string
encrypt)
{
if
(sPass.Length
>
0
)
{
string
encryptpass
=
FormsAuthentication.HashPasswordForStoringInConfigFile(sPass, encrypt);
return
encryptpass;
}
else
{
return
""
;
//
默认密码设为空
}
}
#endregion
posted @
2006-09-23 17:25
老冯
阅读(
648
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部