Published by Patrick Mutisya · 14 days ago
Describe and use methods of data verification during data entry and data transfer.
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.
| Method | Purpose | Typical Use |
|---|---|---|
| Parity Bit | Detects a single‑bit error in a fixed‑size block. | Keyboard input, simple serial links. |
| Checksum | Detects 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. |
When users type data, the system can apply simple checks before accepting the input.
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
\$\$
Data is often sent in blocks; each block carries extra bits that allow the receiver to check integrity.
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.
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.
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.
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