C#中使用MD5加密

   1: public string CreateMD5(string inputStr)
   2: {
   3:     MD5 md5 = MD5.Create();
   4:     byte[] byteChar = md5.ComputeHash(Encoding.Default.GetBytes(inputStr));
   5:  
   6:     StringBuilder sb = new StringBuilder();
   7:     foreach (byte b in byteChar)
   8:     {
   9:        sb.Append(b.ToString("x2"));
  10:     }
  11:     return sb.ToString();
  12: }
posted @ 2008-12-27 18:53  樊凯  阅读(783)  评论(3编辑  收藏  举报