Encryption

Encryption Explained: What It Is and How It Protects You

Encryption explained: learn what it is, how the algorithm and key protect your data, and the mistakes that leave millions of records exposed every year.

Editorial Team ·
8 min read beginner

Introduction

In 2023, the MOVEit breach exposed the personal records of more than 60 million people. The files were transmitted without encryption. Attackers intercepted the data, sold it on criminal markets, and triggered billions of dollars in regulatory fines and reputational damage. That breach was entirely preventable.

Encryption explained simply: it converts your readable data into scrambled noise that is useless to anyone without the right key. Even if an attacker copies your files off a compromised server, they see only random characters. The original content stays completely hidden. That one property — making stolen data worthless — is why encryption is the single most important control in data security.

This guide covers what encryption is, how the algorithm and key work together step by step, and where encryption protects you every day — from your browser to your hard drive. You will also learn the mistakes that render encryption useless in practice and the concrete steps you can take right now.

You do not need a background in mathematics. Encryption is a tool. Understanding how it works lets you choose the right tool, configure it correctly, and avoid the traps that cause real-world breaches.


Encryption Explained: What It Is

Encryption is the process of transforming readable data — called plaintext — into a scrambled, unreadable format called ciphertext, using a mathematical algorithm and a secret value. Only someone who holds the correct secret can reverse the transformation and recover the original data. The goal is simple: make your data useless to anyone who is not supposed to have it.

Encryption has existed for thousands of years. Roman generals communicated with field commanders using the Caesar cipher — shifting each letter in the alphabet by a fixed number of positions. A became D, B became E, and so on. Anyone who knew the shift number could decode the message. Anyone who did not was left with gibberish.

Modern encryption works on the same principle, but the “shift” is replaced by mathematical operations across entire blocks of data. These operations are designed so that reversing them without the key would take a classical supercomputer billions of years. The algorithm itself is public knowledge — security comes entirely from the secrecy of the key, not the secrecy of the method.

There are two main families. Symmetric encryption uses the same key to both encrypt and decrypt data. It is fast and well suited for large files. Asymmetric encryption uses a mathematically linked pair: a public key that anyone can use to encrypt a message, and a private key that only you hold to decrypt it. In practice, most systems combine both: asymmetric encryption to exchange a temporary symmetric key, then symmetric encryption for the actual data.


How Encryption Works

Every encryption operation follows the same basic sequence, regardless of the specific algorithm.

  1. Plaintext in. You start with the data you want to protect — a document, a photo, a database record, or a message.
  2. Choose an algorithm. You select a mathematical procedure that will scramble the data. For files and stored data, AES-256 is the current global standard. For data in transit between applications, ChaCha20 is a widely used alternative.
  3. Apply a key. A key is a string of random bits — 256 bits for AES-256, which is 32 random bytes. The algorithm uses the key to control exactly how it scrambles the data. The same plaintext encrypted with two different keys produces two completely different ciphertexts.
  4. Add a nonce. A nonce (also called an initialization vector or IV) is a random value generated fresh for every single encryption operation. Its purpose is to ensure that encrypting the same file twice — with the same key — always produces different ciphertext. The nonce is not secret; it travels with the ciphertext so the receiver can use it during decryption.
  5. Ciphertext out. The output looks like random bytes. It contains no recognizable structure, no readable words, and no clues about the original data.
  6. Authentication tag. Modern algorithms attach a short authentication tag to the ciphertext. This tag is a fingerprint of the encrypted data. When the receiver decrypts, the algorithm checks the tag first. If anyone has modified even a single bit of the ciphertext, the tag check fails and decryption is rejected.

The combination of confidentiality (no one can read it) and integrity (no one can silently change it) is called authenticated encryption. For cloud storage where the provider never sees your key, zero-knowledge encryption extends this guarantee further. The mode that delivers both is called AEAD — Authenticated Encryption with Associated Data. AES-256-GCM is the most widely deployed AEAD mode today, recommended by both NIST and OWASP for new systems.

The cyan path is the normal encryption flow; the magenta path shows what happens when the key is lost or stolen — the ciphertext becomes readable to anyone.
Watch how plaintext, a key, and an algorithm combine to produce ciphertext — and how the public/private key pair solves the key-sharing problem.

Encryption vs Hashing

Hashing is often mentioned alongside encryption, but the two serve fundamentally different purposes and must not be swapped. Confusing them is one of the most common causes of preventable data exposure.

FeatureEncryptionHashing
Reversible?Yes — with the correct keyNo — one-way transformation
Key required?YesNo
Output sizeApproximately the same as the inputFixed (e.g., 256 bits for SHA-256)
Primary useProtecting data you need to retrieve laterVerifying integrity; storing passwords
Example algorithmsAES-256, ChaCha20, RSA-4096SHA-256, bcrypt, Argon2id
If attacker gets the outputUseless without the keyCannot recover original (with a strong algorithm)

Use encryption when you need to get the original data back later — a file you will open again, a message the recipient must read, or a database field you will display in your application. Use hashing when you only need to verify something. Storing passwords is the clearest example: at login, the system hashes what you type and compares it to the stored hash. The real password is never kept anywhere.

Storing passwords with encryption is a widespread mistake. If an attacker steals the encryption key — often stored on the same server as the data — every password is exposed at once. A proper password hashing function like Argon2id makes each entry independent. Compromising one password does not compromise others, and there is no master key to steal.


Real-World Use Cases

Encryption runs continuously in the background of modern digital life. Here are three specific scenarios where it protects you every day.

Secure web browsing with HTTPS. Every time your browser shows the padlock icon, TLS 1.3 is running. Your browser and the web server perform an asymmetric handshake to agree on a short-lived symmetric key, then use that key to encrypt every byte of the connection. Login credentials, payment details, and form data all travel as ciphertext. Without TLS, anyone on the same Wi-Fi network could read your session in plain text using freely available tools.

File and disk encryption. Tools like VeraCrypt (cross-platform), FileVault (macOS), and BitLocker (Windows) encrypt your entire disk or specific volumes. If your laptop is stolen, the attacker has hardware — not data. Password-based file encryption tools use AES-256-GCM and derive the encryption key from your password using Argon2id. The strength of your password directly determines how hard it is for an attacker to brute-force the key.

End-to-end encrypted messaging. Signal, and WhatsApp in its default mode, encrypt your messages on your own device before they leave it. The ciphertext travels through the platform’s servers, but those servers hold no decryption keys. The message decrypts only on the recipient’s device. This model is called end-to-end encryption (E2EE): the service provider genuinely cannot read your conversations, even under a legal order.


Common Mistakes to Avoid

Encryption fails almost never because of a flaw in the algorithm. It fails because of errors in how it is used. These are the patterns that appear most often in real-world post-breach analysis.

Skipping authentication. Encrypting without an authentication tag protects confidentiality but leaves integrity open to attack. An adversary who intercepts ciphertext can modify specific bytes. The receiver decrypts corrupted data and never detects the change. AES-CBC is the most common example of a mode that lacks built-in authentication. Always use an AEAD mode — AES-256-GCM — that verifies integrity during every decryption step.

Reusing a nonce. Using the same nonce twice with the same key in AES-GCM is catastrophic. It leaks the keystream and lets an attacker recover plaintext from any message encrypted with that key. Every encryption operation must generate a fresh, random nonce. This rule has no exceptions.

Weak key derivation from passwords. Turning a human-chosen password into an encryption key requires a key derivation function (KDF). Using a fast hash like SHA-256 directly is insecure — attackers can test billions of guesses per second on a consumer GPU. Argon2id and PBKDF2 are designed to be deliberately expensive to compute, which makes brute-force attacks economically impractical.

Storing the key near the encrypted data. If your encryption key lives in the same folder as the encrypted file, or in a configuration file on the same server, the encryption provides almost no protection. Treat the key as at least as sensitive as the plaintext. Use separate, protected key storage — a hardware security module, a cloud key management service, or a password-protected file kept on a different device entirely.

Using deprecated algorithms. DES and 3DES are formally deprecated by NIST. MD5 and SHA-1 produce collisions under practical attacks and must not be used for security purposes. For symmetric encryption use AES-256; for asymmetric use RSA-4096 or Curve25519; for password hashing use Argon2id. Review your dependencies regularly — libraries and frameworks update their defaults faster than most developers notice.


Getting Started

You do not need to implement encryption from scratch. Audited, open-source tools already implement the algorithms correctly. Your job is to choose the right tool and configure it well.

  1. Identify what you are protecting. Files on disk, passwords in a database, and data crossing a network each call for a different control. Match the threat to the right tool before you start.
  2. For files at rest, choose a tool that documents its algorithm and key derivation method. AES-256-GCM for encryption and Argon2id for password-based key derivation are the current standards. If a tool does not publish its algorithm, do not use it.
  3. For passwords in an application, use Argon2id with the OWASP-recommended parameters. Never use encryption for passwords — use a one-way hashing function designed specifically for credential storage.
  4. For data in transit, enable TLS 1.3 on your web server and disable TLS 1.0 and 1.1. Most modern hosting platforms expose this as a single configuration option.
  5. Generate nonces and keys from a cryptographically secure random source. Your operating system provides one. Do not use time-based values, counters, or anything predictable.
  6. Test your setup. Confirm that an encrypted file cannot be opened without the correct key. Modify one byte of the ciphertext and confirm that the authentication tag rejects the modified file. If decryption succeeds after modification, authentication is not functioning.

To understand exactly why the password-to-key step is so critical, read Argon2id vs PBKDF2: Why GPU-Resistant Key Derivation Matters. For a close look at the authenticated encryption mode used in modern file encryption, see AES-256-GCM Explained: Authenticated Encryption Without the Jargon.

FAQ

Common questions — answered in plain English.

What is encryption in simple terms?
Encryption converts your readable data into scrambled ciphertext using an algorithm and a secret key. Without the key, the ciphertext looks like random noise and reveals nothing about the original. Only someone with the correct key can reverse the process and read the data.
How does encryption actually protect my data?
Encryption protects your data by making it unreadable to anyone who does not have the decryption key. Even if an attacker steals the encrypted file from your device or server, they cannot read the contents. Modern algorithms like AES-256-GCM also attach an authentication tag that detects any tampering with the ciphertext.
What is the difference between encryption and hashing?
Encryption is reversible — you can get the original data back if you have the correct key. Hashing is a one-way transformation: you cannot recover the original, which makes it suitable for storing passwords. Use encryption when you need the data back later; use hashing when you only need to verify something without storing the real value.
Is AES-256 encryption unbreakable?
AES-256 has never been broken by cryptanalysis under normal conditions, and NIST considers it secure through at least 2030. The practical risk is not the algorithm — it is weak passwords, reused nonces, or poor key management. A correctly implemented AES-256-GCM setup is effectively unbreakable with current and foreseeable technology.
What type of encryption should I use for my files?
For file encryption, choose a tool that implements AES-256-GCM, which provides both confidentiality and tamper detection in a single step. Make sure the tool derives your encryption key from your password using Argon2id or PBKDF2, not a simple hash. VeraCrypt, age, and similar audited open-source tools meet these criteria.
Can the government decrypt my encrypted files?
Strong encryption makes unauthorized access practically infeasible, even for state-level attackers, when the key is well protected. However, legal processes can compel you to provide a decryption key in many jurisdictions. End-to-end encrypted services like Signal cannot hand over message contents because they genuinely do not hold the decryption keys.

References

  1. [1]
  2. [2]
  3. [3]
  4. [4]
  5. [5]