using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string f = @"C:\DTEXT23\BIN\CGMZV.DLL"; MD5 md5 = MD5.Create(); StringBuilder sb = new StringBuilder(); using (FileStream fs = File.Open(f, FileMode.Open)) { foreach (byte b in md5.ComputeHash(fs)) sb.Append(b.ToString("x2").ToLower()); } Console.WriteLine("MD5校验码: {0}", sb.ToString()); Console.Read(); } } }
string passWordString = FormsAuthentication.HashPasswordForStoringInConfigFile(Login1.Password, "MD5");