c# 之如何计算md5码

代码如下:

 1             static MD5 s_md5;
 2             static MD5 MD5Obj
 3             {
 4                 get { return s_md5 ?? (s_md5 = MD5.Create()); }
 5             }
 6 
 7             public static string ComputeHash(byte[] buffer)
 8             {
 9                 if (buffer == null || buffer.Length < 1)
10                     return "";
11 
12                 byte[] hash = MD5Obj.ComputeHash(buffer);
13                 StringBuilder sb = new StringBuilder();
14 
15                 foreach (var b in hash)
16                     sb.Append(b.ToString("x2"));
17 
18                 return sb.ToString();
19             }

 

c# 之如何计算md5码

上一篇:AgileEAS.NET SOA 中间件平台.Net Socket通信框架-完整应用例子-在线聊天室系统-下载配置


下一篇:HIVE优化浅谈