Fundamentals · 1.3

⚙️ How Modern Ciphers Work

Confusion, diffusion, and the math behind scrambling data⏱ ~3 min

Claude Shannon's Two Properties

Claude Shannon (the father of information theory) defined the two properties every secure cipher must have, in his 1949 paper that became the foundation of modern cryptography:

Confusion
  • Each bit of ciphertext depends on many bits of the key
  • Changing one key bit should change many ciphertext bits
  • Makes the relationship between plaintext and ciphertext as complex as possible
  • Implemented by: substitution, S-boxes
Diffusion
  • Each plaintext bit affects many ciphertext bits
  • Changing one plaintext bit should flip roughly half the ciphertext bits
  • Spreads the influence of each character across the whole output
  • Implemented by: permutation, mixing layers

The Avalanche Effect

★ FactIn a good cipher, flipping a single bit in the plaintext flips approximately 50% of the ciphertext bits — completely unpredictably. This is called the avalanche effect. It means an attacker cannot use small differences in plaintext to learn anything about the key or the output pattern.

Rounds — Why Modern Ciphers Repeat

Modern ciphers apply their confusion and diffusion operations in rounds — repeating the scrambling process 10, 14, or 20 times. Each round makes the ciphertext slightly more thoroughly scrambled. AES-128 uses 10 rounds; AES-256 uses 14. Fewer rounds = faster but less secure; more rounds = slower but stronger.

The Three Families of Cryptography

FamilyHow It WorksMain UsesKey Sizes
SymmetricOne key for both encryption and decryptionEncrypting large data (files, disk, streams)128, 192, 256 bits (AES)
AsymmetricPublic key to encrypt, private key to decrypt (or vice versa)Key exchange, digital signatures, TLS handshakes2048–4096 bits (RSA), 256–521 bits (ECC)
Hash functionsOne-way transformation — no key, no decryptionIntegrity verification, password storage, digital signaturesOutput: 256, 384, 512 bits
🔒 SecurityAsymmetric keys are much larger than symmetric keys for equivalent security — a 256-bit AES key is roughly equivalent in security strength to a 3072-bit RSA key. This is because the math problems underlying RSA (integer factorization) are easier to attack than brute-forcing AES.
🧠Quick Checkfirst try = +5 XP

The avalanche effect means flipping one plaintext bit…

0 XP🔥 0 days