Encryption vs. hashing vs. encoding

pandaquests
Feb 20 · 3 min read

Encryption, encoding, and hashing are often mistaken or (wrongly) used interchangeably. Because, let’s face it, you take a text, do some processing with it and the result is some random mud of text — this description could fit to encryption, encoding, or hashing either way. So it is understandable why people confuse them.

But the difference is critical. If you work in IT you should know these terms, and more importantly know the difference between then. In this article I’ll explain to you in simple terms the differences betweeen encryption, encoding, and hashing.

Image for post
Image for post
Photo by Markus Spiske on Unsplash

Encryption

Encryption is a method to obfuscate information so that illicit reading of it’s original content is prevented. One main attribute of encryption is the ability to reverse the process of obfuscate so that the authorised receiver can read the original content. This process is called decryption. Usually encryption is done using a special key. Another attribute of encryption is, that it is secure enough so any third party will have a hard time decrypting it simply by guessing it.

There are two main types of encryption: Symmetric and asyimmetric encryption. I wrote an article about encryption here.

Hashing

Is the process of converting a message of variable length into another message of fixed length. For example I could use this tool in order to hash the message “Hello”. The result is:

“185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969”

I can do it again only changing one letter from “e” to “a” into “Hallo”, the result will look like this:
“753692ec36adb4c794c973945eb2a99c1649703ea6f76bf259abb4fb838e013e”

Both hased results have the same length. You may think it’s because the original message has the same length. But I can try it with a shorter message “Hi” and the result would look differently but still has the same length:

“3639efcd08abb273b1619e82e78c29a7df02c1051b1820e99fc395dcaa3326b8"

The difference to encryption is, that this process of converting a text into a hash is not reversible. The main purpose of encryption is that only unauthorized people must not read it, however, authorized people should be able to read it. This is not possible with hashing.

Nevertheless, hashing is very important in IT security. For example hashing is used for storing your password on servers. Your password is stored on the server only hashed, but no one knows (and should not know) the original content, because the hash can not be reversed. Hashing is also used to verify that a message remain uncompromised.

Encoding

Encoding only means converting a text format into another, so it can properly be consumed by other systems. For example you have plain text but the system that consumes the data can only understand binary. Therefore you have to encode the text into binary. Encoding formats are for example ASCII/UTF-8, ASCII/UTF-16, binary, etc.

Using this tool, you can encode the text (in encoding format ASCII/UTF-8) “Hello” into binary. The result is: “1001000 1100001 1101100 1101100 1101111”. By using tools like this, you can decode the message back to plain text, i.e. ASCII/UTF-8.

You might say “1001000 1100001 1101100 1101100 1101111” is not readable for a human and you can reverse the process. So, why is it not considered encryption? The reason is that the main purpose of encoding is not hiding data from unauthorized eyes also you can guess what the original message was simply by trying out all encoding format, because the “key” (actually it’s called sheme) to convert it back is publicly available.

Conclusion

Encryption, hashing, and encoding are similar. But they differ in crucial aspects from each other. In the following table I outline the main difference between them:

Image for post
Image for post

I hope after reading this article, you’ll never confuse one for the other anymore. Have you mistakenly used them before? Where do you use encryption, hashing, and encoding. Comment below and let me know.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data…

Sign up for Analytics Vidhya News Bytes

By Analytics Vidhya

Latest news from Analytics Vidhya on our Hackathons and some of our best articles! Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

pandaquests

Written by

°(p.q)° I mainly write about working in IT and software related topics. I’m a cute panda. Follow me.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

pandaquests

Written by

°(p.q)° I mainly write about working in IT and software related topics. I’m a cute panda. Follow me.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store