.IN Domains from ₹555/year

Up to 50% OFF Hosting Plans

Skip to main content

How to Verify Backup ZIP Files Using SHA256 on Windows and AlmaLinux

Verify SHA256 checksum to confirm that a backup file has been transferred or downloaded correctly without corruption or unexpected changes.

When transferring large backup files between Linux servers or downloading them to a Windows computer, checking the SHA256 checksum is an important file integrity verification step.

A SHA256 checksum is a unique 64-character hexadecimal value generated from a file’s contents. By calculating and comparing the checksum of the original and downloaded files, you can verify whether both files are identical.

This guide explains how to verify SHA256 checksum on Windows and AlmaLinux using built-in commands, including how to compare backup files transferred between two Linux servers.This guide explains how to calculate and compare SHA256 checksums on AlmaLinux servers and Windows computers, including how to verify files transferred between two Linux servers.

What Is a SHA256 Checksum?

SHA256 (Secure Hash Algorithm 256-bit) is a cryptographic hashing algorithm that generates a unique 64-character hexadecimal value for a file.

Even a small change to a file will produce a different SHA256 checksum.

For example:

  • Original backup file: example-backup.zip
  • SHA256 checksum: A 64-character hexadecimal value
  • Downloaded backup file: example-backup.zip
  • If both checksums match, the files are considered identical with an extremely high degree of confidence.

Important: SHA256 verifies file integrity. It does not prove that a backup is restorable. For important backups, also test the archive and perform a test restore.

1. Calculate SHA256 on an AlmaLinux Server

First, connect to your AlmaLinux server using SSH.

Run the following command:

sha256sum /path/to/backup/example-backup.zip

Replace /path/to/backup/ with the actual directory containing your backup file.

Example output:

YOUR_64_CHARACTER_SHA256_HASH  /path/to/backup/example-backup.zip

Copy the complete 64-character checksum. You will need it to verify the copied or downloaded file.

Check the backup file size

You can also check the exact file size in bytes:

stat -c '%s' /path/to/backup/example-backup.zip

Keep this value for comparison with the destination file.

2. Verify SHA256 on Another Linux Server

If you have transferred the backup to another Linux server using SCP, SFTP, FTP, or another transfer method, calculate its checksum on the destination server.

Run:

sha256sum /path/to/backup/example-backup.zip

Compare the resulting checksum with the original checksum calculated on the source server.

  • Matching checksums: The source and destination files are identical.
  • Different checksums: The files are not identical. The transfer may have been interrupted, or the destination file may have been changed or corrupted.

Automatically compare the checksum on Linux

You can also use the following script to compare the destination file against the original checksum.

EXPECTED="YOUR_EXPECTED_SHA256_HASH"
FILE="/path/to/backup/example-backup.zip"

if [ ! -f "$FILE" ]; then
    echo "FILE NOT FOUND"
    exit 1
fi

ACTUAL=$(sha256sum "$FILE" | awk '{print $1}')

if [ "$ACTUAL" = "$EXPECTED" ]; then
    echo "SUCCESS: SHA256 MATCHED - FILE VERIFIED"
else
    echo "FAILED: SHA256 DOES NOT MATCH"
    echo "Expected: $EXPECTED"
    echo "Actual:   $ACTUAL"
fi

Before running the script:

  1. Replace YOUR_EXPECTED_SHA256_HASH with the checksum from the original source file.
  2. Replace the example file path with the actual destination file path.
  3. Copy and execute the complete script in your SSH terminal.

You can also verify SHA256 checksum on Windows using PowerShell’s built-in Get-FileHash command without installing any additional software.

3. Verify SHA256 on a Windows Computer

Windows includes a built-in PowerShell command for calculating SHA256 checksums. You do not need to install additional software.

Step 1: Open PowerShell

  1. Press the Windows key.
  2. Search for PowerShell.
  3. Open Windows PowerShell or Terminal with PowerShell.

Step 2: Calculate the downloaded file’s SHA256

If the backup file is in your Downloads folder, run:

Get-FileHash -Algorithm SHA256 "$env:USERPROFILE\Downloads\example-backup.zip"

Replace example-backup.zip with the actual downloaded filename.

PowerShell will display output similar to:

Algorithm : SHA256
Hash      : YOUR_64_CHARACTER_SHA256_HASH
Path      : C:\Users\YourUser\Downloads\example-backup.zip

Copy the value displayed next to Hash.

Step 3: Compare the checksum with the original

Compare the Windows checksum with the checksum you obtained from the original AlmaLinux server.

If both values match exactly, the downloaded file is identical to the original file.

If they do not match, do not treat the downloaded backup as verified.

Automatically compare SHA256 in Windows PowerShell

You can use this single-line command to compare the downloaded file against the original checksum.

$file="$env:USERPROFILE\Downloads\example-backup.zip"; $expected="YOUR_EXPECTED_SHA256_HASH"; if(Test-Path -LiteralPath $file){$actual=(Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLower(); if($actual -eq $expected.ToLower()){Write-Host "SUCCESS: SHA256 MATCHED - BACKUP VERIFIED" -ForegroundColor Green}else{Write-Host "FAILED: SHA256 DOES NOT MATCH" -ForegroundColor Red; Write-Host "Expected: $expected"; Write-Host "Actual: $actual"}}else{Write-Host "FILE NOT FOUND - CHECK DOWNLOADS FOLDER" -ForegroundColor Red}

Before running the command:

  1. Replace YOUR_EXPECTED_SHA256_HASH with the original server’s SHA256 checksum.
  2. Change example-backup.zip if your downloaded filename is different.
  3. Paste the entire command into PowerShell and press Enter.

PowerShell will display one of the following results:

  • SUCCESS: The downloaded file matches the original.
  • FAILED: The checksums do not match.
  • FILE NOT FOUND: The file path or filename is incorrect.

4. Compare File Sizes on Linux and Windows

SHA256 comparison is the primary integrity check. Comparing file sizes provides an additional way to identify incomplete transfers.

On AlmaLinux

stat -c '%s' /path/to/backup/example-backup.zip

On Windows PowerShell

(Get-Item -LiteralPath "$env:USERPROFILE\Downloads\example-backup.zip").Length

Both commands display the file size in bytes.

The source and destination file sizes should match exactly. If they differ, the transfer is incomplete or the files are different.

Note: Matching file sizes alone do not guarantee that two files are identical. Always compare SHA256 checksums as well.

5. What to Do If SHA256 Checksums Do Not Match

If the original and downloaded checksums are different, follow these steps:

  1. Check the file sizes on both the source and destination.
  2. Confirm that the download or transfer completed successfully.
  3. Check whether the browser, server, proxy, or network connection interrupted the transfer.
  4. If the destination file is incomplete, transfer or download the backup again.
  5. Calculate the SHA256 checksum again on both files.
  6. Do not delete the original backup until the replacement copy has been verified.

For very large backup files, use a reliable transfer method that supports resuming interrupted transfers, where available.

6. Test the Backup Archive Before Restoring

A matching SHA256 checksum confirms that the copied file is identical to the source file. However, it does not confirm that the backup contains all the data required for a successful restore.

For ZIP archives, you can check archive integrity on AlmaLinux using:

unzip -t /path/to/backup/example-backup.zip

If the ZIP utility is installed, this command checks the archive’s internal structure and reports whether it can be read without detected errors.

For critical backups, the recommended procedure is:

  1. Verify the SHA256 checksum.
  2. Check the archive integrity.
  3. Perform a test restore in a separate environment.
  4. Confirm that the restored application and its data work correctly.

7. Recommended Backup Verification Checklist

Before relying on a transferred backup, confirm the following:

  • The backup operation completed successfully.
  • The source backup file exists.
  • The source SHA256 checksum has been recorded.
  • The destination file exists.
  • Source and destination file sizes match.
  • Source and destination SHA256 checksums match.
  • The archive integrity test passes, where applicable.
  • A test restore has been completed for critical backups.

Frequently Asked Questions

What does it mean when SHA256 checksums match?

It means both files have the same SHA256 hash. This provides extremely strong evidence that their contents are identical.

Can I calculate SHA256 without installing software on Windows?

Yes. Windows includes PowerShell’s Get-FileHash command, which supports SHA256 without requiring additional software.

Is SHA256 better than comparing file sizes?

Yes. File size comparison only checks whether two files have the same length. SHA256 checks the file contents and can detect differences even when both files have identical sizes.

What should I do if SHA256 does not match?

Check the file sizes and transfer status. If the file is incomplete or corrupted, transfer or download it again and repeat the verification.

Does a matching SHA256 checksum guarantee that a backup can be restored?

No. It verifies that the files are identical, not that the backup is complete, valid, or compatible with the restore environment. Always test critical backups through an actual restore procedure.

Can I use SHA256 to verify SCP transfers?

Yes. Calculate the checksum on the source server before transfer and on the destination server after transfer. Matching checksums provide strong confirmation that the transferred file is identical to the original.

Conclusion

Verifying SHA256 checksums is a simple and effective way to confirm the integrity of large backup files transferred between AlmaLinux servers or downloaded to Windows computers.

For important backups, always compare the SHA256 checksum, check the file size, test the archive, and perform a restore test before deleting the original copy.

Leave a Comment

Table of Contents