Can CRC32 be used as a hash function?

后端 未结 4 917
时光取名叫无心
时光取名叫无心 2020-12-12 22:23

Can CRC32 be used as a hash function? Any drawbacks to this approach? Any tradedeoffs?

4条回答
  •  無奈伤痛
    2020-12-12 23:02

    Obviously you could, but you shouldn't. A crc32 poorly distributes the input bits to the hash. Also it certainly shouldn't ever be used as a one-way hash since it isn't one. It's very easy to modify a message to produce a given crc.

    Use a hash algorithm designed for the purpose you have in mind, whatever that is.

提交回复
热议问题