0

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.

Community
  • 1
  • 1
zztops
  • 694
  • 1
  • 5
  • 11

1 Answers1

0

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.

rici
  • 234,347
  • 28
  • 237
  • 341