Asp.net 使用MD5加密的一个类

使用命名空间:using System.Web.Security;

 

 public static string setMD5(string str, int code)
        {
            
if (code == 16//16位MD5加密(取32位加密的9~25字符) 
            {
                
return FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(816);
            }
            
else   //32位加密 
            {
                
return FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower();
            }
        }

 

 

posted @ 2011-06-19 21:22  ゞ追忆o0ゞ  阅读(303)  评论(0编辑  收藏  举报