Hashing

Hashing is a cryptographic operation that transforms data from one form to another in such a way that it is very difficult (practically impossible) to derive the original data when all you know is the transformed data.

For example, the SHA-256 hash (also called a “checksum” or a “digest”) of the character string SaneSecurity=1 is:

a7557be893d57c1ef53ecd421916f17a1069caaa4d319b551a7706be9ee72780

This way, I can use SaneSecurity=1 as my password for my account, while never having SaneSecurity=1 stored on any database.

Let’s say I’m setting up a Gmail account. Instead of Gmail storing my password, they can store the hash of my password:

a7557be893d57c1ef53ecd421916f17a1069caaa4d319b551a7706be9ee72780

And whenever I try to log in, they’ll take my input from the password field and hash it with the SHA-256 algorithm to see if the result matches:

a7557be893d57c1ef53ecd421916f17a1069caaa4d319b551a7706be9ee72780

If I accidentally type SaneSecurity=0 instead, then the result will be:

83b7333d442cd44fd0bd2b64a0868fc8dcc0e1690e764b645cbf1d6b069608d5

A completely different result, leading to a failed login!

And if anybody at Gmail ever decides to sell access to every Gmail account’s password, or if hackers ever hack into Gmail’s servers and download the entire password database, all they’ll have is the hash of my password, which is very difficult (practically impossible) to turn back into the original character string SaneSecurity=1.

And you can hash much more than just character strings; you can hash entire files to see if they’re different or exactly the same. You can also use hashes as extremely unique labels for things, like how Git uses SHA-1 hashes to label git commits.