打印

[NET精华教程] .net教程:asp.net中的md5加密

.net教程:asp.net中的md5加密

其实在asp.net编程中,不用调用md5.asp来加密数据。在dotnet中有自带的类:system.web.security.hashpasswordforstoringinconfigfile()
public string md5(string str,int code)
{
if(code==16) //16位md5加密(取32位加密的9~25字符)
{
return system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(str,"md5").tolower().substring(8,16) ;
}
if(code==32) //32位加密
{
return system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(str,"md5").tolower();
}
return "00000000000000000000000000000000";

}



TOP

返回顶部
AYBlue

Processed in 0.040846 second(s), 7 queries.

当前时区 GMT+8, 现在时间是 2009-1-8 14:10 京ICP备06054220号

清除 Cookies - 联系我们 - 163K.com - Archiver - WAP