我写的一个.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;
}
}
本文转自 OldHawk 博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2007/04/30/733244.html,如需转载请自行联系原作者