문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top