Knowledge Document: How to check the hash checksum of files downloaded from SLD

 
1 Likes

Environment

Software Licenses and Downloads (SLD)
 

Situation

It is not always apparent if a download was completed correctly. Therefore it is good practice to check the hash checksum of the downloaded file 


Resolution

  1. Download check_hash.ps1 attached to this document
  2. Get the expected checksum and the type of checksum from the SLD download portal. To do that hover over the "More Details" of the file you downloaded on the download page
  3. Mark the text and save it somewhere locally

1. Make sure the checksum type (in this case SHA256) is supported by the script (see additional information)

2. Right click on the script check_hash.ps1 and select "run with Powershell"

3. A file open dialogue will pop up. Select the downloaded file you want to check the checksum of

4. Calculating the checksum may take some time depending on the size of the file (ca. 3 minute for a 10GB ISO file) where it may seem as if the script is not doing anything

5. The script will display the checksum types it supports (see additional information)

6. The script will ask for a "string to compare". Copy only the checksum itself (see step 2 & 3) and put it there

7. The script will show if any of the checksums which types it support matches the string you entered or if no match was found

Additional Information

Checksum types supported by the script:
MD5
SHA1
SHA256

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") 
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") 
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
$null = $FileBrowser.ShowDialog()
$md5=Get-FileHash $FileBrowser.FileName -Algorithm MD5
$sha256=Get-FileHash $FileBrowser.FileName -Algorithm SHA256
$sha1=Get-FileHash $FileBrowser.FileName -Algorithm SHA1

write-host $md5.Path
write-host "MD5: "$md5.Hash
write-host "SHA256: "$sha256.Hash
write-host "SHA1: "$sha1.Hash

$input=Read-Host -Prompt "sting to compare"
$input="$input".ToUpper()
$match=0
if ($md5.Hash -eq $input){
    Write-Host "MD5 matches"
    $match=1
}
if ($sha256.Hash -eq $input){
    Write-Host "SHA256 matches"
    $match=1
}
if ($sha1.Hash -eq $input){
    Write-Host "SHA1 matches"
    $match=1
}
if ($match -eq 0){
    write-host "no match"
}

Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');

Access article on support portal
Comment List
  • Some observations:

    - The PowerShell window is just blank while it runs, but if you check your Task Manager, you will see it using resources as it chugs through.

    - The posted SHA265 hash in SLD is not always correct, especially if/when an updated version has replaced an original one, with it taking a little while for SLD text to catch up. This just happened with OES 23.4 ISO, and at this moment does not match the download (a case has been opened). If unsure, ask here in the appropriate discussion area, showing your hash results, especially as a part of any recent post that points you the file in question having been updated.  

    ________________________

    Andy of KonecnyConsulting.ca in Toronto
    Please use the "Like" and/or "Verified Answers" as appropriate as that helps us all.

Related
Recommended