Is “double hashing” a password less secure than just hashing it once?

后端 未结 16 1951
梦谈多话
梦谈多话 2020-11-22 08:09

Is hashing a password twice before storage any more or less secure than just hashing it once?

What I\'m talking about is doing this:

$hashed_password         


        
16条回答
  •  梦如初夏
    2020-11-22 08:52

    In general, it provides no additional security to double hash or double encrypt something. If you can break the hash once, you can break it again. It usually doesn't hurt security to do this, though.

    In your example of using MD5, as you probably know there are some collision issues. "Double Hashing" doesn't really help protect against this, since the same collisions will still result in the same first hash, which you can then MD5 again to get the second hash.

    This does protect against dictionary attacks, like those "reverse MD5-databases", but so does salting.

    On a tangent, Double encrypting something doesn't provide any additional security because all it does is result in a different key which is a combination of the two keys actually used. So the effort to find the "key" is not doubled because two keys do not actually need to be found. This isn't true for hashing, because the result of the hash is not usually the same length as the original input.

提交回复
热议问题