0
votes

I have read the question "Why should hash functions use a prime number modulus?" and understand it's answer.

I am wondering if a hash table that uses a cryptographic hash function such as SHA2 would experience more clustering if the table had a non-prime modulus.

1

1 Answers

0
votes

A cryptographic hash function should certainly be uniformly distributed in any modulus, prime or composite. If there were significant clustering for any modulus value, that would reduce the function's collision-resistance.

The "usual advice" about using primes does not expect the prime to be 2, or any other smallish number. On the whole, the problem with using a composite is not so much that it's composite as that it has a small prime divisor, like 2.