How to Verify the integrity of a Downloaded File – on Windows, Mac & Linux

When you move files over a network, then there is always the possibility of something going wrong. Even when no error is reported, the file may be corrupt or incomplete. To be sure that everything is correct, you should check the checksum of the file. This can be done with pre-installed tools on nearly every operating system and this article is going to show you how it’s done.

For all the following examples I want to generate a checksum for the file Ataraxis.jar. When you try it on your own, you simply replace Ataraxis.jar with the name of your file.

 

Windows

CertUtil is a pre-installed tool to work with X509 certificates. However, when you use the option -hashfile you can generate a checksum for any file you want and not just certificates:

Without any additional parameter the SHA1 algorithm is used. To change this, you simply add the name of another algorithm (like MD5 or SHA256) at the end of the command:

 

Mac OS X

Unfortunately, even on Mac OS X is no graphical tool pre-installed. You therefore need to use the command line as well. The commands are shasum for the SHA-XXX algorithms and md5 when you need to generate an MD5 checksum:

 

Linux

On Linux you can use nearly the same tools to generate the checksum of a file. However, to generate a SHA-256 checksum, you can use the dedicated tool sha256sum:

 

Conclusion

The command-line tools may not be the most user-friendly ones, but they work well and are to your disposal even when you aren’t allowed to install additional software. You never know when they may come in handy.

1 thought on “How to Verify the integrity of a Downloaded File – on Windows, Mac & Linux”

  1. Thanks for this. I agree the command-line is not comfortable for typical users, but they are definitely time-savers for those in the know. Thanks for the share. Cheers~


    Sam Smith
    Technology Evangelist and Aspiring Chef.
    Large file transfers made easy.
    http://www.innorix.com/en/DS

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.