DEV Community

Cover image for Encryption ,Hashing , Encoding,...
Hasan Elsherbiny
Hasan Elsherbiny

Posted on

Encryption ,Hashing , Encoding,...

In the world of internet no data is save ,this is a fact so we need ways to protect our transferred data over the internet.

the first approach we use to protect our data is to put on a cover, this cover is to change how data look so if it's being hacked by someone this data is useless.

Encryption ,Hashing , Encoding,...

1) Encryption

in this method we lock our data (encrypt) using a key ,send data over and when data is received it's being unlocked (decrypt) and can be safely read.
we call this method two ways encryption (because we encrypt / and decrypt it back).

so if any one has the encrypted data it's useless and he MUST has the required key to unlock (decrypt) data back into it's original data

Encryption ,Hashing , Encoding,...

Encryption Has many methods but the most famous ways are

  • Symmetric Key
    this way the same key is used to encrypt and decrypt data

  • Asymmetric Key
    this way we have a pair of keys one is used to encrypt data called (public key) , another one is used to decrypt data called private key.

Use cases for Encryption

  • TLS/SSL Encryption
  • Email Encryption
  • Protecting Payment Transactions

2) Hashing

this method is about generating unique value for input data, this generated hash is irreversible (meaning if you have hash and key you cannot get your input data back and this is called also one way encryption), ok this is a little bit confusing if we cannot get input back how this hash is useful?

the catch here is how we use hashing, unlike encryption we don't use hashing for transferring data but to ensure that the transferred data is accurate like password, user input the password the password is hashed and saved into the database, so the service provider cannot get user password back, when user enter password again it's hashed again using the same hashing method and hashing key, then we comparing the output and user's stored hashed password, since hashing output is unique for every input so if user inputs different password the hashing is also different.

Encryption ,Hashing , Encoding,...

Hashing Use Cases

  • Password Storage
  • Data Integrity Verification
  • Digital Signatures
  • Data Deduplication

3) Encoding

even the word encoding maybe similar to encrypting but in fact encoding doesn't concentrate on hiding data but on unifying the data format for transmission, for example if you are transferring data written in another language (Arabic for example) this data should be encoded to another format so it doesn't get miss saved or lose some important information
that means you don't need to have some keys to encode or decode your data

Encryption ,Hashing , Encoding,...

Top comments (0)