the three terms encoding, encryption and hashing sounds pretty similar but they are used for completely different purposes.
Encoding
it is not about security at all. encoding is simply data representation, changing data from one format to another so that it can be easily transmitted or understood by another system.
- it uses public algos that anyone can access
- there is no secret key and its fully reversible
- the main goal is usability and not secrecy
eg - when you see a website url like :
`https://www .google.com/search?q=hello%20world`,
the space in "hello world" is encoded as %20.
common encoding formats are: url encoding, ascii, unicode.
Encryption
- encryption involves security. in encryption, the readable data, i.e plain text, is converted into unreadable, i.e cipher text, using an encryption key.
- only someone with the right key can decrypt it back to the original data.
- it used for secure online transactions, encryption of files and msges.
there are two main types:
> symmetric encryption - same key for encryption and decryption (AES )
> asymmetric encryption - there are two keys, public and private ( RSA )
eg- when you send a msg on whatsapp, your msg is encrypted on your device, before it is sent. it can only be decrypted on your friend’s phone.
Hashing
hashing is a one way process used to check if the data has been altered. it is used for data integrity verification.
- hashing transforms the input data of any size into a fixed length unique string i.e a hash.
- once the data is hashed, the original input cannot be retrieved.
- even a small change in input changes the hash output completely.
eg - when you create an account and set a password, websites don't store your actual password. instead, they store the hash of it.
when you log in it, the entered password is hashed again and if both hashes match, you are logged in.