Question

Suppose that we have a group of N bytes. One can add a very basic (and not particularly reliable) check of the consistency of this data by storing an additional (N+1)th byte containing exclusive XOR of all N original bytes. It will be enough to detect a single byte error during the transmission.

In the practical problem that I am trying to solve, if an error occurs during transmission, I actually will know when error occurred and which byte contains the error. Then knowledge of the (N+1)th byte is sufficient to recover the incorrect byte by simply XORing all correct bytes with the (N+1)th byte.

The errors that can occur in my application actually occur in bursts of 1 or several bytes, I will denote this number as M. There can be no more than a single burst per group of N bytes. In fact, when error occurs my transmission channel returns N-M bytes, along with the marker of the position where bytes were lost.

My question is: what would be (is there?) a natural way to generalize the simple (M=1) error correction scheme using a single XOR byte to the case where the error burst can contain up to M skipped bytes? Is it possible to do this specific kind of error correction using only M bytes?

Was it helpful?

Solution

For $i \in \{0,\ldots,M-1\}$, add a new byte which is the sum (or XOR) of every byte whose index equals $i$ mod $M$. For example, if $M=2$, one byte is the sum of all the bytes in the even positions, and the other one is the sum of all the bytes in the odd positions. Since bursts have length at most $M$, each of these checksums will only be missing a single byte.

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top