Frontend Weekly
Published in

Frontend Weekly

Beginner’s guide to encoding, encryption and hashing

In this article, let’s explore the above three topics, their uses, examples and how they are different from each other.

Encoding:

  • Encoding is a process of converting the data or a given sequence of characters, symbols, alphabets etc. from one format into another format using a scheme that is publicly available.
  • It ensures data usability by transforming the data.
  • Example: ASCII, UNICODE, URL encoding, Base64
Base64 encode and decode online tool

Decoding is just the opposite of encoding, the content or data that is encoded can be decoded using the same algorithm, therefore it is a reversible process. No key is required to encode and decode the data.

Encryption:

  • Encryption also transforms data from one format into another however unlike encoding there is a key required to decrypt the data that is encrypted.
  • Its purpose is to maintain data confidentiality by keeping it unreadable from others.

There are two types of encryption:

1. Symmetric encryption:

  • In symmetric encryption only one key is required to encrypt and decrypt the data.
  • Example: AES(advanced encryption standard uses only 128 bit or 256 bit keys)
AES encryption and decryption online tool

2. Asymmetric encryption:

  • Asymmetric encryption uses a pair of key to encrypt and decrypt the data and these keys are called public and private key.
  • The data encrypted with private key can be decrypted with public key and vice-versa.
  • Example: RSA(uses 2048 to 4096 bit keys)
Online RSA encryption, decryption and key generator tool

Symmetric encryption is faster than asymmetric encryption because keys used are much smaller.

Hashing:

  • Hashing transforms arbitrary length of data into fixed length of string using a hashing algorithm.
  • It ensures data integrity.
  • Hashing is irreversible process, same input will produce same output and no two inputs will produce same output.
  • It is used to generate memory-addresses corresponding to keys in Dictionaries, Maps, Objects, Key-value pairs.
  • As hashing is a one way function it is also used to store passwords and other critical info.
  • Example: SHA-256
SHA-256 online tool

--

--

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