Resources for the global digital safety training community.
All modern operating systems have built in hash creation/verification tools, but they are command-line based. In this session, we will use a graphical tool called QuickHash, but we will also provide command-line options for users who are willing to use the command line and/or don’t want to download additional software.
Let’s get hands on and create and verify some hashes - first up, we’ll verify the hash of the quickhash download file itself!
Note that ideally, you’d use one of the built-in tools below to verify QuickHash, as you’re functionally trusting quickhash to verify itself here
Hopefully the values matched! If not, verify you used the same hash algorithm, and are on the download page for both the operating system (Linux, Apple/OSX, Windows) AND version that you downloaded.
In Powershell (v4 or above), you can use the Get-FileHash ‘cmdlet’ for producing hash values. For tilres
Get-FileHash C:\Users\user1\Downloads\Contoso8_1_ENT.iso -Algorithm SHA384 | Format-List
Powershell unfortunately does not provide a simple way to compute a hash for a string, but there is a workaround, setting a string as a variable in what Microsoft calls a “stream”:
$stringAsStream = [System.IO.MemoryStream]::new()
$writer = [System.IO.StreamWriter]::new($stringAsStream)
$writer.write("FOOBAR")
$writer.Flush()
$stringAsStream.Position = 0
Get-FileHash -InputStream $stringAsStream -Algorithm SHA384 | Select-Object Has
Microsoft provides PowerShell GetHash documentation
Terminal
In your Terminal program or directly in a command line, you have a variety of options in both OSX and Linux to check hashes. The most flexible is the openssl tool (it can also do a wide variety of other cryptographic tricks!).
You can get a list of all the hash functions openssl supports with
openssl dgst -list
To get a hash of a short text string, use this command, replacing FOOBAR with your text (and selecting the hash, here using SHA-3)
printf FOOBAR | openssl dgst -sha3-256
To get a hash of a file, use this command, replacing FILENAME with the path to the file you want to hash (and selecting the hash, here using SHA-3):
openssl dgst -md5 FILENAME
Of note, in Ubuntu, you can also install nautilus-gtkhash to add a right-click menu tab that will generate hashes for you in the file manager GUI.