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
"I saved the password in base64, so it's encrypted" – say this in an interview and you are rejected on the spot! Base64 is only encoding; anyone can decode it with one command. Encoding = format, hashing = fingerprint, encryption = a lock with a key. Remember firmly that these three are different.
Ravindra Bagale's Tip – मराठी
"Password base64 मध्ये save केला, म्हणजे encrypt केला" – हे interview मध्ये म्हटले तर तिथेच rejection! Base64 हे फक्त encoding आहे, कोणीही एका command ने decode करतो. Encoding = format, hashing = fingerprint, encryption = key ने कुलूप. हे तीन वेगळे आहेत हे पक्के लक्षात ठेवा.
Ravindra Bagale's Tip – हिंदी
"Password base64 में save किया, मतलब encrypt किया" – interview में यह कहा तो वहीं rejection! Base64 सिर्फ़ encoding है, कोई भी एक command से decode कर लेता है. Encoding = format, hashing = fingerprint, encryption = key वाला ताला. ये तीनों अलग हैं, यह पक्का याद रखो.
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?