DEV Community

Gabe
Gabe

Posted on

Checksum

When data are transmitted over the internet data could be loss due to signal noise or synchronization error. Checksum is a way to guarantee we have transmitted or received the full data.

What is Checksum

Checksum is a value that represents the sum of all bits a file have and then turned into a fixed length string. It also related as file's Hash. It can be identified as a very long string composed by letters and numbers.

Why Checksum is important

Its a way to guarantee that the file you wanted is not corrupted or broken. Its a way to ensure all the bites were transferred correct, guaranteeing file's integrity.

When downloading a file you will receive the file's checksum, when the download is completed, you can validate the checksum you received at the beginning of the download and calculate the current file checksum. If the result is slightly different, you can delete the file and try again or even contact the providers.

Incompatible checksum causes

It could be caused by a simple internet error - due a slow or not stable connection or a third party trying to intercept and change your data' transfer

Where is it used

You can check on Microsoft's windows checksum by running some terminal commands for example.

Cooking a Checksum.

Checksum is generated by an algorithm that have an input file and will spit out a Hash - string composed by letters and numbers.

This algorithm in general terms will count all the bites and then use some techniques involving MD5, SHA-1 or SHA-256 to generate an HASH. The file's size has no influence on HASH length, it could be a 100KB or 100GB it will output an HASH will keep with the same HASH length.

There is some interesting ways to compute and techniques that could be used, which would make this merely article very long, so, not going to cover it now.

Its being noticed that MD5 and SHA-1 have generated same HASHes for files with different content, so it would invalidate the file's checksum. Although SHA-256 has no issue related reported.

Conclusion

Checksum is a HASH that is used to check file's integrity after a download. Its generated by algorithms and basically uses MD5 or SHA-1 or SHA-256 as its base and Big Tech firms use it to guarantee you downloaded everything correctly.

Top comments (0)