windows 为我机器上的文件计算校验和的最佳方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/478722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:58:40  来源:igfitidea点击:

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

windowschecksum

提问by Bialecki

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 机器上,我想在我刚得到的 MySQL 发行版上运行校验和。看起来有要下载的产品、不受支持的 Microsoft 工具,以及可能还有其他选项。我想知道是否对使用的最佳工具达成了共识。这可能是一个非常简单的问题,我以前从未运行过校验和例程。

采纳答案by Nick Berardi

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

任何 MD5 都会产生一个很好的校验和来验证文件。此页面底部列出的任何文件都可以正常工作。 http://en.wikipedia.org/wiki/Md5sum

回答by Laisvis Lingvevicius

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

CERTUTIL是预装Windows实用程序,可用于生成散列校验:

CertUtil -hashfile pathToFileToCheck [HashAlgorithm]

HashAlgorithmchoices: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

HashAlgorithm选择: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

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

因此,例如,以下内容为文件生成 MD5 校验和C:\TEMP\MyDataFile.img

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

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

要获得类似于 *Nix 系统的输出,您可以添加一些 PS 魔法:

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

回答by Zach Scrivena

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

我个人使用Cygwin,它使 Linux 实用程序的整个 sm?rg?sbord 触手可及 --- OpenSSLmd5sum支持的所有加密摘要。或者,您也可以使用OpenSSL的Windows 发行版(“轻量级”版本只有 1 MB 的安装程序)。

回答by sandyiit

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

在 Windows 上:您可以使用 FCIV 实用程序:http: //support.microsoft.com/kb/841290

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

在 Unix/Linux 上:您可以使用 md5sum:http: //linux.about.com/library/cmd/blcmdl1_md5sum.htm

回答by Sqeaky

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

校验和选项卡: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.

一段时间以来,这对我在 Windows 上很有用。它允许轻松复制和粘贴校验和。它有一个框来输入/粘贴来自网页的校验和,并很好地显示匹配或不匹配。

回答by tonyz

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

在 MySQL.com 上,MD5 列在您​​可以下载的每个文件旁边。例如,MySQL“Windows Essentials”5.1 是528c89c37b3a6f0bd34480000a56c372

You can downloadmd5 (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.

您可以下载md5 (md5.exe),这是一个命令行工具,可以计算您本地拥有的任何文件的 MD5。MD5 就像任何其他加密散列函数一样,这意味着给定的字节数组将始终产生相同的散列。这意味着如果您下载的 MySQL zip 文件(或其他文件)与他们在其网站上发布的 MD5 相同,则您拥有完全相同的文件。

回答by jabalv

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/

当我使用 Windows 时,我发现了一个方便的 HashTab 3rd 方工具。它在文件属性选项卡之一中显示 MD5、SHA-1 校验和。http://implbits.com/products/hashtab/

回答by gridtrak

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/

7-Zip 可用于为文件、文件文件夹和文件文件夹树生成哈希。7-Zip 占用空间小,是一个非常有用的压缩实用程序。 http://7-zip.org/

回答by Kosta Tenedios

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

只是为 Windows 用户添加另一个选项,Get-FileHash可以使用 PowerShell cmdlet ( https://technet.microsoft.com/en-us/library/dn520872.aspx)。

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

用法示例: Get-FileHash MyImage.iso -Algorithm MD5

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

如果您所追求的只是原始哈希,那么: (Get-FileHash MyImage.iso -Algorithm MD5).Hash

回答by yantaq

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

直接从http://www.microsoft.com/en-us/download/confirmation.aspx?id=11533下载 fciv.exe

shell> fciv.exe [yourfile]

will give you md5 by default.

默认情况下会给你 md5。

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

您可以阅读帮助文件 fciv.exe -h