The most primitive hash function is a simple modulus
. However, it fails all the requirements of a secure hash
function, and it's not even advisable to use it for a hash table
because it doesn't defend well against skew
But most good cryptographic hashing algorithms (like SHA-1 or MD5) are not particularly complex either, and if they were, that would actually make them less secure. Why? First, security through obscurity is not much security at all. A cryptographically "hard" algorithm usually depends on some kind of trapdoor function, which has been thoroughly examined by mathematicians. If none of them found a way to reverse it, you assume that there is no way. However, the more complex the algorithm is, the more likely it is that it actually has some weaknesses that just hasn't been found yet (or, worse, has only been found by the NSA or similar agencies).