Windows equivalent of linux cksum command

前端 未结 7 1115
北荒
北荒 2020-12-12 17:51

I am looking for a way to compute crc checksum cross platform.

cksum works on Linux, AIX, HP-UX Itanium, Solaris, is there a equivalent command of linu

相关标签:
7条回答
  • 2020-12-12 18:26

    In the year 2019, Microsoft offers the following solution for Windows 10. This solution works for SHA256 checksum.

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-6

    Press the Windows key. Type PowerShell. Select Windows Powershell. Press Enter key. Paste the command

    Get-FileHash C:\Users\Donald\Downloads\File-to-be-checked-by-sha256.exe | Format-List

    Replace File-to-be-checked-by-sha256.exe by the name of your file to be checked.

    Replace the path to your path where the file is. Press Enter key. Powershell shows then the following

    Algorithm : SHA256 Hash : 123456789ABCDEFGH1234567890... Path : C:\Users\Donald\Downloads\File-to-be-checked-by-sha256.exe

    0 讨论(0)
  • 2020-12-12 18:28

    In combination of answers of @Cassian and @Hllitec and from https://stackoverflow.com/a/42706309/1001717 here my solution, where I put (only!) the checksum value into a variable for further processing:

    for /f "delims=" %i in ('certutil -v -hashfile myPackage.nupkg SHA256 ^| find /i /v "sha256" ^| find /i /v "certutil"') do set myVar=%i
    

    To test the output you can add a piped echo command with the var:

    for /f "delims=" %i in ('certutil -v -hashfile myPackage.nupkg SHA256 ^| find /i /v "sha256" ^| find /i /v "certutil"') do set myVar=%i | echo %myVar%
    

    A bit off-topic, but FYI: I used this before uploading my NuGet package to Artifactory. BTW. as alternative you can use JFrog CLI, where checksum is calculated automatically.

    0 讨论(0)
  • 2020-12-12 18:31

    Here is a C# implementation of the *nix cksum command line utility for windows https://cksum.codeplex.com/

    0 讨论(0)
  • 2020-12-12 18:34

    It looks as if there is an unsupported tool for checksums from MS. It's light on features but appears to do what you're asking for. It was published in August of 2012. It's called "Microsoft File Checksum Integrity Verifier".

    http://www.microsoft.com/en-us/download/details.aspx?id=11533

    0 讨论(0)
  • 2020-12-12 18:38

    Open Windows PowerShell, and use the below command:

    Get-FileHash C:\Users\Deepak\Downloads\ubuntu-20.10-desktop-amd64.iso
    
    0 讨论(0)
  • 2020-12-12 18:40

    To avoid annoying non-checksum lines : CertUtil -v -hashfile "your_file" SHA1 | FIND /V "CertUtil" This will display only line(s) NOT contaning CertUtil

    0 讨论(0)
提交回复
热议问题