This content originally appeared on DEV Community 👩💻👨💻 and was authored by Dita Larasati
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:
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:
This content originally appeared on DEV Community 👩💻👨💻 and was authored by Dita Larasati
Dita Larasati | Sciencx (2022-11-27T15:49:19+00:00) Encode, Encrypt, and Hash. Retrieved from https://www.scien.cx/2022/11/27/encode-encrypt-and-hash/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.