[C#] Get Hash From File

  • Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

Elite_Modz

Active Poster
Retired Staff
Active Member
Console ID Poster
Dec 19, 2014
517
380
133
Crunch
Reference:
Code:
using System.Security.Cryptography;
using System.IO;

Get MD5 Code 1:
Code:
#region GetMD5Hash
  public static string GetMD5HashFromFile(string filename)
  {
  using (var md5 = new MD5CryptoServiceProvider())
  {
  var buffer = md5.ComputeHash(File.ReadAllBytes(filename));
  var sb = new StringBuilder();
  for (int i = 0; i < buffer.Length; i++)
  {
  sb.Append(buffer[i].ToString("x2"));
  }
  return sb.ToString();
  }
  } //MessageBox.Show(GetMD5HashFromFile(""));

Get Md5 Code 2:
Code:
#region Computer_Get_MD5
  public static string Computer_Get_File_MD5(string filename)
  {
  using (var md5 = new MD5CryptoServiceProvider())
  {
  var buffer = md5.ComputeHash(File.ReadAllBytes(filename));
  var stringbuilder = new StringBuilder();
  for (int i = 0; i < buffer.Length; i++)
  {
  stringbuilder.Append(buffer[i].ToString("x2"));
  }
  return stringbuilder.ToString();
  }
  }//Computer_Get_File_MD5(filepath\file.txt)
  #endregion
 
Last edited:
General chit-chat
Help Users
    @ lurch6661: you did it