Cryptography and Encoding Basics
Three primitives
Symmetric encryption (AES, ChaCha20) uses one shared key: fast, but key distribution is the hard problem. Asymmetric encryption (RSA, ECC, Diffie–Hellman) uses a public/private pair: slow, and used mainly for key exchange and signatures. Hybrid systems such as TLS use an asymmetric handshake to agree on a symmetric session key, then encrypt bulk data symmetrically.
Hashing (SHA-256) is one-way, fixed-length, and exhibits the avalanche effect; it provides integrity, not confidentiality - you cannot decrypt a hash. A salt defeats precomputed rainbow tables; an HMAC is a keyed hash giving integrity plus authenticity.
Key usage rules
To encrypt for a recipient, use the recipient's public key. To sign as a sender, use your own private key; anyone verifies with your public key, producing non-repudiation. Certificates bind an identity to a public key and are vouched for by a certificate authority inside a PKI.
Encoding is not encryption
Base64 maps 3 bytes to 4 characters (about 33% overhead, '=' padding) and hides nothing. Hex, URL-encoding, ROT13, and ASCII art are all trivially reversible transformations.
Traps
Asking what decrypts a hash; assuming Base64 provides security; reversing which key does which job; believing symmetric crypto is slower than asymmetric.
Worked example
Base64 of "Man": 3 bytes → 24 bits → four 6-bit groups → "TWFu". Rule of thumb: Base64 output length ≈ 4/3 × input length, so a 1 KB blob becomes roughly 1.33 KB.