Is CRC-32 a hash function?

If you’ve read my previous post about CRC-32, you may have a question: Is CRC-32 a hash function?

CRC32 works very well as a hash algorithm. The whole point of a CRC is to hash a stream of bytes with as few collisions as possible. That said, there are a few points to consider:

  • CRC’s are not secure. For secure hashing you need a much more computationally expensive algorithm. For a simple bucket hasher, security is usually a non-issue.
  • Different CRC flavors exist with different properties. Make sure you use the right algorithm, e.g. with hash polynomial 0x11EDC6F41 (CRC32C) which is the optimal general purpose choice.
  • As a hashing speed/quality trade-off, the x86 CRC32 instruction is tough to beat. However, this instruction doesn’t exist in older CPU’s so beware of portability problems.

So the answer is: No, CRC-32 is not a hash function or at least, it didn’t made for that purpose.