首页 > 其他 > 详细

MD5加密

时间:2015-08-06 12:54:56      阅读:280      评论:0      收藏:0      [点我收藏+]

引用:

using System.Security.Cryptography;

类:

public class MD5Util
{
public static string GetMD5(string input)
{
return GetMD5(input, Encoding.Default);
}

public static string GetMD5(string input, Encoding encoding)
{
using (MD5 md5Hash = MD5.Create())
{
byte[] data = md5Hash.ComputeHash(encoding.GetBytes(input));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sb.Append(data[i].ToString("x2"));
}

return sb.ToString();
}
}
}

MD5加密

原文:http://www.cnblogs.com/xsj1989/p/4707427.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!