804

Is there a built-in checksum/hash utility on Windows 7?

chicks
  • 556
  • 4
  • 14
user64996
  • 8,397
  • 4
  • 19
  • 16
  • Not my area, but Powershell, the build in scripting language, can probably do it. – Phoshi Feb 14 '11 at 19:03
  • 19
    Is this one of those goofy "I'm not allowed to install *any* 3rd party software" requirements? If so, try googling for "PowerShell SHA1 hash" and you should get some scripts/cmdlets that will run on the built-in PowerShell using MS's Crypto APIs. – afrazier Feb 14 '11 at 19:14
  • I am positive I once installed a windows-explorer sfv checker that displayed overlay green check arrows icons, (like tortoise svn do) when it checked a match against a .sfv file named the same than the checked file. however can't find it anymore. – v.oddou Jul 14 '14 at 07:11
  • 10
    There is GetFile-Hash. You need PS 4.0 or community extensions http://stackoverflow.com/questions/10521061/how-to-get-an-md5-checksum-in-powershell – rofrol Nov 26 '14 at 11:02
  • 2
    Avast anti virus is blocking downloads from the above site for me, so may be worth approaching with caution. – Jules Dec 17 '14 at 16:11
  • https://support.microsoft.com/en-us/kb/889768 – balki Jun 18 '15 at 18:05
  • 13
    Note, the best answer (for me) is the 2nd answer, which has many more votes than the answer chosen by the asker. To the reader: look below, for the "certutil.exe" option. – macetw Jan 08 '16 at 19:09
  • @afrazier I'm coming to this a lot later but the reason why someone might be looking for a built in hash is that if Windows has already calculated one as part of the file system housekeeping then I can check if 2 files are identical without reading all the data. – JamesRyan Aug 07 '20 at 13:41

31 Answers31

1375

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 PowerShell magic:

$(CertUtil -hashfile C:\TEMP\MyDataFile.img MD5)[1] -replace " ",""
Cristian Ciupitu
  • 5,513
  • 2
  • 37
  • 47
tedr2
  • 13,751
  • 2
  • 10
  • 2
  • 21
    MD5.bat: @certutil -hashfile %1 MD5|find /v "hash of file"|find /v "CertUtil" – pbarney Nov 16 '15 at 15:37
  • 8
    Please note that `certutil` is **not available in Windows PE**, so if you are trying to calculate a checksum in a pre-deployment task script in PE, you will have to use an external tool like **Microsoft FCIV**. – Wayfarer May 19 '16 at 08:14
  • 4
    That's incredible, but `CertUtil -hashfile C:\TEMP\MyDataFile.img MD5` does not produce the same hash than `md5sum /tmp/MyDataFile.img` under Linux (I guarranty it is the same file with a mount) – lalebarde Aug 16 '16 at 09:22
  • 1
    `certutil` produces the same hash that the "GNU on Windows" version of `md5sum` does. – JamesGecko Aug 18 '16 at 03:15
  • 17
    @lalebarde There is only one standard for MD5. If you are getting different results on the same file, it is because something is making some change to that file and causing the hashes to be different. This is one of the most important functions of MD5 and other hashing standards. – Paul Oct 19 '16 at 16:27
  • Which versions of Windows is it included with by default? – mwfearnley Jan 17 '17 at 16:10
  • 3
    It seems that in older versions of Windows, CertUtil may exist, but `-hashfile` may not support different hash algorithms, producing only a SHA-1 sum. – mwfearnley Feb 03 '17 at 22:57
  • Where can I find the list of available hash-algorithms? I tried `certutil -hashfile -?` but did not get the list of options. The [website](https://technet.microsoft.com/en-us/library/cc732443(v=ws.11).aspx#BKMK_hashfile) does not have it as well. – Ravindra HV Mar 30 '17 at 20:00
  • 3
    From the edit logs, this answer was replicated from [SO](http://stackoverflow.com/questions/478722/what-is-the-best-way-to-calculate-a-checksum-for-a-file-that-is-on-my-machine). – Ravindra HV Mar 30 '17 at 20:17
  • When using certutil I'm gettin a different MD5 and SH1 hash than what is expected when downloaded tomcat: it generates this: fd fe 6d 02 b5 4c d1 c2 11 4a 8b 31 38 52 a0 96 http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.6/bin/apache-tomcat-8.5.6.zip 7dfefe03154b5c852d5163d60a179e3d *apache-tomcat-8.5.6.zip Why the difference? I don't think it's a MIM attack (Man in The Middle) – atom88 May 26 '17 at 17:59
  • 5
    @mwfearnley, it looks like `SHA1` is the default when the hash algorithm parameter is left unspecified, and that, when specified, the hash algorithm parameter is case-sensitive. So, I first tried `certutil -hashfile ... sha1` and it failed. Then I left the `...sha1` off, and it worked. Then I retried with `...SHA1` and that worked. (And I repeated the test for md5/MD5.) – JMD Jan 22 '18 at 18:44
  • 3
    Strangely, I get error 0xd0000225 for non-existent algorithms (e.g. `MD3`), but 0xd00000bb if the algorithm exists but the case is wrong (e.g. `md5`, `sHa1`) – mwfearnley Jan 23 '18 at 17:17
  • It's also worth noting that if FIPS 140 certified algorithms are required on the system by Local Security Policy or Group Policy, the older algorithms and/or libraries that haven't gone through FIPS certification will produce an error if attempted to be used (e.g. MD5) – thepip3r Nov 28 '18 at 22:18
  • 3
    How is this not the accepted answer? The question specifically asks for a built-in utility – Adeel Ahmad Dec 16 '18 at 09:13
  • 3
    @pbarney I think you mean `findstr` rather than `find`? This batch file outputs just the bare hash for me... `@certutil -hashfile %1 MD5|findstr /v "hash of file"|findstr /v "CertUtil"` – bigjosh Dec 29 '18 at 18:17
  • CertUtil is great, but without this post I could not do a SHA256 checksum. Unlike other DOS commands, /? does NOT give full usage info. Also, the commands are CASE sensitive. Keyword sha256 does not work – Roland Nov 11 '21 at 11:10
  • I had to set the protocol to sha256 to match – user119591 Jul 18 '23 at 12:56
233

There is a built in utility, as specified in this other answer.

You may, however, wish to use this freeware app called HashTab that integrates neatly with Windows Explorer by registering a... well, a tab in the properties dialog of files. It's pretty sweet.

HashTab screenshot

wjandrea
  • 595
  • 8
  • 19
Tobias Plutat
  • 5,535
  • 1
  • 24
  • 19
  • 99
    I prefer [HashCheck](http://code.kliu.org/hashcheck/) over HashTab, primarily because it can handle multiple mixed file/folder selections and it can create/verify SFV/MD5/SHA1 files. [My writeup](http://arstechnica.com/civis/viewtopic.php?f=15&t=33861&p=891309#p891309) over at the Ars Forums goes into more detail. – afrazier Feb 14 '11 at 21:51
  • 53
    Be aware HashTab is only free for private use! HashCheck is open source and complete free (BSD license) – keiki Oct 22 '12 at 14:08
  • 2
    Also HashCheck is 85kB, awesome. – v.oddou Jul 14 '14 at 07:14
  • 3
    HashTab and HashCheck are great tools. Too bad that neither supports SHA-256. –  Oct 29 '14 at 18:53
  • 1
    @JustinY HashTab supports SHA-256 since version 4 if I remember well. Just click the 'Settings' option above the Hash Comparison text field :) – Kounavi Apr 22 '15 at 22:44
  • 36
    yes, there is a cmd: CertUtil -hashfile _main.exe MD5 – Scott混合理论 Jul 16 '15 at 08:53
  • I'll also note that HashCheck raises alerts with Norton Anti-Virus – BIBD Feb 03 '16 at 17:12
  • 2
    Thanks, and yes, HashTab seems to be providing more functionalities, such as larger array of hashes ... but, man, **I hate** download sites that require you to provide your email to get a link! You know that an avalanche of spam is right then on its way... – c00000fd Apr 22 '16 at 02:56
  • No folder / DVD hashing capability in HashTab! – lukyer Jul 26 '16 at 20:11
  • 4
    A maintained version of [HashCheck](https://github.com/gurnec/HashCheck) also supports SHA-256 and even SHA-512. – domenix Sep 19 '16 at 08:57
  • FYI, hash algorithm string is case sensitive. Don't headdesk. – Keith Tyler May 26 '17 at 22:01
  • 23
    "There is a built-in utility which does exactly what you need. You may, however, use this other tool which does something which you didn't ask for." Why is this the accepted answer? – abaumg Jun 27 '17 at 12:36
  • 11
    > "Thanks. Unfortunately being built-in was an essential requirement for me." Then why did you select a non-built in software, which the question doesn't ask for, as the answer? – KalEl Sep 10 '17 at 20:14
  • i've used it in the past and the user experience is nice -- but if i can't download over https (secured by a trusted cert) then what's the point? – RubyTuesdayDONO Jul 21 '18 at 18:29
  • I love the way HashTab works. Unfortunately, it doesn't support SHA256 which I need for my Kubuntu image. – Vince Sep 04 '20 at 04:20
  • This and other tools produce pretty much the same result, just mind the uppercase especially if you're comparing hashes on code. – Oscar Nevarez Jun 16 '21 at 17:27
  • @Vince You can make it show SHA256 by right-clicking on the list of hashes and selecting "Settings". – Inkling Dec 26 '21 at 22:47
  • The Hastab link in the answer today goes to a website which says "HashTab was discontinued in early 2022." So I guess it is dead. There are other good alternatives listed in other answers. – StayOnTarget Jan 18 '23 at 21:29
200

I'm using HashCheck (latest version) which integrates itself as a property page for files and includes a context menu to compare against hash check files (SFV).

It is free, and the source is available.

Screenshot

Qtax
  • 448
  • 7
  • 15
Andrew Moore
  • 4,805
  • 3
  • 26
  • 22
  • 1
    this one is very nice , i tested it on 1GB file and its faster then Summer Properties. – Karim Jul 03 '10 at 22:45
  • 3
    Hilarious app. Definitely the best. It can check the hash with a doubleclick on the created file.MD5! And it remembers what files were hashed. – Pavel Radzivilovsky Dec 23 '10 at 14:26
  • 2
    AVG is flagging `REGSVR32.EXE` as a virus threat after installation – Mike Pennington May 28 '12 at 19:44
  • @MikePennington: In other words, AVG is flagging a core Windows utility as malicious. Nice! – Andrew Moore May 28 '12 at 20:40
  • 7
    AVG is flagging that the core Windows Utility has been changed - that is the sort of thing that malicious software often does. – dunxd Nov 20 '12 at 10:15
  • 12
    Free, open source, integrates with property page and explorer context menu, has an .MD5 checker and supports SHA-1. Not to mention it's just 85kb and runs _really_ fast. This application is **absurdly great**, thank you! – Şafak Gür Feb 26 '14 at 09:59
  • 4
    and you can install it via chocolatey! – Michael Caron Jul 07 '16 at 15:04
  • 4
    @Sossenbinder You must have been looking in the wrong place. SHA-256 has been supported since Dec. '14. The tool was being updated until at least Sep '16 so while it may not be active lately perhaps there's not much to add to it. https://github.com/gurnec/HashCheck/releases – B Layer Dec 27 '17 at 17:10
  • i've used it in the past and the user experience is nice -- but if i can't download over https (secured by a trusted cert) then what's the point? – RubyTuesdayDONO Jul 21 '18 at 18:29
  • Note that HashCheck doesn't do SHA256. 7-Zip is an easier solution if you need this. – EML May 29 '19 at 10:00
  • 4
    I know this is really old, but how did you answer the question more than a year before it was asked? – Baruch Aug 07 '19 at 11:46
  • @AndrewMoore Both links you provided lead to different installers (HashCheckSetup-2.4 and HashCheckInstall-2.1), are they the same? – golimar Dec 13 '19 at 11:05
  • If someone is looking for a maintained alternative, see **[OpenHashTab](https://superuser.com/a/1710347/89979)**. – Qtax Mar 17 '22 at 11:28
  • HashCheck doesn't handle long paths properly (> MAX_PATH i.e. 260 symbols). – this Oct 25 '22 at 10:37
97

PowerShell version 4 and up includes the Get-FileHash cmdlet.

powershell get-filehash -algorithm md5 <file_to_check>

Use doskey to make a persistent alias that's easier to remember.

doskey sha1sum=powershell get-filehash -algorithm sha1 "$1"
doskey md5sum=powershell get-filehash -algorithm md5 "$1"
Christian Long
  • 1,741
  • 16
  • 9
  • 1
    By adding Format-List to show the full output if the hash result string is too long `powershell Get-FileHash -Algorithm md5 | Format-List` – celeron533 Jul 31 '17 at 14:25
  • Finally it comes to PowerShell! – Franklin Yu Jan 24 '18 at 17:16
  • Brilliant question and answers. Thanks for all of this. I'd recommend another software, but this is pretty complete. Can't thank you contributors enough for this thread. Excuse me... May I ask why PowerShell on Win 8.1 and 10 won't recognize `Get-FileHash "C:\foo.exe" -Algorithm MD5,SHA1,SHA256 | Format-List` natively to list several hashes in a row? There's no such instruction stored in the console? I tried to reformulate several times with the correct syntax, but it returns me an error and it doesn't seem to work without embedding a script. – K0media Feb 14 '18 at 17:08
  • 1
    This needs more attention as this is built-in unlike many of the other options including the accepted answer. – flickerfly Dec 10 '19 at 16:09
87

There is the FCIV utility from Microsoft, the Microsoft File Checksum Integrity Verifier (download link).

The Microsoft File Checksum Integrity Verifier tool is an unsupported command line utility that computes MD5 or SHA1 cryptographic hashes for files.

It doesn't show Windows 7 in system requirements but I've just used it in Windows 8 and it worked.

User5910
  • 536
  • 1
  • 4
  • 19
creator
  • 1,011
  • 7
  • 3
  • Why are we linking to a unsupported command line utility. This doesn't even intergrate into the shell which I am sure the author wanted. – Ramhound Sep 05 '12 at 12:36
  • 31
    That utility was useful for me. I downloaded an iso image from msdn and needed to cheksum it. I didn't want any third party tools. I didn't need the shell integration and the author didn't ask for it. It's from a trusted source Microsoft and while unsupported it still works. I posted a link here because other people like me may find it useful. – creator Sep 06 '12 at 04:25
  • 30
    I'm with @creator. It may not be supported software, but at least Microsoft is the author. Checksum programs are potentially really important to maintaining security; I'd rather not get mine from some random third-party. – ellisbben Sep 18 '12 at 18:00
  • 3
    While it's an OKish utility for moderate use, it's unstable. I'm using it in a xdelta script to determine if files of same size are different and I'm sorry to say I get about 1 crash every a few hundred files. It's unreliable, so an advice: use something else. – JasonXA Mar 05 '17 at 17:58
  • [PsFCIV](https://gallery.technet.microsoft.com/PowerShell-File-Checksum-e57dcd67) is PowerShell rewrite that supports the original's XML database functionality plus SHA-256, SHA-384 and, and SHA-512 hashes. – User5910 Sep 07 '17 at 23:29
  • 2
    FCIV hasn't been installed on any Windows system I've wanted to use it on, but certUtil was always there. I wish FCIV wasn't a top search result when I forget the name of the tool to use. I also wish this feature was just built in to the file properties dialog and browser download managers. – jla Apr 05 '19 at 16:31
51

The new version of 7-Zip also gives you the option of checksums just by right clicking (this doesn't include MD5). It has SHA-1, SHA-256, CRC-32, CRC-64, etc.

Enter image description here.


For MD5 you can download HashTab and check by right clicking and then properties.

Enter image description here

Joakim Elofsson
  • 2,241
  • 2
  • 18
  • 20
abe312
  • 637
  • 5
  • 5
24

Here's one I've used before that integrates nicely with Explorer's "Properties" dialog: Summer Properties. It's open source, and an x64 version is also available.

SummerProperties screen shot

I also like Safer Networking's FileAlyzer, which provides additional features as well. But just for checksums, Summer Properties is lightweight and does the job.

Gaff
  • 18,569
  • 15
  • 57
  • 68
Chris W. Rea
  • 10,740
  • 16
  • 76
  • 95
  • 1
    The only problem with this is that it does not support folders or groups of files. It is also out of dvlp – Pavel Radzivilovsky Dec 23 '10 at 12:47
  • 1
    Another problem with it is that you can't paste an hash into it and see if it matches – Jonathan Mar 23 '11 at 16:33
  • I know this is really old, but how did you answer the question more than a year before it was asked? – Baruch Aug 07 '19 at 11:46
  • @Baruch If you look at the [question's edit history](https://superuser.com/posts/245775/revisions) you'll see that, in May 2015, another similar question (but older) had its answers merged into this one. I'm not sure why the newer question was the one chosen to survive, but that's why it looks odd. Here's the [original older question](https://superuser.com/questions/89191/looking-for-md5-utility-that-integrates-to-windows). – Chris W. Rea Aug 07 '19 at 21:38
16

I am adding this here only because I didn't see any fully working powershell examples, ready for copy-paste:

C:\> powershell "Get-FileHash %systemroot%\system32\csrss.exe"

Algorithm       Hash
---------       ----
SHA256          CB41E9D0E8107AA9337DBD1C56F22461131AD0952A2472B4477E2649D16E...

C:\> powershell -c "(Get-FileHash -a MD5 '%systemroot%\system32\csrss.exe').Hash"

B2D3F07F5E8A13AF988A8B3C0A800880

C:\> CertUtil -hashfile "%systemroot%\system32\csrss.exe" MD5 | findstr -v file
b2 d3 f0 7f 5e 8a 13 af 98 8a 8b 3c 0a 80 08 80

C:\>

2019 Update:

The certutil output seems to have changed since Windows 8, so my old filter to isolate the hash doesn't work anymore. The extraneous spaces are gone too - one less thing to worry about when scripting. Here is the new copy-paste-able demo:

C:\>CertUtil -hashfile "%systemroot%\system32\csrss.exe" | findstr -v ash
0300c7833bfba831b67f9291097655cb162263fd

C:\>CertUtil -hashfile  "%systemroot%\system32\csrss.exe" SHA256 | findstr -v :
a37d616f86ae31c189a05b695571732073b9df97bf5a5c7a8ba73977ead3e65b

C:\>ver

Microsoft Windows [Version 10.0.16299.1451]

C:\>

To make this more resilient against breakage from yet another future change in certutil, we should look for lines with non-hex characters to filter out: [^0-9a-zA-Z]. That should also make it safer for other locales and languages.

C:\>CertUtil -hashfile  "C:\windows\fonts\arial.ttf" | findstr -vrc:"[^0123-9aAb-Cd-EfF ]"
12c542ef8c99cf3895ad069d31843a5210857fdc

Why is that actual anti-hex regex so weird ? See this question to learn how regex ranges in findstr don't work as they should. I included an extra space character for backward-compatibility with older certutil versions, but it is optional.

Note that the powershell Get-FileHash default is SHA256, while certutil still defaults to SHA1. So specify your algorithm explicitly where needed. You can quickly check the available options like this:

C:\>powershell -c "Get-FileHash -?" | findstr gori

    Get-FileHash [-Path] <string[]> [-Algorithm {SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160}]
    Get-FileHash -LiteralPath <string[]> [-Algorithm {SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 |
    Get-FileHash -InputStream <Stream> [-Algorithm {SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160}]

C:\>certutil -hashfile -v /? | findstr gori

  CertUtil [Options] -hashfile InFile [HashAlgorithm]
Hash algorithms: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512
Amit Naidu
  • 549
  • 7
  • 10
16

Nirsoft's HashMyFiles is small utility that allows you to calculate the MD5 and SHA1 hashes of one or more files in your system. You can easily copy the MD5/SHA1 hashes list into the clipboard, or save them into text/html/xml file.

HashMyFiles can also be launched from the context menu of Windows Explorer, and display the MD5/SHA1 hashes of the selected file or folder.

alt text

HashMyFiles is freeware and portable.

Gaff
  • 18,569
  • 15
  • 57
  • 68
  • +1, Seems like a new one -- the last time I checked (before moving to a command line **md5sum** version) was FastSum -- but, it was sort-of trialware and nagged a lot. **HashMyFiles** is good because it allows drag-and-drop of multiple files and export to CSV (both important features). Don't think I had seen it when I found FastSum a couple of years back. – nik Dec 30 '09 at 02:15
  • that's right, HashMyFiles is a fairly recent addition to NirSoft's portfolio, it was first released in 2007. –  Dec 30 '09 at 09:05
  • *`…that integrates into Windows [Explorer]`* – Synetech Dec 19 '13 at 05:10
  • And very small size! – Peter T. Feb 08 '19 at 22:34
14

I found this PowerShell script:

param([switch]$csv, [switch]$recurse)

[Reflection.Assembly]::LoadWithPartialName("System.Security") | out-null
$sha1 = new-Object System.Security.Cryptography.SHA1Managed
$pathLength = (get-location).Path.Length + 1

$args | %{
    if ($recurse) {
        $files = get-childitem -recurse -include $_
    }
    else {
        $files = get-childitem -include $_
    }

    if ($files.Count -gt 0) {
        $files | %{
            $filename = $_.FullName
            $filenameDisplay = $filename.Substring($pathLength)

            if ($csv) {
                write-host -NoNewLine ($filenameDisplay + ",")
            } else {
                write-host $filenameDisplay
            }

            $file = [System.IO.File]::Open($filename, "open", "read")
            $sha1.ComputeHash($file) | %{
                write-host -NoNewLine $_.ToString("x2")
            }
            $file.Dispose()

            write-host
            if ($csv -eq $false) {
                write-host
            }
        }
    }
}

Source: Calculating SHA1 in PowerShell

It leverages .NET which I assume you have installed

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
bquaresma
  • 526
  • 2
  • 6
  • 7
    Win 7 comes with .NET 3.5 and PowerShell v2, and PowerShell has always been dependent on .NET, so if you've got PS, you've got .NET. :-) – afrazier Feb 14 '11 at 21:47
8

A batch file based on pbarney's comment to the answer with the most upvotes: This copies the MD5 hash of whatever file is dragged onto the batch file to the clipboard:

@ECHO OFF
FOR /f "tokens=*" %%i IN ('@certutil -hashfile %1 MD5 ^| find /v "hash of file" ^| find /v "CertUtil"') DO SET r=%%i
SET r=%r: =%
ECHO %r% | clip

To make it a context menu item instead:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Get MD5]
@="Copy MD5 to Clipboard"

[HKEY_CLASSES_ROOT\*\shell\Get MD5\command]
@="\"C:\\<PATH TO BAT FILE>\\getMD5.bat\" \"%1\""
Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
trapper_hag
  • 226
  • 2
  • 3
  • Or if you don't mind the extra output, a one liner batch file `certutil -hashfile %1 md5` works as well – jrh Aug 20 '18 at 14:21
8

Microsoft File Checksum Integrity Verifier. It can compute MD5 and SHA-1 hash values.

Download, extract the files, then open a command prompt, go to the extracted path and then type the following command:

fciv -md5 filepath\filename.extension

For example:

fciv -md5 d:\programs\setup.exe
Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
David
  • 105
  • 1
  • 1
  • This answer and @creator's answer should be combined. They refer to the same tool. – leif81 Jun 11 '14 at 13:36
  • Question Title : Is there a **built-in** checksum/hash utility on Windows 7? `'fciv' is not recognized as an internal or external command, operable program or batch file.` Microsoft Windows [Version 10.0.14393] – Amit Naidu Jul 09 '18 at 19:24
7

Unfortunately, not that I'm aware of, but Microsoft's Sysinternals suite includes a nice tool called sigcheck.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
eug
  • 874
  • 8
  • 12
4

This is just a cmd shell script which uses tedr2's answer but strips off the extraneous output lines and spaces:

:: hash.cmd : Get a hash of a file
:: p1: file to be hashed
:: p2: Hash algorithm in UPPERCASE
:: p3: Output file

@setlocal
@for /f "tokens=*" %%a in (
'@certutil -hashfile %1 %2 ^|find /v "hash of file" ^|find /v "CertUtil"'
) do @(
  @set str=%%a
)
@set str=%str: =%
@echo %str%
@endlocal

The output can be re-directed to a file if required:

@echo %str% > %3

e.g.

sys> \dev\cmd\hash.cmd MyApp.dll SHA1
8ae6ac1e90ccee52cee5c8bf5c2445d6a92c0d4f
Jool
  • 256
  • 1
  • 5
4

Cygwin contains an md5sum.exe utility that should do what you want.

Nicole Hamilton
  • 9,935
  • 1
  • 21
  • 43
  • 2
    Unfortunately being command line based, it doesn't integrate with the Windows Shell. – Cristian Ciupitu May 21 '14 at 19:38
  • Cristian Ciupitu just cause you don't know how to do it it doesn't mean it can't be done. I'm using lots of CLI apps from Windows Shell desktop / folder background and typed apps context menu and they work fine. – JasonXA Mar 05 '17 at 18:01
  • 2
    Cygwin is massively overkill. There are many native binaries that do the job, most of them under 200k. – sCiphre Jul 28 '17 at 12:48
  • There is nothing "massively overkill" about Cygwin. The setup utility lets you check off and download only just exactly what you need and nothing more. If all you select is md5sum, that's all you get. – Nicole Hamilton Jul 29 '17 at 14:10
4

QuickHash supports SHA-256 and SHA-512. I needed SHA-256 support to verify the checksum of whitelisted JavaScript libraries for inclusion in a Firefox addon.

  • Updated link: http://sourceforge.net/projects/quickhash/?source=directory (side note: [JetBrains](https://www.jetbrains.com/) currently uses SHA-256 for their checksums too.) – Troy Gizzi Mar 30 '15 at 13:56
  • Thanks, this was the easiest and the fastest. – insign Dec 24 '20 at 18:07
4

MD5 Context Menu does exactly this. It adds an MD5 option to the context menu of files:

Enter image description here

Alt text

MD5 Context Menu is a freeware shell extension for Windows which displays the MD5 hash sum of the selected file.

It says it's compatible with Windows 95, 98, ME, NT, 2000, and XP, although it works for me perfectly fine on Windows 7. It's a tiny download (238 KB) and includes everything you need.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
John T
  • 163,373
  • 27
  • 341
  • 348
  • 3
    "Because of a serious bug in the last version of our tool for large files with sizes > 2^31 bytes (~2.1GB) we currently do not provide the download anymore." – Taha Jahangir Oct 11 '13 at 04:35
2

1. checksum

I use checksum command-line utility.

Usage:

checksum [-t=sha1|sha256|sha512|md5] [-c=signature] [-f=]filepath


2. Command-line arguments

  • -?, --help, -h
    Prints out the options.
  • -f, --file=VALUE
    Filename.
  • -t, --type, --hashtype=VALUE
    Hashtype Defaults to md5.
  • -c, --check=VALUE
    Optional: check - the signature you want to check. Not case sensitive.

3. Examples of usage

# Check md5 for "E:\Саша Неотразима\Sasha-Irresistible.exe" file
SashaChernykh@DESKTOP-0G54NVG E:\Саша Неотразима
$ checksum -f "E:\Саша Неотразима\Sasha-Irresistible.exe"
342B45537C9F472B93A4A0C5997A6F52
# Check sha256
SashaChernykh@DESKTOP-0G54NVG E:\Саша Неотразима
$ checksum -f "E:\Саша Неотразима\Sasha-Irresistible.exe" -t=sha256
F6286F50925C6CBF6CBDC7B9582BFF833D0808C04283DE98062404A359E2ECC4
# Correct 41474147414741474147 sha256 hash or not?
SashaChernykh@DESKTOP-0G54NVG E:\Саша Неотразима
$ checksum -f "E:\Саша Неотразима\Sasha-Irresistible.exe" -t=sha256 -c 41474147414741474147
Error - hashes do not match. Actual value was 'F6286F50925C6CBF6CBDC7B9582BFF833D0808C04283DE98062404A359E2ECC4'
# One more attempt
SashaChernykh@DESKTOP-0G54NVG E:\Саша Неотразима
$ checksum -f "E:\Саша Неотразима\Sasha-Irresistible.exe" -t=sha256 -c F6286F50925C6CBF6CBDC7B9582BFF833D0808C04283DE98062404A359E2ECC4
Hashes match..
2

The correct answer is of course, yes, CertUtil (see tedr2's answer).

But I'll add Penteract's free File Checksum Verifier which, I think, is one of the most user-friendly programs. (Disclaimer: I'm affiliated with Penteract.)

Some of its advantages:

  • Compares the calculated and expected hashes for you.
  • Minimalistic - no item in files' context-menus, no extra tab on files' properties.

To verify this program's integrity (against man-in-the-middle attacks) - it downloads over a secure connection.

Penteract File Checksum Verifier

Plus: free, offline (so you don't have to upload your files), user-friendly (drag a file in and get the result), launches from the start menu (no need to look for the downloaded executable when you want to use it a year from now), and supports MD5, SHA1, SHA256, etc.

User42
  • 210
  • 1
  • 6
  • 1
    Thank you for disclosing your affiliation. However, please avoid making too many posts of this kind, as doing so may be considered spamming. For more information about promotional posts, please see http://superuser.com/help/promotion. – bwDraco Aug 31 '15 at 23:56
  • 1
    This only works on Windows 10 and the op specifically asked about W7. – Jool Sep 02 '17 at 12:34
  • Worked fine for me on Windows 10. Thank you. – insign Dec 24 '20 at 18:09
1

This is not a built-in utility, but its a very good option

http://checksumcompare.sanktuaire.com

You could compare checksum by file and/or summaries if two folders differ or are identical.

1

You can try msys2, it is here.

Just type (algorithm)sum. (algorithm) is the hash algorithm you want to use e.g. md5, sha1, sha256 ...

Unlike Cygwin, this tool is portable, you just to download the .zip file and extract in anywhere you want. You can use it by a simple click(msys2.exe).

Hop this tool will help you.

pah8J
  • 755
  • 1
  • 6
  • 14
1

OpenHashTab is open source, integrates with Explorer, and is actively developed.

It's a good alternative to HashCheck, as that one isn't maintained any more (for over 6 years).

OpenHashTab 3.0 file properties tab

Settings

Qtax
  • 448
  • 7
  • 15
1

You can use MD5sums for Windows, a download of only 28 KB (Cygwin might be overkill if all you want to do is compute MD5 hashes).

The easiest way to use it is to use Explorer to drag and drop files on md5sums.exe to obtain their MD5 hashes.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
Josh
  • 433
  • 1
  • 4
  • 12
1

Something like this: winmd5sum.
This one's also nice: sendtoMD5 - right click, send to ..., and it gets you the result.

Rook
  • 23,617
  • 32
  • 128
  • 213
1

HashTab 3.0 is a free shell extension that calculates many checksums, including MD5. It's integrated as a new tab in the File Properties.

studiohack
  • 13,468
  • 19
  • 88
  • 118
Snark
  • 32,299
  • 7
  • 87
  • 97
0

If you don't have time to check output from certutil character by character <hash size> number of times, pipe to find utility to see if checksum matches:

certutil -hashfile ekaf_elbatuc.exe sha256 | find "<checksum>" && echo File ok. || echo Some mole or rat waz hia

But then what's the point of getting hash from same server as the file itself?

Tested on Win 10 CMD

Zimba
  • 1,051
  • 11
  • 15
0

This is how I calculate checksums from Explorer using no third-party software.

On Windows 10 (and probably previous versions) follow these steps:

Using explorer, open the "Send To" folder by typing this into the address bar

shell:sendto

Create a batch file in this folder called something like Calculate SHA1 and MD5.cmd

and add this text

@echo off
certUtil -hashfile %1 SHA1
certUtil -hashfile %1 MD5
pause

You will now be able to calculate SHA1 and MD5 checksums for any file from Explorer, just by right-clicking a file and choosing send to Calculate SHA1 and MD5.cmd

Off course, you can change the name of the above file and choose to add other checksums, or even create multiple files each with a different type of hash.

I have another batch file called Calculate SHA256.cmd, which I prefer to use independently (you wouldn't want to calculate every type of hash from one batch file as this would take too long for very big files).

enter image description here

Some more notes

Just to make the output a little less cluttered, I prefer to pipe the output through findstr.

certUtil -hashfile %1 SHA256 | findstr ^1

The pause instruction at the end of the batch file is essential, otherwise the window will disappear immediately.

DAB
  • 131
  • 5
-1

There are like 100 third-party tools out there. I use MD5Hash. For downloads with sfv files, just use TeraCopy to verify the hashes.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
surfasb
  • 22,452
  • 5
  • 52
  • 77
-1

Well, I have made a program to calculate some hashes from a file. I hope it helps you.

What does this do? It calculates the SHA-1 hash, SHA-384 hash, MD5 hash and SHA-256 hash. Well, that's about it :)

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
-2

For a solution that works on Windows or just about any other environment, use Python.

  1. install Python -- a Windows installer is provided on https://www.python.org/downloads/

  2. download a tested cksum implementation, e.g. http://pastebin.com/raw.php?i=cKATyGLb -- save the contents of this to say, c:\cksum.py or wherever you find convenient

Then to perform a checksum:

python c:\cksum.py INPUTFILE

Not as fast as a compiled utility, but compatible with Unix cksum and runs anywhere.

Christian
  • 7,102
  • 1
  • 22
  • 36
-3

I like digestIT, although it seems to be fairly old and maybe not maintained.