C# file verification: MD5, SHA1, SHA256, SHA384, SHA512, CRC32, CRC64

File verification algorithms: MD5, SHA1, SHA256, SHA384, SHA512, CRC32, CRC64 (free)

Programming language: C#

Function: file hash attribute

Verification algorithm: MD5, SHA1, SHA256, SHA384, SHA512, CRC32, CRC64.

Download (free): https://download.csdn.net/download/polloo2012/88450148

This program File Properties and Hash Validation.exe verifies:

MD5: DD3BE641301A54E093CAC2C15823491A
SHA1: 711330AD0E0BB25D6E6E6AD2BE1ACEE1830C7FBD
SHA256: CEF9D7915425C96C6C73BF212D7C7E6D8A3D90028DFA4278B0E351B3C63BE3EA
SHA384: F6115FCF1C4E08A571D87441E72C163291677D5644A983CE8DD068F1B3386413CFC3390DF0AE47A41B5F90145F798C01
SHA512: 93DDBF61CA0F10500141AB6D78B156C2AB6EEA4A777A8C90D58F40D42BDF5CEE1E0DAAE0258ECB748640CFD07AB5B47EC97E28D929818250D8F1E613C4EF4BA6
CRC32: B5504085
CRC64: E9D486C6CF48506A

Updated: October 21, 2023

1. Register Windows right-click to support right-click

Update time: October 26, 2023 (no longer updated)

1. Normal and multi-threaded (default multi-threaded)

2. Modify some layouts and add a lower right menu

Core code:

using System;
using System.Collections.Generic;
using System;
using System.Text;
using System.Threading;
using System.Security;
using System.Security.Cryptography;
using System.Data.HashFunction;

namespace HashChecker
{
    /// <summary>
    /// There are some kinds of hash algorithm in this class likes MD5, SHA1, SHA256, SHA384, SHA512, CRC32, CRC64.
    /// This class provides several data digest algorithms such as MD5, SHA1, SHA256, SHA384, SHA512, CRC32, and CRC64.
    /// </summary>
    public static class HashFunction
    {
        /// <summary>
        /// Caculate string's MD5 value. Calculate the MD5 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return MD5 value. Return MD5 value. </returns>
        public static string md5(string strIN)
        {
            return md5(System.Text.Encoding.Default.GetBytes(strIN));
        }
        /// <summary>
        /// Caculate string's MD5 value. Calculate the MD5 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return MD5 value. Return MD5 value. </returns>
        public static string md5(Byte[] btIN)
        {
            System.Security.Cryptography.MD5 md5 = new MD5CryptoServiceProvider();
            byte[] bytResult = md5.ComputeHash(btIN);
            md5.Clear();
            string strResult = BitConverter.ToString(bytResult);
            strResult = strResult.Replace("-", "");
            return strResult;
        }

        /// <summary>
        /// Caculate string's SHA1 value. Calculate the SHA1 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return SHA1 value. Return SHA1 value. </returns>
        public static string sha1(string strIN)
        {
            return sha1(System.Text.Encoding.Default.GetBytes(strIN));
        }
        /// <summary>
        /// Caculate string's SHA1 value. Calculate the SHA1 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return SHA1 value. Return SHA1 value. </returns>
        public static string sha1(byte[] btIN)
        {
            byte[] tmpByte;
            SHA1 sha1 = new SHA1CryptoServiceProvider();
            tmpByte = sha1.ComputeHash(btIN);
            sha1.Clear();
            string strResult = BitConverter.ToString(tmpByte);
            strResult = strResult.Replace("-", "");
            return strResult;
        }

        /// <summary>
        /// Caculate string's SHA256 value. Calculate the SHA256 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return SHA256 value. Return SHA256 value. </returns>
        public static string sha256(string strIN)
        {
            return sha256(System.Text.Encoding.Default.GetBytes(strIN));
        }
        /// <summary>
        /// Caculate string's SHA256 value. Calculate the SHA256 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return SHA256 value. Return SHA256 value. </returns>
        public static string sha256(byte[] btIN)
        {
            byte[] tmpByte;
            SHA256 sha256 = new SHA256Managed();
            tmpByte = sha256.ComputeHash(btIN);
            sha256.Clear();
            string strResult = BitConverter.ToString(tmpByte);
            strResult = strResult.Replace("-", "");
            return strResult;
        }

        /// <summary>
        /// Caculate string's SHA384 value. Calculate the SHA384 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return SHA384 value. Return SHA384 value. </returns>
        public static string sha384(string strIN)
        {
            return sha384(System.Text.Encoding.Default.GetBytes(strIN));
        }
        /// <summary>
        /// Caculate string's SHA384 value. Calculate the SHA384 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return SHA384 value. Return SHA384 value. </returns>
        public static string sha384(byte[] btIN)
        {
            byte[] tmpByte;
            SHA384 sha384 = new SHA384Managed();
            tmpByte = sha384.ComputeHash(btIN);
            sha384.Clear();
            string strResult = BitConverter.ToString(tmpByte);
            strResult = strResult.Replace("-", "");
            return strResult;
        }

        /// <summary>
        /// Caculate string's SHA512 value. Calculate the SHA512 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return SHA512 value. Return SHA512 value. </returns>
        public static string sha512(string strIN)
        {
            return sha512(System.Text.Encoding.Default.GetBytes(strIN));
        }
        /// <summary>
        /// Caculate string's SHA512 value. Calculate the SHA512 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return SHA512 value. Return SHA512 value. </returns>
        public static string sha512(byte[] btIN)
        {
            byte[] tmpByte;
            SHA512 sha512 = new SHA512Managed();
            tmpByte = sha512.ComputeHash(btIN);
            sha512.Clear();
            string strResult = BitConverter.ToString(tmpByte);
            strResult = strResult.Replace("-", "");
            return strResult;
        }

        /// <summary>
        /// Caculate string's CRC32 value. Calculate the cyclic redundancy check code CRC32 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return CRC32 value. Return CRC32 value. </returns>
        public static string crc32(string strIN)
        {
            return crc32(strIN);
        }
        /// <summary>
        /// Caculate string's CRC32 value. Calculate the cyclic redundancy check code CRC32 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return CRC32 value. Return CRC32 value. </returns>
        public static string crc32(byte[] btIN)
        {
            return crc_caculator(btIN, CRC.Standard.CRC32);
        }

        /// <summary>
        /// Caculate string's CRC64 value. Calculate the cyclic redundancy check code CRC64 value of the string.
        /// </summary>
        /// <param name="strIN">input string. The input string. </param>
        /// <returns>Return CRC64 value. Return CRC64 value. </returns>
        public static string crc64(string strIN)
        {
            return crc64(strIN);
        }
        /// <summary>
        /// Caculate string's CRC64 value. Calculate the cyclic redundancy check code CRC64 value of the string.
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <returns>Return CRC64 value. Return CRC64 value. </returns>
        public static string crc64(byte[] btIN)
        {
            return crc_caculator(btIN, CRC.Standard.CRC64);
        }
        /// <summary>
        /// CRC Caculator. CRC cyclic redundancy check code calculator
        /// </summary>
        /// <param name="btIN">input Byte Array. Input byte array. </param>
        /// <param name="standard">CRC Standard. CRC calculation standard. </param>
        /// <returns>Return CRC value. Return CRC value. </returns>
        public static string crc_caculator(byte[] btIN, CRC.Standard standard)
        {
            CRC.Setting crcset = CRC.Standards[standard];
            System.Data.HashFunction.CRC crc = new CRC(crcset);
            byte[] tmpByte = crc.ComputeHash(btIN);
            string strResult = BitConverter.ToString(tmpByte);
            strResult = strResult.Replace("-", "");
            return strResult;
        }
    }
}