chapter9-Security
chapter9-Security
When data is sent from one device to another, errors can happen. These errors might
flip a bit in the data (turn a 1 into a 0, or vice versa). To avoid using bad or incorrect data,
we need ways to check if the data got messed up during transmission.
1. What is parity?
Parity checks only detect some errors. If two bits flip (e.g., 1 becomes 0 twice), the
parity will still look correct, even though the data is wrong. So it’s not perfect but works
for simple cases.
Checksum Method
The checksum method is a way to check if data was corrupted during transmission. It
works by using a summary number (the checksum) calculated from the data.
111110100 (sum)
less
- It calculates the checksum (e.g., taking the last 8 bits:
`11110100`).
Example of an Error
10101011 (block 1)
11000100 (block 2 - with error)
10010011 (block 3)
--------
111100011 (new sum)
This method uses a table (or matrix) of bits to make error detection more precise:
1. At the sender:
a. Imagine the data is arranged in rows (one row per byte).
b. A parity bit is added to each byte (row) as before.
c. Then, an extra byte (the parity byte) is created by adding parity bits for
each column in the matrix.
d. The sender sends all the data + the parity byte.
2. At the receiver:
a. The receiver checks parity for each row and each column.
b. If one bit in the data is wrong, the row and column checks will point to the
exact location of the error.
3. Fixing errors:
a. Once the receiver identifies the error, it can correct the flipped bit and
recover the correct data.
Final Notes