The Art of Secret Writing
Cryptography ensures Confidentiality and Integrity. It is the math that allows the internet to function securely.
1. Hashing (Integrity)
One-way math. You can turn "Hello" into a hash, but you can't turn the hash back into "Hello". Used for password storage and file verification.
- Algorithms: MD5 (Broken, do not use), SHA-256 (Standard).
2. Symmetric Encryption (Confidentiality)
The same key locks and unlocks the data. Fast, but you have to safely share the key.
- Algorithms: AES (Advanced Encryption Standard).
3. Asymmetric Encryption (Public Key)
Two keys: A Public Key (to lock) and a Private Key (to unlock). Solves the "key sharing" problem.
- Uses: SSH, HTTPS (TLS), PGP.
🔬 Lab Exercise: GPG Encryption
Objective: Send a secret message.
- Create a text file named
secret.txt. - Install GPG.
- Encrypt the file with a password (Symmetric):
gpg -c secret.txt. - This creates
secret.txt.gpg. - Delete the original.
- Decrypt it:
gpg -d secret.txt.gpg.