While encryption is one of the best and most popular online protection tools, it's not the only way to shield your data. Take hashing, for example. While it’s similar to encryption, there are differences in how it works and where it can be used. But what is hashing? And how does it work?
Nov 22, 2021 · 4 min read
Hashing is a process that transforms your data into a random fixed-length value, using a hash function. For example, a piece of plain text (a password, for example) can be turned into a hashed value, making it very hard to decipher.
Hashing is a one-way process, which can't be directly reversed (as opposed to encryption, which can be decrypted if you have the appropriate decryption key). When companies store user data (usernames and passwords, let’s say), they can use hashing to ensure that the information stays private, even if they suffer a data breach.
Moreover, hashing ensures the integrity of data. When you send a hashed file to a friend, you provide a hashed value along with the message. A friend then calculates the hash value —if the values match, then the file hasn’t been tampered with while in transit.
Hashing is usually used to deal with large amounts of data. It is easy to find the hashed data and also avoid data duplication. Hashing is a fast, efficient way to keep huge troves of data safe, and to ensure its integrity.
An algorithm generates hash values, also known as hash functions. The hashing algorithms provide different hash values for different keys. So one unique input string should have a unique hash value.
However, there are rare cases when keys use identical hash values. This can result in the so-called hash collision.
A defining feature of any hashing algorithm is how collision-resistant its hash functions are. Collision is a hash-function vulnerability that bad actors can potentially exploit, so a good hashing algorithm should be complex enough to avoid collisions.
Encryption is the process of encoding data using algorithm. Encryption protocols scramble the data, so it becomes undecipherable to anyone except the intended recipient, who has the necessary key to reverse the decryption process. Unlike hashing, encryption is a two-way process — information is encrypted and then decrypted when it reaches the intended receiver.
Encryption also secures sensitive data as well as general online traffic. It should make your internet traffic indecipherable to interceptors — smart encryption algorithms are almost impossible to crack without the necessary key.
So what is the difference between hashing and encryption? While both hashing and encryption protect your data from rogue external interventions, there are also significant differences between them:
Similarly to encryption, hashing can have various algorithms that differ in their strength:
Here are some examples of hash usage:
And here are a few common use-cases for encryption: