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

前端 未结 20 2460
夕颜
夕颜 2020-12-22 17:22

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, an

20条回答
  •  梦毁少年i
    2020-12-22 18:02

    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 " ",""
    

提交回复
热议问题