Skip to content

Instantly share code, notes, and snippets.

@zhiyelee
Last active August 29, 2015 14:04
Show Gist options
  • Save zhiyelee/35b12cc436ed1a8334ce to your computer and use it in GitHub Desktop.
Save zhiyelee/35b12cc436ed1a8334ce to your computer and use it in GitHub Desktop.
When is CRC more appropriate to use than MD5/SHA1?

When is it appropriate to use CRC for error detection versus more modern hashing functions such as MD5 or SHA1? Is the former easier to implement on embedded hardware?

http://stackoverflow.com/questions/996843/when-is-crc-more-appropriate-to-use-than-md5-sha1

by @defines http://stackoverflow.com/a/996873/775783
CRC works fine for detecting random errors in data that might occur, for example, from network interference, line noise, distortion, etc.

CRC is computationally much less complex than MD5 or SHA1. Using a hash function like MD5 is probably overkill for random error detection. However, using CRC for any kind of security check would be much less secure than a more complex hashing function such as MD5.

And yes, CRC is much easier to implement on embedded hardware, you can even get different packaged solutions for this on IC.

by @Liran Orevi http://stackoverflow.com/a/996913/775783
CRC is designed against unintentional changes in the data. That is, it's good for detecting unintentional errors, but will be useless as a way of making sure a data was not maliciously handled with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment