Block coding in computer networks is a technique used to ensure data integrity during
transmission. It involves dividing the data into blocks and adding redundant bits (also known as
error-detection or error-correction bits) to enable error checking or correction at the receiver.
Example: Block Coding with Hamming Code (7,4)
The Hamming (7,4) code is a classic block coding technique that encodes 4 bits of data into 7
bits by adding 3 parity bits. These parity bits allow the detection and correction of a single-bit
error.
Steps:
1. Original Data (4 bits): Let's say the original data to be sent is: 1011.
2. Generate Parity Bits: Add 3 parity bits P1,P2,P4P_1, P_2, P_4 at positions 1, 2, and
4:
· Position 1: Covers bits 1, 3, 5, 7
· Position 2: Covers bits 2, 3, 6, 7
· Position 4: Covers bits 4, 5, 6, 7
1. Fill the data bits at positions 3, 5, 6, and 7.
2. Placeholders: P1,P2,D1,P4,D2,D3,D4P_1, P_2, D_1, P_4, D_2, D_3, D_4
3. Substituting data 1011 into D1,D2,D3,D4D_1, D_2, D_3, D_4, we get:
P1,P2,1,P4,0,1,1P_1, P_2, 1, P_4, 0, 1, 1
4. Calculate Parity Bits: Use XOR to compute parity bits:
· P1=D1⊕D2⊕D4P_1 = D_1 \oplus D_2 \oplus D_4 → P1=1⊕0⊕1=0P_1 = 1 \oplus
0 \oplus 1 = 0
· P2=D1⊕D3⊕D4P_2 = D_1 \oplus D_3 \oplus D_4 → P2=1⊕1⊕1=1P_2 = 1 \oplus
1 \oplus 1 = 1
· P4=D2⊕D3⊕D4P_4 = D_2 \oplus D_3 \oplus D_4 → P4=0⊕1⊕1=0P_4 = 0 \oplus
1 \oplus 1 = 0
·
1. Final encoded block: 0110011
2. Transmission: The encoded block 0110011 is sent over the network.
3. Error Detection and Correction at Receiver:
· If no errors occur, the received block matches the encoded block.
· If an error occurs (e.g., a bit flips during transmission), the receiver recalculates the parity
bits and compares them with the received parity bits.
· Discrepancy indicates an error. The position of the error bit is determined by combining
the parity results.
Use Case:
Block coding like Hamming is commonly used in:
· Data storage: Protecting data in memory or disks.
· Telecommunications: Ensuring error-free data over noisy channels.
· Wireless communications: Handling errors due to interference or signal degradation.