L
LLLOS.ai
Learn
L

Ask Your Tutor · Computer Science

What is a checksum and how does it detect corruption?

General knowledge Asked by Anonymous 23 Oct 2026, 11:19 AM IST Updated

In one line

A checksum is a special number used to check if data has changed or got corrupted during transfer or storage.

Barcode — Optical machine-readable representation of data
Barcode — Optical machine-readable representation of data
Barcodes use a checksum digit to catch scanning errors, just like a digital checksum.
Image: Wikipedia

The rule

A checksum is a value calculated from a set of data, which helps to detect errors by comparing it before and after data transfer.

There is no single formula for all checksums, but a simple one is: checksum = sum of all bytes (or numbers) in the data

Let's understand it simply

Imagine you are sending a cricket score to your friend by SMS. You add up all the runs and wickets and write the total at the end. If your friend gets the same total after adding, the message is correct. If not, something went wrong. The checksum works like this total — it helps check if the data is correct or has changed.

How it works

  1. The sender calculates the checksum from the data (like adding all numbers).
  2. The sender sends both the data and the checksum to the receiver.
  3. The receiver gets the data and calculates the checksum again.
  4. The receiver compares their checksum with the one sent.
  5. If both match, the data is likely correct. If not, the data is corrupted.
How a checksum detects corruption
  1. Sender calculates checksum from data
  2. Sender sends data + checksum
  3. Receiver gets data and recalculates checksum
  4. Receiver compares checksums
  5. If they match, data is correct; if not, it's corrupted

The story behind it

Checksums became important when computers started sending data over wires or saving it on disks. Even a small mistake (like a single wrong bit) can cause big problems. Early engineers wanted a simple way to spot these mistakes. So, they invented checksums — a quick way to check if data changed.

Where you see it in real life

  • Downloading files: Websites show a checksum. After download, you check if your file's checksum matches. If not, the file is corrupted.
  • Bank ATM transactions: Data sent between ATM and bank uses checksums to make sure your account details are not changed by mistake.
  • Mobile recharge messages: When you get a recharge SMS, the system checks the message with a checksum to avoid wrong balances.
  • Railway ticket booking: Data sent between your phone and IRCTC uses checksums to avoid booking errors.
  • Barcodes in shops: The last digit in a barcode is a checksum to catch scanning errors.

Why it matters

  • Prevents mistakes: Stops wrong data from being used in banking, shopping, or exams.
  • Saves time: Quickly checks for errors without reading all the data again.
  • Used everywhere: From WhatsApp messages to space missions, checksums help keep data safe.
  • Foundation for security: Later topics like cryptography and data security use advanced checksum ideas.

Common mistakes

  • Thinking checksum can fix errors: It only detects, not corrects.
  • Believing checksum catches all errors: Some small changes may not be caught by simple checksums.
  • Mixing up checksum with encryption: Checksum checks for errors, encryption hides data.

Remember it

A checksum is like a total or summary of data — if it changes, something is wrong.

Check yourself

What is the main purpose of a checksum?

To detect if data has changed or got corrupted.

Why does the receiver recalculate the checksum?

To check if the received data matches the original.

Can a checksum fix errors in data? Why or why not?

No, it can only detect errors, not correct them.

Give one real-life example where a checksum is used.

Barcodes in shops use a checksum digit to catch errors.

Quick recap

  • A checksum is a number made from data to spot errors.
  • It helps detect if data changed during transfer or storage.
  • Sender and receiver both calculate the checksum to compare.
  • Checksums are used in downloads, banking, barcodes, and more.
  • Checksums detect errors but do not fix them.
Written by the LLOS.ai tutor. Asked by Anonymous on 23 Oct 2026, 11:19 AM IST