L
LLLOS.ai
Learn
L

Ask Your Tutor · Computer Science

Can two different files have the same checksum?

From NCERT Asked by Anonymous from Dallas, United States 23 Oct 2026, 7:15 PM IST Updated

In one line

Yes, two different files can have the same checksum, but it is very rare.

Hash function — Mapping arbitrary data to fixed-size values
Hash function — Mapping arbitrary data to fixed-size values
A hash function is used to create checksums from files.
Image: Wikipedia

The rule

A checksum is a short value (like a number or code) made from a file's data, used to check if the file has changed or has errors.

A checksum is created by running a file through a special formula (called a hash function). If two files are different but give the same checksum, it is called a collision.

Let's understand it simply

Imagine you and your friend both make rotis. You count the number of rotis you made and write the number on a slip. If you both made 5 rotis, the slip shows 5. But what if you made 5 small rotis and your friend made 5 big ones? The number is the same, but the rotis are different.

A checksum is like that slip. It is a summary, not the full file. Sometimes, two different files can give the same summary (checksum), just like two different sets of rotis can have the same count.

Checksum: Same or Different?
File AFile BChecksum
Hello, world!Hello, world!Same
Hello, world!Hello, India!Different (usually)
File XFile Y (very rare case)Same (collision)

How it works

  1. The computer runs a formula on the file's data (like adding, multiplying, or more complex steps).
  2. The formula gives a short code (the checksum), no matter how big the file is.
  3. If you change even one letter in the file, the checksum usually changes.
  4. But, because there are more possible files than possible checksums, sometimes two different files can get the same checksum (collision).
  5. Good checksum formulas make collisions very, very rare.

The story behind it

Checksums were invented to catch mistakes when sending or saving data. Early computers and networks would lose or change bits (tiny pieces of data), so people needed a quick way to check if a file was correct. Over time, better formulas (like MD5, SHA-1, SHA-256) were made to make collisions less likely.

Where you see it in real life

  • Downloading software: Websites show a checksum so you can check if your download is correct.
  • Bank transactions: Banks use checksums to make sure messages are not changed.
  • WhatsApp/Telegram: When you send a photo, the app checks the checksum to see if the file is complete.
  • Exam results online: Some boards give a checksum to check if the result file is real.
  • Aadhaar or PAN data: Checksums are used to check if your data is safe and unchanged.

Why it matters

  • Safety: Checksums help catch errors and stop fake files.
  • Security: They are used in passwords and digital signatures.
  • Data transfer: When sending files over the internet, checksums check if the file arrived safely.
  • Exams and jobs: Questions about checksums come in computer science exams and IT jobs.

Common mistakes

  • Thinking checksums are unique: Many students think every file has a different checksum. In reality, two different files can have the same checksum (collision), but it is rare.
  • Believing checksums can prove files are the same: Checksums can only show files are likely the same, not 100% sure.
  • Using weak checksum formulas: Old formulas like MD5 can have more collisions, so better ones (like SHA-256) are used now.

Remember it

A checksum is like a summary. Two different files can have the same summary, but it is very rare if the formula is good.

Check yourself

What is a checksum used for?

To check if a file has changed or has errors.

Can two different files have the same checksum? Why or why not?

Yes, because a checksum is a summary and sometimes two different files can get the same summary (collision), but it is rare.

Why do we use better checksum formulas like SHA-256?

To make collisions even more rare and improve security.

Quick recap

  • A checksum is a short code made from a file's data.
  • Two different files can have the same checksum (collision), but it is rare.
  • Checksums help check if files are correct or changed.
  • Good checksum formulas make collisions very unlikely.
  • Checksums are used in downloads, banking, and messaging apps.
Written by the LLOS.ai tutor, checked against NCERT chapters. Asked by Anonymous from Dallas, United States on 23 Oct 2026, 7:15 PM IST