198k views
5 votes
You just downloaded a new release for a program you use. You need to make sure the file was not altered before you received it. Another file containing the original file hash was also downloaded. Both files are located in the C: Downloads folder. In this lab, your task is to use MD5 hash files to confirm that the Release.zip file was unaltered. From Windows PowerShell, generate a file hash for the new Release.zip file. View the hash of the original file stored in the file. Use the following command to compare the original hash of the Release.zip file to its calculated hash to see if they match: 'new hash' -eq 'known hash'. Answer the question.

User Itaysk
by
9.2k points

1 Answer

4 votes

Final answer:

To confirm the Release.zip file is unaltered, calculate its MD5 hash using Get-FileHash in PowerShell, compare it with the original hash, and use the comparison operation '-eq' to determine if they match.

Step-by-step explanation:

To ensure that the Release.zip file has not been altered, we need to compute its MD5 hash and compare it to the original hash provided. To do this in Windows PowerShell, navigate to the C: Downloads folder and use the Get-FileHash cmdlet to generate the hash for the file. Here is an example command you can use in PowerShell:

Get-FileHash -Path "C:\Downloads\Release.zip" -Algorithm MD5

Once you have the calculated hash, you should open the file containing the original hash and compare the two. If you have the original hash value, you can use the following PowerShell comparison to see if they match:

$originalHash = 'the_original_hash_value_from_the_file'
$calculatedHash = 'the_calculated_hash_from_the_previous_command'
$originalHash -eq $calculatedHash

If the comparison returns true, the hashes match and the file is confirmed to be unaltered. If it returns false, the file may have been tampered with and should not be trusted.

User Anandan
by
8.1k points