Reputation: 43
Following are the things that I already know about these:
Hamming codes can be used both to detect and correct errors, while in crc errors can only be detected.
CRC is used in communication while Hamming code is used to detect errors in memory disks
My main question is what is the advantage of using one code over another?
Upvotes: 3
Views: 4516
Reputation: 11
It will depend on your application, but as you have pointed out, the two are quite different. The main difference I would consider is the amount of overhead needed for each.
For a simple (7,4) hamming code, you are adding 75% overhead to your data in order to get the ability to correct one error for every 4-bits. So if you were sending or storing a 1000 byte message, you would have to really send/store 1750 bytes. That's a lot of overhead!
For a CRC, you are accumulating a single result over a large amount of data in order to detect if there is an error somewhere in the data. You do not need to tell exactly where it is, just that something is wrong. For that, you could accumulate a 32-bit CRC over your message and do pretty well. So for our 1000 byte message, you would really be sending/storing 1004 bytes. That is very efficient if all you need is detection of a problem.
Upvotes: 1
Reputation: 26
Hamming is used in case where fixed length of data is to be detected and corrected while CRC works for any length of data.
Upvotes: 1