McJeremy
第一种方式是使用:
System.Web.Security空间下的相应类和方法加密,示例:
public string GetMD5(string s,int len)
{
   
return FormsAuthentication.HashPasswordForStoringInConfigFile(s,"MD5").Substring(0,len).ToLower();
}
第二种方式:
public string GetMD5(string s,int len)
{
  System.Security.Cryptography.MD5 md5
=System.Security.Cryptography.MD5.Create();
  
byte[] bytes=System.Text.Encoding.UTF8.GetBytes(s);
bytes
=md5.ComputeHash(bytes);
return System.BitConverter.ToString(buffer).Replace("-""").Substring(0,len).ToLower();
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-01-19
  • 2021-06-25
  • 2022-01-26
  • 2022-12-23
猜你喜欢
  • 2021-07-01
  • 2021-09-05
  • 2022-12-23
  • 2022-02-09
  • 2022-01-07
  • 2021-08-21
相关资源
相似解决方案