Errors
Error detection
based on treating bit strings as polynomials with coefficients of only 0 and 1
polynomial eg. ×32 + x16 + x8+×1 + 1
sender and receiver agree on generator polynomial G(x) in advance, with both high- and low-order bits at 1
append a CRC to end of frame so that polynomial represented is divisible by G(x)
algorithm to send, with generator G(x):
r is degree of G(x) — append r zero bits to end of frame so it now has m+r bits
divide bit string G(x) into bit string from step 1 with long division (subtracting is mod 2, simply XOR)
subtract remainder from bit string in step 1 using mod 2 subtraction, result is checksummed frame to transmit
when received, checks if frame is divisible by G(x). if not, the remainder is the error (E(x)/G(x))
Error correction
if Hamming distance n, we can correct (h-1)/2 errors
bits of codeword are numbered, with 1 at very left
at powers of 2 are check bits, others are data
sender:
expand locations into powers of 2
decide Value of check bit in location 2i by mod 2 adding all bits with 2i in expansion
receiver:
Redo all bit computations
For even parity, each check result should be zero. If not, an error has been detected.