C# md5 算法实现代码

  using System;

  using System.Collections.Generic;

  using System.Linq;

  using System.Text;

  using System.Threading.Tasks;

  using System.Security.Cryptography;

  namespace md5

  {

  class Program

  {

  static void Main(string[] args)

  {

  MD5 md5 = new MD5CryptoServiceProvider();

  string str = Console.ReadLine();

  byte[] data = Encoding.UTF8.GetBytes(str);

  byte[] result = md5.ComputeHash(data);

  for (int i = 0; i < 16; i++)

  {

  Console.Write(result[i].ToString("X2"));

  Console.Write(" ");

  }

  Console.ReadKey();

  }

  }

  }