Skip to content
CryptoAcademy logo CryptoAcademy
Menu
Lesson Beginner · 12 min

What is encryption?

Encryption turns plaintext into ciphertext with a key, and back again. Unlike hashing, it is designed to be reversed — by exactly the people holding the right key.

In this lesson

  • Describe encryption, decryption, key and nonce
  • Tell symmetric and asymmetric encryption apart
  • Give three real systems that rely on encryption

Readable only with the key

An encryption algorithm takes plaintext, a key and (usually) a nonce — a value that must never repeat for the same key — and produces ciphertext. Decryption with the correct key restores the plaintext; with the wrong key you get noise.

The two families of encryption
Symmetric encryption uses one shared key; asymmetric uses a public and a private key Symmetric — AES-GCM Same key encrypts and decrypts Plaintext pay 1 BTC Ciphertext a9f3…1c Shared key K secret, 256-bit Fast · problem: how to share the key safely? Asymmetric — RSA / ECDSA A public key and its private key are a pair Public key shared with everyone Private key never leaves the owner mathematically linked (trapdoor) Anyone encrypts → only owner decrypts Slower · solves key distribution and signatures How the web combines both (TLS) 1. Your browser fetches the site's public key inside a certificate. 2. Both sides derive a temporary symmetric session key (key exchange). 3. Everything after that is encrypted fast with AES-GCM — signatures only prove who you are.
Symmetric: one shared key. Asymmetric: a matched pair. Modern protocols use both together.

Example · Where encryption already protects you

HTTPS on every website you visit, the lock screen on your phone (full-disk encryption), Signal and WhatsApp messages, cloud backups, and the encrypted volume on your laptop drive — all of it is symmetric encryption under the hood, usually AES-GCM.

Symmetric (AES)
  • One key, shared secretly
  • Very fast — used for bulk data
  • Problem: how do you share the key?
  • AES-256-GCM is the modern default
Asymmetric (RSA / ECC)
  • Two keys: public + private
  • Slow — used for key exchange and signatures
  • Solves key distribution
  • X25519 / Ed25519 are the modern defaults
encrypt.py python
from cryptography.fernet import Fernet\n\nkey = Fernet.generate_key()          # symmetric key\nfernet = Fernet(key)\n\nciphertext = fernet.encrypt(b"meet at noon")\nprint(ciphertext)\nprint(fernet.decrypt(ciphertext))     # b"meet at noon"

Encryption without key management is theatre

Algorithms rarely fail — key handling does. Hard-coded keys in source, keys in URLs, or screenshots of recovery codes leak ciphertext as easily as plaintext. Rotate, store and transport keys deliberately.

Start with a broken cipher

The Caesar cipher is encryption with a key of 1-25. Break it by brute force in the lab, then compare with AES.

Try it yourself
Is encryption reversible? Isn't that weak?

Reversibility is the point: encryption protects confidentiality, hashing protects integrity. Different jobs, different tools.

What is a nonce?

A number used once. In AES-GCM reusing a nonce with the same key destroys confidentiality and authenticity — modern libraries enforce unique nonces for you.

Share this page

Send this link to a friend, or scan the QR code to open it on your phone.