Question on problem 13.17 hash function for chess

#1

Is there any reason we use 64-bit random codes instead of 32-bit ones? 32 bits can also create 832 random codes right? Just wanted to make sure I understood the logic correctly. Thanks!

1 Like

#2

You are right, 32-bit is feasible, and the reason we use 64-bit is simply because we want to avoid hash collision (which is low).

0 Likes

#3

@tsunghsienlee

Does the hash collision you say we need to avoid occur because XORing two different sets of 32/64 bits might actually produce identical results? For example, 111 xor 111 is 000. But 101 xor 101 is also 000.

0 Likes

#4

Hash collision is not considered in this situation.

0 Likes

#5

I’m actually referring to your earlier answer where you mention hash collision

0 Likes

#6

You shall consider that when designing but it is really hard to prevent from it 100%.

0 Likes