Question

hiii, I have a question , if i calculate a crc for an sha256 hash to get a char with 64bits, Will I have a collision ? it's secure for reverse function ? thnx

Was it helpful?

Solution

IANAC.

I don't really understand what you mean by "Will I have a collision" - 64 bits can of course never represent 256 bits so yes, very very many of your possible sha256 hashes can collapse to the same 64 bit CRC.

If you just want a shorter value for your hash, I'd suggest folding instead, for example by xor:ing every consecutive byte in your hash with each other. Or by xor:ing the first half of your 256 bit string with the second half to yield a 128 bit value, and then xor:ing that result's first half with the result's second half again to yield a 64 bit value.

This 64 bit value will of course never be able to represent all the possible values of the 256 bit hash either but it will not be possible to start with this value and calculate a collision for your original 256 bit hash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top