When Caesar sent a military dispatch, he shifted every letter by 3. When your browser connects to your bank, it uses AES-256 and elliptic curve key exchange. Same goal, 2,000 years apart. Learn what cryptography is.
When Julius Caesar sent a military dispatch, he shifted every letter by 3. A became D, B became E, and so on. When your browser connects to your bank, it performs 2,048-bit elliptic curve key exchange and encrypts traffic with AES-256-GCM. The goal is identical: prevent anyone without the key from reading the message. The mathematics is 2,000 years apart.
Cryptography is the science of secure communication in the presence of adversaries. It covers encryption (hiding data), hashing (verifying data integrity), digital signatures (proving authenticity), and key exchange (agreeing on secrets in public). These four primitives form the foundation of every secure system on the internet.
You can see the simplest form of cryptography in action with our Caesar Cipher tool, or jump to modern hashing with the SHA-256 Hash Generator.
Claude Shannon, the father of information theory, defined two properties that every secure cipher must have in his 1949 paper Communication Theory of Secrecy Systems.
Confusion means the relationship between the key and the ciphertext is as complex as possible. If you change one bit of the key, the ciphertext should change in unpredictable ways. In AES, this is achieved through the SubBytes step, which applies a nonlinear substitution table.
Diffusion means changing one bit of plaintext changes many bits of ciphertext. In AES, the ShiftRows and MixColumns steps spread a single-bit change across the entire 128-bit block. After 14 rounds (AES-256), flipping one input bit flips approximately half of the output bits.
These two properties ensure that an attacker cannot learn anything about the key by studying the ciphertext, and cannot learn anything about the plaintext by changing parts of the ciphertext. Every modern cipher is evaluated on how well it achieves confusion and diffusion.
Symmetric encryption uses one key for both encryption and decryption. AES (Advanced Encryption Standard, FIPS 197) is the dominant symmetric cipher. It processes data in 128-bit blocks through multiple rounds of substitution and permutation. ChaCha20, specified in RFC 8439, is an alternative stream cipher used in TLS and Signal when hardware AES acceleration is unavailable.
Example: encrypting "HELLO" with Caesar cipher (shift 3) produces "KHOOR". Encrypting the same "HELLO" with AES-256-GCM produces 16 bytes of unrecognizable binary data plus a 16-byte authentication tag. The Caesar cipher preserves letter frequency, word length, and language patterns. AES produces output that is statistically indistinguishable from random noise.
Asymmetric encryption uses two keys: a public key and a private key. RSA (published 1977) and ECC (elliptic curve cryptography) are the two main families. Asymmetric encryption solves the key distribution problem that symmetric encryption cannot: you can publish your public key openly, and anyone can use it to encrypt a message that only you can decrypt.
The tradeoff is speed. Asymmetric operations are roughly 1,000 times slower than symmetric operations. This is why every practical system uses asymmetric encryption only for the initial handshake, then switches to symmetric encryption for bulk data.
Hashing is a one-way function that takes arbitrary input and produces a fixed-size output. Unlike encryption, hashing is not reversible. The same input always produces the same output, but different inputs should produce different outputs (collision resistance). SHA-256, specified in FIPS 180-4, produces a 256-bit hash. Our SHA-256 Hash Generator lets you compute hashes in your browser.
Hashing is used for password storage (store the hash, not the password), data integrity (compare hashes to detect changes), and digital signatures (sign the hash, not the full message). Our Encoding vs Encryption vs Hashing post covers the differences in depth.
Every time you visit a website with HTTPS, all three types of cryptography work together. Here is what happens in the first few milliseconds of a TLS 1.3 connection:
1. Key exchange (asymmetric): Your browser and the server perform ECDHE (Elliptic Curve Diffie-Hellman Ephemeral). Both sides compute a shared secret using elliptic curve mathematics. The shared secret is never transmitted over the network.
2. Authentication (asymmetric + hashing): The server sends a certificate containing its public key, signed by a certificate authority. Your browser verifies the signature using the CA's public key (which is pre-installed in your operating system or browser). The signature is computed by hashing the certificate with SHA-256 and encrypting the hash with the CA's private key.
3. Bulk encryption (symmetric): The shared secret from step 1 is used to derive AES-256-GCM keys. All subsequent traffic is encrypted with these keys. AES is hardware-accelerated on modern CPUs through AES-NI instructions, making it fast enough for streaming video.
4. Integrity (symmetric + hashing): AES-GCM is an authenticated encryption mode. It produces both ciphertext and a 16-byte authentication tag. If an attacker modifies even one bit of the ciphertext, the tag verification fails and the connection is terminated.
This combination gives you confidentiality (encryption), authenticity (certificate verification), and integrity (authentication tags) in a single handshake that completes in under 100 milliseconds.
Cryptography is older than most sciences. The earliest documented ciphers date to ancient Mesopotamia and Egypt, but the first systematic treatment came from Arab scholars. Al-Kindi (c. 801-873 CE) wrote A Manuscript on Deciphering Cryptographic Messages, which described frequency analysis, the technique that breaks any monoalphabetic substitution cipher.
The Renaissance brought polyalphabetic ciphers. The Vigenere cipher, misattributed to Blaise de Vigenere but actually developed by Giovan Battista Bellaso in 1553, used a repeating keyword to defeat frequency analysis. It was considered unbreakable for 300 years until Friedrich Kasiski published his examination method in 1863.
The 20th century turned cryptography from an art into a science. Shannon's 1949 paper formalized the mathematical basis. The invention of public-key cryptography by Diffie, Hellman, and Merkle in 1976 solved the key distribution problem that had plagued cryptography for millennia. RSA followed in 1977. AES became a federal standard in 2001 after a five-year public competition.
In August 2024, NIST published the first post-quantum cryptography standards (FIPS 203, 204, 205) after an eight-year selection process. These algorithms are designed to resist attacks from quantum computers, which could break RSA and ECC using Shor's algorithm. NIST selected HQC for additional key establishment standardization in March 2025, expanding the post-quantum toolkit.
Passwords: Never store passwords in plaintext. Hash them with a memory-hard function like Argon2 (winner of the 2015 Password Hashing Competition) or PBKDF2 (specified in NIST SP 800-132). Our PBKDF2/Argon2 tool demonstrates the process.
Messaging: Signal and WhatsApp use the Signal Protocol, which combines Curve25519 key exchange with AES-256-GCM encryption and the Double Ratchet for forward secrecy. Each message gets a unique key.
Cryptocurrency: Bitcoin uses SHA-256 for proof-of-work mining and ECDSA for transaction signatures. Ethereum uses Keccak-256 (a SHA-3 variant). Our SHA-3/SHAKE generator produces hashes using the Keccak sponge construction.
Web authentication: JWT (JSON Web Tokens) use HMAC-SHA256 or RSA-SHA256 for stateless authentication. Our JWT Decoder lets you inspect the header and payload of any JWT.
Cryptography is rarely the weakest link in a system. The Equifax breach (2017, 147 million records exposed) was caused by an unpatched Apache Struts vulnerability, not a cryptographic failure. The Heartbleed bug (2014) was an implementation error in OpenSSL's TLS heartbeat extension, not a flaw in TLS itself.
Key management is where most systems fail. If you store your AES key next to your encrypted data, the encryption provides no protection. If you reuse a nonce in AES-GCM, an attacker can XOR two ciphertexts to recover plaintext. If you use ECB mode, patterns in the plaintext are visible in the ciphertext (the famous "ECB penguin" image).
Quantum computing threatens asymmetric cryptography. NIST's post-quantum standards (published 2024) address this, but migration will take years. Symmetric cryptography is less affected: AES-256 retains 128-bit security under Grover's algorithm, which is still adequate.
Cryptography is the science of secure communication. It includes encryption (hiding data so only someone with the key can read it), hashing (creating a fingerprint of data that cannot be reversed), and digital signatures (proving who sent a message). Every HTTPS website, banking app, and messaging platform relies on cryptography.
Encryption is reversible: given the key, you can recover the plaintext from the ciphertext. Hashing is one-way: you can compute a hash from input, but you cannot recover the input from the hash. Encryption is for confidentiality. Hashing is for integrity and verification.
No known practical attack breaks AES-256. Its key space of 2^256 makes brute force infeasible on any existing or foreseeable classical computer. Under Grover's algorithm on a quantum computer, the effective security is reduced to 128 bits, which remains strong. NIST continues to recommend AES-256 for government use.
Symmetric cryptography uses one key for both encryption and decryption (like AES). It is fast but requires the parties to share the key securely beforehand. Asymmetric cryptography uses two keys: a public key and a private key (like RSA). It solves key distribution but is roughly 1,000 times slower, so it is used only for handshakes and signatures.
Quantum computers running Shor's algorithm could break RSA and ECC, the basis for most asymmetric cryptography. NIST published post-quantum standards in August 2024 (FIPS 203, 204, 205) to address this. Symmetric cryptography like AES-256 is less affected and remains secure at reduced strength. Migration to post-quantum algorithms is underway but will take years.
Caesar Cipher
Encrypt or decrypt messages by shifting letters through the alphabet.
Block Cipher (AES / DES)
Encrypt and decrypt with AES-128, AES-256, DES, and Triple DES using GCM, CBC, and ECB modes. AES uses the Web Crypto API.
SHA-256 Hash Generator
Generate SHA-256 cryptographic hashes for secure data verification.
Base64 Encode / Decode
Encode text to Base64 or decode Base64 payloads with UTF-8-safe handling.
JWT Decoder
Decode and view JSON Web Tokens to inspect headers, payload, and signature.
The Difference Between Encoding, Encryption, and Hashing
Base64 is not encryption. This guide defines encoding, encryption, and hashing precisely, runs the same input through each, and explains when to use which in production systems.
How SHA-256 Works: A Step-by-Step Walkthrough for Developers
SHA-256 is defined in NIST FIPS 180-4. This walkthrough explains padding, message schedule expansion, the 64-round compression function, and why you should never use SHA-256 for passwords.
The Caesar Cipher: History, Math, and Two Ways to Break It
Julius Caesar shifted letters by 3. Suetonius documented it around 121 CE. Learn the exact math, the ROT13 self-inverse property, and how brute force and frequency analysis break it in seconds.