Question

If a message, say two bytes, has been received, and it's known to have been encoded using Hamming code, but the parity used for encoding (even / odd) is not known, would the application of both Hamming code with odd and even parity work to identify errors on the message received?

Was it helpful?

Solution

If you do not know if even or odd parity is used, you can't tell if a single message is changed in error.

Example: using odd parity on a 4 bit message:

1101 --[Add parity]-> 11010 --[Introduce error]-> 10010.

The received message contains an even number of 1's. We know it is send using odd parity, so an error has occured.

Using an unknown parity on a 4 bit message:

1101 --[Add parity]-> 1101? --[Introduce error]-> 1001?.

We don't know the parity so we have no way to determine if an error has occured for this message.

But there is hope.

If we assume, the channel to be moderately reliable, and there are a lot of messages send, we could use probability to determine the error.

Example: collect a certain amount of messages. If at least 90% of them have odd parity, we could assume, the even parity messages to be in error.

If the number of received odd and even parity messages are close together, we are in real trouble. Either the channel is completely unreliable, or the sender uses both odd and even parity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top