January 29, 2019

What is Checksum? And How to Calculate Checksums

What is Checksum And How to Calculate Checksums

We all are used to sending data over the Internet or other local networks. Typically, such data is transferred over the network in the form of bits. Generally, when tons of data is being sent over a network, it is susceptible to data loss due to a network issue or even a malicious attack. A checksum is used to ensure that the data received is unharmed and free of errors and losses. Checksum acts as a fingerprint or a unique identifier for the data.

To understand this better, consider this: I am sending you a basket of apples via some delivery agent. Now, since the delivery agent is a third party, we can’t rely on his authenticity entirely. So to ensure that he has not eaten any apples on his way and that you receive all the apples, I call you up and tell you that I have sent you 20 apples. On receiving the basket, you count the number of apples and check if it is 20.

What is Checksum And How to Calculate Checksums

This count of apples is what checksum does to your file. If you have sent a very large file over a network (third party) or you have downloaded one from the internet and you want to make sure that the file has been correctly sent or received, you apply a checksum algorithm on your file which is being sent and communicate the value to the receiver. On receiving the file, the receiver will apply the same algorithm and match the obtained value with what you have sent. If the values match, the file has been sent correctly and no data has been lost. But if the values are different, the receiver will instantly know that some data has been lost or the file has been tampered with over the network. Since the data may be highly sensitive and important to us, it is important to check any error that might have occurred while transmission. So, a checksum is very important to maintain data authenticity and integrity. Even a very small change in data causes a major change in the checksum. Protocols like TCP/IP which govern the communication rules of the internet also use the checksum to make sure that always correct data is delivered.

A checksum is basically an algorithm that uses a cryptographic hash function. This algorithm is applied over a piece of data or a file before sending and after receiving it over a network. You might have noticed that it is provided beside a download link so that when you download the file, you can calculate the checksum on your own computer and match it with the given value. Note that the length of a checksum does not depend upon the size of data but on the algorithm used. The most common checksum algorithms used are MD5 (Message Digest algorithm 5), SHA1 (Secure Hashing Algorithm 1), SHA-256 and SHA-512. These algorithms produce 128-bit, 160-bit, 256 -bit and 512-bit hash values respectively. SHA-256 and SHA-512 are more recent and stronger than SHA-1 and MD5, which in some rare cases produced the same checksum values for two different files. This compromised the validity of those algorithms. The newer techniques are error proof and more reliable. Hashing algorithm mainly converts the data to its binary equivalent and then carries some basic operations like AND, OR, XOR, etc. on it and finally extracts the hex value of the computations.

What is checksum? And How to Calculate Checksums

Method 1: Calculate Checksums using PowerShell

1.Use the search on start menu on Windows 10 and type PowerShell and click on ‘Windows PowerShell’ from the list.

2.Alternatively, you can right click on start and select ‘Windows PowerShell’ from the menu.

Open Elevated Windows PowerShell in Win + X Menu

3.In the Windows PowerShell, run the following command:

Get-FileHash yourFilePath
For example, Get-FileHash C:UsershpDesktopmyfile.docx

4.The prompt will display SHA-256 hash value by default.

Calculate Checksums using PowerShell

5.For other algorithms, you can use:

Get-FileHash yourFilePath –Algorithm MD5
Or
Get-FileHash yourFilePath –Algorithm SHA1

You can now match the obtained value with the given value.

You can also calcaulate checksum hash for MD5 or SHA1 algorithm

Method 2: Calculate Checksum using Online Checksum Calculator

There are many online checksum calculators like ‘onlinemd5.com’. This site can be used to calculate MD5, SHA1 and SHA-256 checksums for any file and even for any text.

1.Click on the ‘Choose file’ button and open your desired file.

2.Alternatively, drag and drop your file into the given box.

Select your desired algorithm and obtain the required checksum

3.Select your desired algorithm and obtain the required checksum.

Calculate Checksum using Online Checksum Calculator

4.You can also match this obtained checksum with the given checksum by copying the given checksum into the ‘Compare with:’ textbox.

5.You will see the tick or the cross beside the text box accordingly.

To calculate the hash for a string or text directly:

a)Scroll down the page to ‘MD5 & SHA1 Hash Generator For Text

You can also calculate the hash for a string or text directly

b)Copy the string into the given text box to obtain the required checksum.

For other algorithms, you can use ‘https://defuse.ca/checksums.htm’. This site gives you an extensive list of many different hashing algorithm values. Click on ‘Choose file’ to select your file and click on ‘Calculate Checksums…’ to get the results.

Method 3: Use MD5 & SHA Checksum Utility

First, download the MD5 & SHA Checksum Utility then launch it by double-clicking on the exe file. Simply browse your file and you can obtain its MD5, SHA1, SHA-256, or SHA-512 hash. You can also copy-paste the given hash into the relevant textbox to easily match it with the obtained value.

Use MD5 & SHA Checksum Utility

Recommended:

I hope the above steps were helpful in learning What is Checksum? And How to Calculate it; but if you still have any questions regarding this article then feel free to ask them in the comment’s section.