IamAUser12
IamAUser12

Reputation: 13

Probability of a collision using 32 bit CRC of a unique 32 byte array

I am trying to figure out if using 32 bit CRC will produce collision on 32 byte array.

BackGround

My system reads some configuration whenever it boots up from an external flash. I store the SHA256 hash of the last know configuration and when ever I read the configuration I calculate the SHA256 hash and compare it. If the two hash are different then the data is different.

I need to take that SHA256 and make it into a 32bit hash for another part of the system (due to some legacy code restrictions).

Questions

Will there be a high number of collision if I compute the 32 bit CRC on the 32 byte hash from SHA256?

I calculate the probability of collision to be 0. Can you let me know if this is correct? The number of sample K is always 2 in my problem (I think) because I am calculating 32 bit CRC on two 32 bytes byte array (SHA256 byte array).

see calculation here

Upvotes: 0

Views: 474

Answers (1)

Mark Adler
Mark Adler

Reputation: 112547

That's correct, if by "0" you mean that very small number. That small number is the probability that you would get a 32-bit CRC from random data that accidentally matches what you were expecting. It is simply 2-32.

Upvotes: 1

Related Questions