7 ways to generate a MD5 File Checksum

There are several ways to generate the MD5 file checksum. A checksum serves the purpose of detecting any kind of errors that are developed in any data or function during its storage or transmission. In this post, you’ll learn how to do this on different operating systems and tools.

But first, you need to know what the MD5 File is. For this, let us have a little background of the topic. The commonly known MD5 is an acronym of Message Direct 5, which is an algorithm; basically a hash function.

This hash function is a class of functions that are used for the mapping of arbitrary sized data into some values, which are fixed. These fixed values are either called Hash values or just Hashes. When an MD5 function is used to produce this hash function, it results in a hash code of 128-bits.

Published in 1992, the MD5 function was aimed to be utilized as a CHF (Cryptographic Hash Function) but it faced some vulnerability in this usage. Thus, it changed its course and now it’s mostly used to verify the integrity of data as checksum.

Coming towards our main topic, there are a number of ways to generate the MD5 File Checksum. Some of such ways are stated below:

The Command Line Method

A command line tool is a built-in in the Microsoft Windows 10, in the form of some certificate services, which is “CertUtil”. This command line offers a switch, “Hashfile”, thanks to this, a hash string can be generated. Here a specified algorithm can be used, such as MD5.

certutil -hashfile <file> <algorithm>
certutil -hashfile myfile.zip MD5

The PowerShell Method

There is also a command in PowerShell.
This is the most efficient and the easiest method, as it does not include any kind of coding. If the PowerShell 4.0 is used then a command line, i.e., cmdlet exists in it. This cmdlet is also known as “Get-FileHash”. With the help of this command line, a hash file can be generated very much easily.

Get-FileHash -Path <file> -algorithm <name>
Get-FileHash -Path myfile.zip -algorithm MD5

The Right Click Menu Dropdown Method

You can also find tools that can be use in the right-click menu on a file.
After its installation, if right click is done on this windows application then a context menu is opened. In this drop down menu, there is an option named as Hash Generator, which helps to generate the desired hashes in the file.
Download here

The Third Party Tools Methods

Not everybody is a coding person and thus not everybody uses the command lines therefore a few third-party tools are available that can serve the purpose in a better way.

These third-party apps have built-in command lines and the code hidden in them and thus when a command is entered to them to generate the MD5 Checksum for a file, they do so within a few instants and no extra hard work is required.
Such third-party apps are mentioned below, for instance:

Hash Generator

There is a free universal hash generating tool available in the market for Windows 10, namely the Hash Generator. Thanks to this software, the generation of fourteen different types of checksum or hashes is done easily. It supports a number of function families, including the MD5.
Download here

MD5 Checksum Utility

This is another tool, which is used to generate different types of checksum or hashes: MD5 & SHA Checksum Utility.
This MD5 Checksum Utility is different from the Hash Generator in a sense that it lets you match the actual file with the hash file to verify and ensure the integrity of the file.
Download here

HashMyFiles

Compared to the MD5 Checksum Utility and the Hash Generator, the HashMyFiles tool is a smaller and a portable tool.

It serves the same purpose as that of the MD5 Checksum Utility and the Hash Generator, i.e., the generation of different types of checksum or hashes. It is different from the other two in a sense that it is fast and lets you check the hashes of a number of files at an instant.
Download here.

If the three options are compared then HashMyFiles is the best option available in the market as it is smaller, it is faster, it is portable and the most important fact of all these, it lets a person check a number of files an instant. Therefore, this HashMyFiles is most commonly used by a number of people looking for this feature.

The Tab from File’s Property Method

A “File hashes” Tab in the properties of the file is another free tool that helps you generate the checksum and hashes of a number of functions and files.

This Tab in the File Property comes after the installation of a free tool named as “HashTab”. Thanks to this tool, a separate tab is added in the dialogue box of the File Properties. If this tab is clicked in the dialogue box of file properties, it lets one display the hashes of the clicked file, of which the dialogue box of the file properties was opened for.
Download here.

On android

This part is intended for programmers, but can help you if you are in this case.

First method

First of all, to generate and check the checksum and hashes of the desired file, the file is converted to a string. After converting to a string, the following methodology or the code is used, as below:

Code:

public static String getMD5EncryptedString ( String encTarget )
{
   MessageDigest mdEnc = null;
   Try         {
      mdEnc = MessageDigest.getInstance ( "MD5" ) ;
   }
   catch ( NoSuchAlgorithmException e )
  {
      System.out.println( "Exception while encrypting to md5" );
      e.printStackTrace () ;
   }

   mdEnc.update(encTarget.getBytes () , 0, encTarget.length () ) ;
   String md5 = new BigInteger ( 1, mdEnc.digest () ).toString ( 16 ) ;
   while ( md5.length () < 32 ) {
      md5 = "0" + md5;
   }
   Return md5;
}

This method is good enough for the small sized files or strings and not for the bigger sized strings.

Second Method

With the help of the following code just, the checksum for MD5 in android Operating System can be achieved, as:

MessageDigest md = MessageDigest.getInstance( "MD5" ) ;
InputStream is = new FileInputStream ( "file.txt" ) ;
try {
   is = new DigestInputStream ( is, md ) ;
}

finally {
   is.close () ;
}

byte [] digest = md.digest () ;

More methods and notes on Android files hash here.

The above methods are used to generate MD5 checksum and hashes. The above seven mentioned methods are usable by different operating systems, which were mentioned along. For instance, the first five methods are for Windows 10 operating system and the next two, i.e., sixth and seventh methods are for android operating system.