C#MD5加密程序

using System.Security.Cryptography;

需要引用这个命名空间

MD5 md = new MD5CryptoServiceProvider();
string source = "aiawaysrain";
byte[] s = Encoding.Default.GetBytes(source);
byte[] output = md.ComputeHash(s);
string outstring = BitConverter.ToString(output).Replace("-","").ToUpper();
Console.Write(outstring);
Console.Read();

输出结果:9118BFD94A9CE9CF37AE5BAA947ED596

posted @ 2013-01-04 09:37  姜大伟  阅读(231)  评论(0编辑  收藏  举报