在MSDN上找MD5的示例费劲死了,现在写个简单的,

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            MD5 myMD5 = MD5.Create();
            Stream myStream = new FileStream(@"E:\Software\incubating-log4net-1.2.10.zip", FileMode.OpenOrCreate);
            byte[] myByte = myMD5.ComputeHash(myStream);
            string pwd = "";
            for (int i = 0; i < myByte.Length; i++)
            {
                // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
                pwd = pwd + myByte[i].ToString("x");
            }

            Console.WriteLine(pwd);
            
        }
    }
}

相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2021-10-26
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2021-12-13
  • 2021-07-15
  • 2021-11-16
  • 2021-12-31
  • 2022-12-23
相关资源
相似解决方案