加密算法

来源:互联网 发布:软件维护收费标准 编辑:程序博客网 时间:2024/05/17 07:26
  public static string ToMd5Code( string inPut )
  {
   MD5 s = MD5.Create("123");
   string output = string.Empty;
   MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
   UTF8Encoding encoder = new UTF8Encoding();
   byte [] md5byte = md5.ComputeHash(encoder.GetBytes( inPut )); 
   for(int i=0;i<md5byte.Length; i++)
   { 
    output += md5byte[i].ToString("x").PadLeft(2,'0');
   }
   return output;
  }
原创粉丝点击