DEV Community

Cover image for A Quick Introduction: Hashing

A Quick Introduction: Hashing

Gerald Nash ⚡️ on April 02, 2017

What is it? Hashing is a method of determining the equivalence of two chunks of data. A cryptographic hash function generates a unique s...
Collapse
 
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.

Collapse
 
dean profile image
dean

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).

Collapse
 
engineercoding profile image
Wesley Ameling

I would not recommend shadowing the built in hash function, as it may cause problems. I'd name the import crypt_hash, just to distinguish between the two. Other than that this is a good article! Simple and to the point as I like it :)

Collapse
 
lt0mm profile image
Tom • Edited
Hashing is a method of determining the equivalence of two chunks of data. 
A cryptographic hash function generates a unique string for any set of data. 

First two lines more mislead than explain, and as Ashley Sheridan pointed out they are not completely correct.

Collapse
 
anaptfox profile image
Taron Foxworth

This is a great, simple article!

Collapse
 
raont profile image
Nageswara Rao Teppala

Sweet and Simple.

Collapse
 
brunojennrich profile image
bruno jennrich

what abount salting?

Collapse
 
aswathm78 profile image
Aswath KNM

Thought it was an article about Data Structures . Nice One . But try to write something more .