Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 27, 2022 03:49 pm GMT

Encode, Encrypt, and Hash

In general, the meaning of encode is to convert something into code. We usually do encoding for Personal Identifiable Information (PII) because it contains sensitive data such as password, card number, etc.

According to the ability to decode the encoded data, there is two types of encoding: encryption and hashing.

Encryption

When we encrypt something, we always can do the decryption. I would say this seems like when you put something in the box and lock it. Well, as long as you know the secret, you can unlock and get what's in the box.

Encryption usually is implemented to protect data from the outside but at the end of the day programmer needs to know the data. Encrypted data could be found in email such as verify account, forgot password, etc.

Below is an example functions to do encryption-decryption:
Image description

Hashing

On the other hand, hashing can not do that kind of decode. Once you hash something, you can not know what the "something" really is. Even though it literally hashes your data, I would say that you still could know what kind of thing the "something". Just imagine the criminal scene: you got potential suspects and blood of suspect in crime scene. Here, the blood is the result of hash the potential suspect. By comparing the DNAs, we could know that the blood is comes from the suspect.

Hashing usually is implemented for password. Although programmer who creates the program, programmer is not allowed to know user's password. A program must be designed to save user's password in the form of hashed password in database. None of way to decode it.

The following is example of hashing-comparing implementation:

hashing

comparing


Original Link: https://dev.to/ditaisy/encode-encrypt-and-hash-8de

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To