//引用命名空间
using System.Web.Security;  
//MD5加密后长度是32位   
FormsAuthentication.HashPasswordForStoringInConfigFile("abc","md5")   
  
  
//SH1加密后长度是40位   
FormsAuthentication.HashPasswordForStoringInConfigFile("abc""sha1")  


//例子:
public string EncryptStr(string PWD, int Format)
    {
        
string str = "";
        
switch (Format)
        {
            
case 0:
                str 
= FormsAuthentication.HashPasswordForStoringInConfigFile(PWD, "SHA1");
                
break;
            
case 1:
                str 
= FormsAuthentication.HashPasswordForStoringInConfigFile(PWD, "MD5");
                
break;
        }
        
return str;
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-09-30
  • 2021-10-10
  • 2022-12-23
  • 2021-11-01
猜你喜欢
  • 2022-01-24
  • 2021-11-29
  • 2021-10-04
  • 2021-10-12
  • 2022-01-26
  • 2021-09-12
  • 2022-12-23
相关资源
相似解决方案