# For SHA3-512, SHA512, and Whirlpool, which algorithm has least probability for collision and preimage collision?

For comparing these 3 hash functions SHA3-512, SHA512, and Whirlpool. Which one is strongest against collision and preimage attacks. Are they fundamentally the same because of the same size output? Please disregard all other characteristics of the algorithms.

• "Are they fundamentally the same because of the same size output? Please disregard all other characteristics of the algorithms" ... so yes? – Richie Frame Mar 11 at 20:09
• @kelalaka Thanks! I just didn't realize it's that simple. – 7r4c0r Mar 11 at 20:28
• @kelalaka Actually not homework, I'm working on a project that will store a huge number of hash results, and I need a key value for the database, one that will be least prone for collision. Your answer tells me I should simply append the 3 and make that the key. – 7r4c0r Mar 11 at 20:32
• Actually, you can assume that none of these algorithms will ever collide. Yes, it's possible; it's so improbable that it can practically be ignored... – poncho Mar 11 at 20:51
• if for some reason you are looking for even higher than the collision resistance of the above hashes, plain Keccak with a 1024-bit rate has 288-bit collision resistance at reduced performance – Richie Frame Mar 11 at 23:52

• Generic expected pre-image resistance for a hash function with $$n$$-bit output is $$\mathcal{O}(2^n)$$
• Generic expected collision resistance for a hash function with $$n$$-bit output is $$\mathcal{O}(\sqrt{2^n}) = \mathcal{O}(2^{n/2})$$ due to the generic birthday attack on the hash functions.
$$\begin{array}{|c|c|c|c|}\hline \text{name} & \text{output size} & \text{pre-image resistance} & \text{collision resistance} \\ \hline \operatorname{SHA-512} & 512 & \mathcal{O}(2^{512})& \mathcal{O}(2^{256}) \\ \hline \operatorname{SHA3-512} & 512 & \mathcal{O}(2^{512}) & \mathcal{O}(2^{256}) \\ \hline \operatorname{Whirlpool}& 512 &\mathcal{O}(2^{512}) & \mathcal{O}(2^{256}) \\ \hline \end{array}$$