Describe and use methods of data verification during data entry and data transfer

Published by Patrick Mutisya · 14 days ago

Cambridge A-Level Computer Science – Data Integrity (6.2)

6.2 Data Integrity

Objective

Describe and use methods of data verification during data entry and data transfer.

What is Data Integrity?

Data integrity means that data is accurate, complete and unchanged except by authorised actions. In computing, we use verification techniques to detect accidental errors that may occur when data is entered, stored or transmitted.

Why \cdot erification Is Needed

  • Human error during manual entry (typos, omitted fields).
  • Transmission errors caused by noise, signal loss or hardware faults.
  • Software bugs that corrupt data structures.

Common \cdot erification Methods

MethodPurposeTypical Use
Parity BitDetects a single‑bit error in a fixed‑size block.Keyboard input, simple serial links.
ChecksumDetects multiple errors by summing data values.File transfer protocols, simple data files.
Longitudinal Redundancy Check (LRC)Detects errors in rows and columns of a data block.Modem communication, early network protocols.
Cyclic Redundancy Check (CRC)Detects burst errors using polynomial division.Ethernet, USB, storage devices.
Hash Functions (e.g., MD5, SHA‑1)Detects any alteration of data; provides strong integrity.File integrity verification, digital signatures.

Verification During Data Entry

When users type data, the system can apply simple checks before accepting the input.

  1. Format validation – ensure the data matches a required pattern (e.g., dates as \$DD/MM/YYYY\$).
  2. Range checks – verify numeric values lie within acceptable limits.
  3. Mandatory fields – require that essential fields are not left blank.
  4. Checksum or Luhn algorithm for identifiers (e.g., credit card numbers).

Example – Luhn algorithm for a 16‑digit card number:

\$\$

\text{CheckDigit} = (10 - ((\sum \text{odd positions}) + (\sum \text{doubleEvenPositions mod 9})) \bmod 10) \bmod 10

\$\$

Verification During Data Transfer

Data is often sent in blocks; each block carries extra bits that allow the receiver to check integrity.

Parity Bit

For a byte \$b7b6b5b4b3b2b1b0\$, an even parity bit \$p\$ is added so that the total number of 1’s is even:

\$\$

p = \bigoplus{i=0}^{7} bi

\$\$

If the received parity does not match, an error is flagged.

Checksum

A simple 8‑bit checksum is the sum of all bytes modulo 256:

\$\$

\text{Checksum} = \left(\sum{k=1}^{n} \text{byte}k\right) \bmod 256

\$\$

The sender appends this value; the receiver recomputes the sum and compares.

Cyclic Redundancy Check (CRC)

CRC treats the data block as a binary polynomial \$D(x)\$ and divides it by a generator polynomial \$G(x)\$. The remainder \$R(x)\$ is transmitted with the data.

\$\$

\text{Transmit} = D(x) \cdot x^{\deg(G)} + R(x)

\$\$

The receiver performs the same division; a non‑zero remainder indicates corruption.

Practical Example: File Transfer with CRC‑32

  1. Sender reads the file and computes a 32‑bit CRC using the polynomial \$G(x)=0x04C11DB7\$.
  2. The CRC value is appended to the file data.
  3. Receiver reads the data, recomputes the CRC, and compares it to the transmitted CRC.
  4. If they match, the file is accepted; otherwise the receiver requests a retransmission.

Using \cdot erification in Code (Pseudo‑code)

Below is a generic routine for verifying a data block with a checksum.

function verifyBlock(dataBlock, receivedChecksum):

computed = 0

for each byte in dataBlock:

computed = (computed + byte) mod 256

if computed == receivedChecksum:

return true

else:

return false

Summary Checklist

  • Identify where data is entered or transferred.
  • Choose an appropriate verification method (parity, checksum, CRC, hash).
  • Implement the method consistently at both sender and receiver.
  • Test with deliberately corrupted data to ensure errors are detected.

Suggested diagram: Flow of data with verification – show source, verification step, transmission, verification at destination, and error handling.