33.1 Goals and the Big Three: Encoding, Hashing, Encryption
Cryptography protects four things, often remembered as CIA + non-repudiation:
| Goal | Meaning | Tool |
|---|---|---|
| Confidentiality | Only the right people can read it | Encryption |
| Integrity | Nobody changed it | Hashing, MAC |
| Authentication | It really came from who it claims | Signatures, certificates, MAC |
| Non-repudiation | The sender cannot deny sending it | Digital signatures |
Now the trio students mix up:
| Encoding | Hashing | Encryption | |
|---|---|---|---|
| Purpose | Change format for transport | Fingerprint / integrity check | Keep data secret |
| Key needed? | No | No | Yes |
| Reversible? | Yes, by anyone | No (one-way) | Yes, only with the key |
| Example | Base64, URL encoding | SHA-256, bcrypt | AES, RSA |
echo -n "Pune123" | base64 # UHVuZTEyMw== (encoding – NOT security)
echo "UHVuZTEyMw==" | base64 -d # anyone can decode it
echo -n "Pune123" | sha256sum # one-way fingerprint
Ravindra Bagale's Tip
"Password base64 madhe save kela, mhanje encrypt kela" – he interview madhe mhanla tar tithech rejection! Base64 he fakt encoding aahe, kuni hi ek command ne decode karto. Encoding = format, hashing = fingerprint, encryption = key ne kulup. He teen vegle aahet he pakka lakshat theva.
Practice task
Encode your name in Base64 and decode it. Hash the same text with md5sum, sha1sum and sha256sum and note the output length of each. Change one letter and hash again – how much of the hash changed?