What is the best way to calculate a checksum for a file that is on my machine?

WindowsChecksum

Windows Problem Overview


I'm on a Windows machine and I want to run a checksum on the MySQL distribution I just got. It looks like there are products to download, an unsupported Microsoft tool, and probably other options. I'm wondering if there is a consensus for the best tool to use. This may be a really easy question, I've just never run a checksum routine before.

Windows Solutions


Solution 1 - Windows

The CertUtil is a pre-installed Windows utility, that can be used to generate hash checksums:

CertUtil -hashfile pathToFileToCheck [HashAlgorithm]

HashAlgorithm choices: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

So for example, the following generates an MD5 checksum for the file C:\TEMP\MyDataFile.img:

CertUtil -hashfile C:\TEMP\MyDataFile.img MD5

To get output similar to *Nix systems you can add some PS magic:

$(CertUtil -hashfile C:\TEMP\MyDataFile.img MD5)[1] -replace " ",""

Solution 2 - Windows

I personally use Cygwin, which puts the entire smörgåsbord of Linux utilities at my fingertip --- there's md5sum and all the cryptographic digests supported by OpenSSL. Alternatively, you can also use a Windows distribution of OpenSSL (the "light" version is only a 1 MB installer).

Solution 3 - Windows

Any MD5 will produce a good checksum to verify the file. Any of the files listed at the bottom of this page will work fine. http://en.wikipedia.org/wiki/Md5sum

Solution 4 - Windows

On Windows : you can use FCIV utility : http://support.microsoft.com/kb/841290

On Unix/Linux : you can use md5sum : http://linux.about.com/library/cmd/blcmdl1_md5sum.htm

Solution 5 - Windows

Checksum tabs: http://code.kliu.org/hashcheck/

This has worked great for me on windows for a while now. It allows easy copying and pasting of checksums. It has box to type/paste check sums from webpages and show matches or non matches quite well.

Solution 6 - Windows

On MySQL.com, MD5s are listed alongside each file that you can download. For instance, MySQL "Windows Essentials" 5.1 is 528c89c37b3a6f0bd34480000a56c372.

You can download md5 (md5.exe), a command line tool that will calculate the MD5 of any file that you have locally. MD5 is just like any other cryptographic hash function, which means that a given array of bytes will always produce the same hash. That means if your downloaded MySQL zip file (or whatever) has the same MD5 as they post on their site, you have the exact same file.

Solution 7 - Windows

When I worked with Windows, I found handy HashTab 3rd party tool. It shows MD5, SHA-1 check sums in one of file properties tabs. http://implbits.com/products/hashtab/

Solution 8 - Windows

7-Zip can be used to generate hashes for files, folders of files, and trees of folders of files. 7-Zip is small footprint and a very useful compression utility. http://7-zip.org/

Solution 9 - Windows

To calculate md5 of all the files in the current directory in windows 7

for %i in (*) DO CertUtil -hashfile %i MD5

Solution 10 - Windows

Download fciv.exe directly from http://www.microsoft.com/en-us/download/confirmation.aspx?id=11533

shell> fciv.exe [yourfile]

will give you md5 by default.

You can read up the help file fciv.exe -h

Solution 11 - Windows

Just to add another option for Windows users, the Get-FileHash PowerShell cmdlet can be used (https://technet.microsoft.com/en-us/library/dn520872.aspx).

Example usage: Get-FileHash MyImage.iso -Algorithm MD5

If all you're after is just the raw hash then: (Get-FileHash MyImage.iso -Algorithm MD5).Hash

Solution 12 - Windows

Solution 13 - Windows

Best utility for Windows is HashCheck that is now on GitHub. https://github.com/gurnec/HashCheck/releases/tag/v2.4.0

Install HashCheck. Now right click on the file -> Create verification file. It will create a file.extension.md5 file with MD5 code in it.

Love it.

Solution 14 - Windows

Note that the above solutions will not tell you if your installation is correct only if your install.exe is correct (you can trust it to produce a correct install.)

You would need MD5 sums for each file/folder to test if the installed code has been messed with after the install completed.

WinMerg is useful to compare two installs (on two different machines perhaps) to see if one has been changed or why one is broken.

Solution 15 - Windows

for sure the certutil is the best approach but there's a chance to hit windows xp/2003 machine without certutil command.There makecab command can be used which has its own hash algorithm - here the fileinf.bat which will output some info about the file including the checksum.

Solution 16 - Windows

Hashing is a standalone application that performs MD5, SHA-1 and SHA-2 family. Built upon OpenSSL.

Solution 17 - Windows

I like to use HashMyFiles for windows.

Solution 18 - Windows

QuickHash an open source tool supporting MD5, SHA1, SHA256, SHA512 and available for the Linux, Windows, and Apple Mac.

https://sourceforge.net/projects/quickhash/

Solution 19 - Windows

In HPUX ( hp UNIX)

Please install the md5sum package on your UNIX machine for example, if there is a file called a.txt

shell > md5sum a.txt

Solution 20 - Windows

Just use win32 Checksum api. MD5 is native in Win32.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBialeckiView Question on Stackoverflow
Solution 1 - WindowsLaisvis LingveviciusView Answer on Stackoverflow
Solution 2 - WindowsZach ScrivenaView Answer on Stackoverflow
Solution 3 - WindowsNick BerardiView Answer on Stackoverflow
Solution 4 - WindowssandyiitView Answer on Stackoverflow
Solution 5 - WindowsSqeakyView Answer on Stackoverflow
Solution 6 - WindowstonyzView Answer on Stackoverflow
Solution 7 - WindowsjabalvView Answer on Stackoverflow
Solution 8 - WindowsgridtrakView Answer on Stackoverflow
Solution 9 - WindowsAbeyView Answer on Stackoverflow
Solution 10 - WindowsyantaqView Answer on Stackoverflow
Solution 11 - WindowsKosta TenediosView Answer on Stackoverflow
Solution 12 - WindowsVale TrujilloView Answer on Stackoverflow
Solution 13 - WindowsdjibeView Answer on Stackoverflow
Solution 14 - WindowsChris NavaView Answer on Stackoverflow
Solution 15 - WindowsnpocmakaView Answer on Stackoverflow
Solution 16 - WindowsLeloView Answer on Stackoverflow
Solution 17 - WindowsdesbestView Answer on Stackoverflow
Solution 18 - WindowsharryssupermanView Answer on Stackoverflow
Solution 19 - WindowsRnsthotaView Answer on Stackoverflow
Solution 20 - WindowskiloView Answer on Stackoverflow