DEV Community

Discussion on: A Quick Introduction: Hashing

ashleyjsheridan profile image
Ashley Sheridan

Just a quick point, but it's important. As the hash can't be 100% guaranteed to be unique (it's just highly likely to be unique) it can only be used to determine if something is different, not to see if two things are the same (although the typical mis-use is to compare for similarities). Given the hash space of Sha1, it's fairly unlikely there will be a hash collision, but not impossible (just look to the recent issues on WebKits SVN repository caused by hash collisions). Like I said, it's a small point, but an important one nonetheless.

dean profile image
Dean Bassett

Hashes are also used for passwords, which are the epitome of "hey, make sure that the hash is unique to only one password!"

It's important to know that there are special hash algorithms for passwords that are specifically made for shorter strings (rather than files), and take a relatively long time to compute (so that it's harder to brute-force them).