标题: C# MD5,可以直接用 [打印本页] 作者: 佟嘉豪 时间: 2013-11-3 01:10 标题: C# MD5,可以直接用 using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace MD5加密
{
class Program
{
static void Main(string[] args)
{
string str = "123";
string newStr=GetMd5(str);
Console.WriteLine(newStr);
}
public static string GetMd5(string pwd)
{
MD5 md5 = MD5.Create();
byte[] buffer = System.Text.Encoding.Default.GetBytes(pwd);
byte[] bufferMd5=md5.ComputeHash(buffer);
//string result = System.Text.Encoding.Default.GetString(bufferMd5);
//return result;
string str = "";
for (int i = 0; i < bufferMd5.Length; i++)
{