DEV Community

Sharafat
Sharafat

Posted on

How to find checksum of a Google Drive File

A checksum (hash) lets you verify a file has not been altered or corrupted. Common use: confirm a downloaded ISO matches the publisher’s SHA-256 hash.

1. Open Google Colab

Go to https://colab.research.google.com and create a new Python notebook.

2. Connect to Google Drive

Run:

from google.colab import drive
drive.mount('/content/drive')
Enter fullscreen mode Exit fullscreen mode

Approve the auth prompt. Your Drive files appear under /content/drive/MyDrive/.

3. Locate the File Path

In the left sidebar (folder icon):

  • Navigate to the file.
  • Right‑click the file and choose "Copy path" (or manually note its path). Example path: /content/drive/MyDrive/DATA/iso/Win11_24H2_English_x64_Custom_Optimized.iso

4. Compute the SHA‑256 Checksum

Use sha256sum (installed by default in Colab):

!sha256sum /content/drive/MyDrive/DATA/iso/Win11_24H2_English_x64_Custom_Optimized.iso
Enter fullscreen mode Exit fullscreen mode

Output format:

<sha256_hash>  <file_path>
Enter fullscreen mode Exit fullscreen mode

5. Verify Against Known Hash

Compare the printed hash with the official one from the source website. They must match exactly. If not, the file may be incomplete or tampered with.

Common Issues

  • File not found: Confirm the path (case sensitive).
  • Large files: Hashing can take time; wait for completion.
  • Different algorithm needed: Replace with !md5sum or !sha1sum (only if required; SHA‑256 is stronger).

Top comments (0)