我写的一个.net里面用于md5加密的类。

using System;
using System.Security.Cryptography;

namespace md5
{
    
/// <summary>
    
/// Class1 的摘要说明。
    
/// </summary>
    public class stringToMD5
    {
        
public stringToMD5()
        {
            
//
            
// TODO: 在此处添加构造函数逻辑
            
//
        }

        
public static string makeMD5(string source)
        {
            
byte[] b=System.Text.Encoding.Default.GetBytes(source);
            b
=new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(b);
            
string ret="";
            
for(int i=0;i<b.Length;i++)
                ret
+=b[i].ToString ("x").PadLeft(2,'0');
            
return ret;
        }
    }
}

相关文章:

  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2021-12-01
  • 2021-09-13
  • 2022-12-23
猜你喜欢
  • 2022-03-06
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-28
  • 2021-11-22
相关资源
相似解决方案