tags:

views:

35

answers:

1

If I use MD5, as an example, twice with some data, will it increase the probability of collision?

And what about SHA?

I am asking this because I thought of hashing a password in the client and then again in the server.

+3  A: 

Are you talking about keeping the single-hashed values and the double-hashed values and worrying about a collision between them? If so then the answer is yes, it will double the probability of a collision. However as this means it will rise from a tiny value (can't remember exactly 2^-90 ish) to a slightly larger tiny value (2^-89) you don't need to worry about it.

If you are only keeping the double-hashed valued then: no, the probability of collision between them will remain the same.

Despite this you should ask yourself what you are trying to achieve by hashing the values twice as it is almost certainly pointless. There is more information about collision probabilities in this old question.

Amoss