| Every hash function has a probability of collisions. For illustration, let's imagine a really bad one where every output has another input that results in the same value. With a single round of hashing, there are two possible inputs A1 and A2 that can produce the final output O. With a sufficiently large number of potential inputs, it will take you a while to brute force and enumerate all possible inputs before you hit on either A1 or A2. With two rounds of hashing, there are two possible inputs A1 and A2 that can produce the final output O, and two possible inputs B1 and B2 that can produce the intermediate hash A1, and two possible inputs B3 and B4 that can produce the intermediate hash A2. With three rounds of hashing you end up with something like this: C1 C2 C3 C4 C5 C6 C7 C8
\ / \ / \ / \ /
B1 B2 B3 B4
\ / \ /
\ / \ /
A1 A2
\ /
------O------
So with each round of hashing you are increasing the number of collisions, meaning you're likely to brute force an input that will hash to O much quicker.[Edit]
Of course, with each round you're also increasing the amount of time to compute O, but given most hashing algorithms are designed to be fast I'd say it's probably not enough to counter it. Not sure though, I've not actually looked at the maths. |
You need to find some way to mitigate the collisions, at which point you've basically got bcrypt.