Saturday, May 29, 2010

Verify your downloads with checksums

lock-150

If you frequently download large files, such as installation media or LiveCDs, you might have encountered a situation where a file becomes corrupt during the download. You haven't? Let me paint a picture for you.

Your boss wants you to urgently deploy new ESXi server with all the latest updates and he wants it done yesterday. You grab the latest ISO release from the web and, after patiently waiting for it to download, burn it on a CD. You head to the server room, load the CD and… half way through install it complaints about media being corrupt. What happened? Was it the download? Failed burn session? Defective CD drive? Now you have to re-download the image and do it all over again and by now it's 4:30pm on Friday.

I have been there and can show you how to eliminate at least one unknown from the story above. You could verify whether file you downloaded is the same as the file posted on the web site. The process is called checksum or hash sum verification and allows you to check the integrity of your data.

Many sites will provide MD5, SHA1 or SHA256 checksum of the distributed file. All you have to do is compare it to the checksum of the file you have downloaded. How to do that? Here are two ways I use most often...

DownThemAll

This is a great little Firefox extension that speeds up your downloads by opening multiple simultaneous connections. It also allows you to pause and resume your downloads, filter, auto-rename them and more. DownThemAll supports: MD5, SHA1, SHA256, SHA384, SHA512. Next time you're downloading a file that has a known checksum, copy the checksum, right click the link to file, chose "Save link with DownThemAll" and paste the checksum in appropriate field. At the end of the end of the download checksums will be compared and you'll be alerted if something went wrong.

DownThemAll

The only problem with this plug-in is that you have to enter the checksum before the file download is complete, it does not allow you to generate a checksum of a file you already have on your disk. This is were the next tool shines…

HashTab

This tool integrates with your operating system (Windows or Mac) and allows you generate multiple types of checksums of any file your OS has access to. On Windows: right click the file, select "Properties", choose "File Hashes" tab and wait for checksums to generate (could take some time, depending on the file size).

HashTab

HashTab supports many more checksum types including: CRC32, MD5, SHA1, SHA256, RipeMD, Adler32, HAVAL, Tiger and Whirlpool. Enable only the ones you use most often to minimize wait time.