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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.