5

In Windows 10 I would like to download and install Inkscape 1.1.2, verifying the installation file first.

How do you view the contents of the .sha256 file (labeled 'sig' on the Inkscape download page) to compare with the checksum hash for Inkscape's latest stable download?

As the checksum hash of a file can be seen using powershell, can you also use powershell to see the contents of the .sha256 'sig' file? Can it be done without having to download further software?

Braiam
  • 4,777
Eric
  • 97

1 Answers1

6

Note: In Windows, you may also use certutil to compute the hash. For example:

certutil -hashfile C:/Users/user1/Downloads/software.zip SHA256

For answering your question, see the post How can I compare a file's SHA256 hash in PowerShell to a known value, quoted here:

The Get-FileHash cmdlet computes hashes for files, and SHA256 is its default hash algorithm.

To compute the hash of a file:

Get-FileHash .\path\to\foo.zip

This produces something like:

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          15DC0502666851226F1D9C0FE352CCAF0FFDEFF2350B6D2D08A90FCD1F610A10       C:\Users\me\path\to\foo.zip

To compare to the known value, extract the computed hash value alone from the output of Get-FileHash, then compare it to the expected value as a (quoted) string literal. Conveniently this comparison appears to be case-insensitive

(Get-FileHash .\path\to\foo.zip).Hash -eq "15dc0502666851226f1d9c0fe352ccaf0ffdeff2350b6d2d08a90fcd1f610a10"
True

...or if you've got the expected hash in a file, say expected-hash.sha256

(Get-FileHash '.\path\to\foo.zip').Hash -eq (Get-Content .\expected-hash.sha256)
True
harrymc
  • 498,455