Secure Mail Client | Academy /
Specialized 25 minutes

Modern Encryption Algorithms

Understanding Modern Encryption Algorithms

As digital security threats evolve, encryption algorithms continue to advance in sophistication, performance, and security guarantees. This module provides both a practical overview and technical deep dive into the most important encryption algorithms in use today.

Tip

Dual-Level Explanations

This module presents information at two levels: a practical explanation for general users and a technical explanation for those with more cryptographic background. Feel free to focus on the level that best suits your needs.

The Two Families of Encryption Algorithms

Modern encryption falls into two fundamental categories, each with different capabilities, strengths, and use cases.

Symmetric Encryption

Practical Explanation

Symmetric encryption uses the same key for both encryption and decryption—like a single physical key that both locks and unlocks a door. It's fast and efficient, making it ideal for encrypting large amounts of data. However, it faces a key distribution challenge: both sender and recipient need the same secret key, which must be shared securely.

Common uses include: file encryption, disk encryption, secure communications (once keys are established), and database protection.

Technical Explanation

Symmetric algorithms operate using a shared secret key K to transform plaintext P into ciphertext C through an encryption function E, where C = E(K,P). The same key is used in the decryption function D to recover the plaintext: P = D(K,C).

These algorithms typically employ substitution-permutation networks, Feistel networks, or AES-specific structures. Security depends on key length, with modern systems requiring at least 128 bits, and algorithm design resistance to various cryptanalytic attacks including differential, linear, and side-channel approaches.

Performance is a key advantage, with throughput reaching gigabytes per second on modern hardware, especially with AES-NI acceleration.

Asymmetric (Public Key) Encryption

Practical Explanation

Asymmetric encryption uses two mathematically related keys: a public key that can be freely shared, and a private key that's kept secret. Anything encrypted with one key can only be decrypted with its paired key. This solves the key distribution problem, as public keys can be shared openly without compromising security.

Common uses include: secure key exchange, digital signatures, identity verification, and establishing secure channels between parties who haven't previously shared secrets.

Technical Explanation

Asymmetric cryptosystems rely on trapdoor one-way functions—mathematical operations easy to perform in one direction but computationally infeasible to reverse without special knowledge (the private key). The security of these systems depends on mathematical hardness assumptions such as the difficulty of integer factorization (RSA), the discrete logarithm problem (DSA), or finding elliptic curve discrete logarithms (ECDSA, EdDSA).

For a key pair (pk, sk) where pk is public and sk is private, encryption of plaintext P is computed as C = E(pk, P) and decryption as P = D(sk, C). Algorithmic efficiency varies significantly; RSA operations scale with O(k³) where k is key length, while elliptic curve operations can achieve similar security with smaller keys and better performance profiles.

These algorithms are typically 2-3 orders of magnitude slower than symmetric encryption, making them unsuitable for bulk data encryption but excellent for key exchange and authentication.

Key Modern Symmetric Algorithms

AES (Advanced Encryption Standard)

Practical Explanation

AES is the most widely used symmetric encryption algorithm today. Created to replace the older DES standard, it was selected by the US National Institute of Standards and Technology (NIST) in 2001 after an extensive public competition.

It's available in three key sizes—128, 192, and 256 bits—with larger keys providing more security but requiring slightly more processing power. Modern devices often have hardware acceleration for AES, making it extremely fast. The 256-bit version is considered secure against quantum computing attacks for the foreseeable future.

You'll find AES in everything from encrypted messaging apps to secure website connections, disk encryption, and VPNs.

Technical Explanation

AES (Rijndael) is a substitution-permutation network operating on 128-bit blocks with key sizes of 128, 192, or 256 bits. The algorithm processes data through 10, 12, or 14 rounds respectively, where each round applies four operations: SubBytes (non-linear substitution via S-box), ShiftRows (transposition), MixColumns (mixing operation using matrix multiplication over GF(2⁸)), and AddRoundKey (XOR with round key).

Key schedule expands the master key into round keys using a key expansion routine. Side-channel resistance has been extensively studied, leading to constant-time implementations to prevent timing attacks. Despite extensive cryptanalysis, the best known attacks against full AES remain theoretical and require computational resources exceeding practical feasibility, with the notable exception of side-channel attacks against specific implementations.

AES can be used in various modes of operation including ECB (not recommended for most purposes), CBC, CTR, GCM, and XTS (for disk encryption), each with different security properties and IV/nonce requirements.

ChaCha20-Poly1305

Practical Explanation

ChaCha20-Poly1305 is a newer encryption system that's gaining popularity, especially for mobile and lower-power devices. It combines the ChaCha20 stream cipher with the Poly1305 authentication code to provide both encryption and message integrity.

Its main advantage is excellent performance in software implementations, making it energy-efficient for battery-powered devices. It's also designed to be resistant to timing attacks, which can be a concern with some AES implementations.

It's used in protocols like TLS 1.3 for secure web browsing, WireGuard VPN, and many modern secure messaging applications.

Technical Explanation

ChaCha20 is an ARX (Add-Rotate-XOR) based stream cipher from the Salsa family designed by Daniel J. Bernstein. It operates on a 512-bit state arranged as a 4×4 matrix of 32-bit words, performing 20 rounds of operations. Each round consists of column-quarter-rounds followed by diagonal-quarter-rounds where a quarter-round applies a sequence of 32-bit additions, rotations, and XORs to update four state words.

Poly1305 is a universal hash function that produces a 128-bit authentication tag using a one-time key derived partially from the ChaCha20 key. When combined as ChaCha20-Poly1305 AEAD (Authenticated Encryption with Associated Data), the construction encrypts data with ChaCha20 and authenticates both the ciphertext and any associated data with Poly1305.

The construction offers 256-bit security with significant performance benefits on platforms without AES hardware acceleration. It uses a 96-bit nonce and requires careful implementation to avoid nonce reuse, which would be catastrophic to security.

Other Notable Symmetric Algorithms

  • Twofish - A versatile block cipher that was a finalist in the AES selection process
  • Serpent - Known for its extensive security margin, also an AES finalist
  • Camellia - A block cipher developed by Mitsubishi and NTT, widely used in Japan
  • SNOW 3G & ZUC - Stream ciphers used in mobile network security
  • SM4 - Chinese national standard block cipher for commercial cryptography

Key Modern Asymmetric Algorithms

RSA (Rivest-Shamir-Adleman)

Practical Explanation

RSA is the oldest and most widely deployed public key encryption system. It can be used for both encryption and digital signatures. The security of RSA is based on the difficulty of factoring large numbers—specifically, finding the prime factors of a very large number.

While still secure when implemented correctly with sufficient key lengths (2048 bits or more), RSA is gradually being replaced by newer elliptic curve algorithms that offer equivalent security with smaller keys and better performance.

RSA is commonly used in secure email (like PGP/GPG), secure connections to websites (though increasingly in the key exchange phase only), and document signing.

Technical Explanation

RSA's security relies on the integer factorization problem. Key generation involves selecting two large primes p and q, computing their product n = pq (the modulus), and deriving the public exponent e and private exponent d such that ed ≡ 1 (mod φ(n)) where φ(n) = (p-1)(q-1) is Euler's totient function.

Encryption of message m is computed as c = m^e mod n, while decryption recovers m = c^d mod n. In practice, RSA is usually implemented with padding schemes such as PKCS#1 v1.5 or preferably OAEP (Optimal Asymmetric Encryption Padding) to prevent attacks like Bleichenbacher's. For signatures, PSS (Probabilistic Signature Scheme) is recommended over older PKCS#1 v1.5 padding.

Current security recommendations suggest a minimum 2048-bit modulus, with 3072 bits or more for long-term security. RSA operations scale poorly with key size: O(k³) for k-bit keys, making implementations with very large keys computationally expensive compared to elliptic curve alternatives.

Elliptic Curve Cryptography (ECC)

Practical Explanation

Elliptic Curve Cryptography (ECC) is a newer approach to public-key cryptography that can deliver equivalent security to RSA with significantly smaller keys. An ECC key of 256 bits provides security roughly equivalent to a 3072-bit RSA key.

These smaller keys mean faster operations, less bandwidth usage, and better energy efficiency—making ECC particularly suitable for mobile devices, IoT applications, and other constrained environments.

ECC is used in secure messaging apps, modern TLS implementations, Bitcoin and other cryptocurrencies, secure device authentication, and increasingly in document signing and secure email.

Technical Explanation

ECC's security is based on the elliptic curve discrete logarithm problem (ECDLP). Given points P and Q = kP on an elliptic curve E, where k is a scalar and P is a generator point, it is computationally infeasible to determine k given only P and Q for well-chosen curves and sufficiently large groups.

The primary ECC algorithms include ECDH (Elliptic Curve Diffie-Hellman) for key agreement, ECDSA (Elliptic Curve Digital Signature Algorithm) and EdDSA (Edwards-curve Digital Signature Algorithm) for signatures. ECDSA provides shorter signatures than RSA for equivalent security levels, while Edwards curves used in EdDSA offer additional performance benefits and resistance to certain side-channel attacks.

While the NSA's Suite B initially endorsed ECC, concerns about potential backdoors in the NIST curves have led to the adoption of alternative curves such as Curve25519 for ECDH (X25519) and Ed25519 for signatures. These curves, designed by Daniel J. Bernstein, offer strong security properties and simpler, more efficient implementation. The implementation complexity of ECC makes it susceptible to side-channel attacks if not carefully implemented, though newer curve designs help mitigate this risk.

Other Notable Asymmetric Algorithms

  • DSA (Digital Signature Algorithm) - Used specifically for digital signatures
  • ElGamal - An asymmetric algorithm based on the Diffie-Hellman key exchange
  • NTRU - A lattice-based system that offers some quantum resistance
  • Supersingular Isogeny Key Exchange (SIKE) - A post-quantum key exchange based on elliptic curves
  • McEliece - An early code-based encryption system with post-quantum properties

Security Alert

Why Not Just Use the Strongest Algorithm?

Cryptographic algorithm selection is a balance between security, performance, compatibility, and specific application needs. The "strongest" algorithm often comes with trade-offs in speed, complexity, or resource usage. The best choice depends on your specific use case, threat model, and operational constraints.

Hybrid Cryptosystems: The Best of Both Worlds

In practice, most modern encryption systems combine symmetric and asymmetric algorithms to leverage the strengths of each.

Practical Explanation

Hybrid systems use asymmetric cryptography to securely exchange a temporary symmetric key (often called a session key), which is then used for encrypting the actual data. This approach combines the security advantages of public key cryptography with the performance benefits of symmetric encryption.

For example, when you connect to a secure website (HTTPS), your browser and the server use asymmetric cryptography to establish a shared secret, then use that secret to derive symmetric keys that encrypt the actual web traffic.

PGP/GPG secure email works similarly—your message is encrypted with a random symmetric key, and then that key is encrypted with the recipient's public key.

Technical Explanation

Hybrid encryption typically employs key encapsulation mechanism (KEM) and data encapsulation mechanism (DEM) constructs. For a sender encrypting a message m for a recipient with public key pk:

1. Generate a random symmetric key K
2. Encrypt m with K using a symmetric algorithm: c₁ = Sym_Enc(K, m)
3. Encrypt K with the recipient's public key: c₂ = Asym_Enc(pk, K)
4. Transmit the ciphertext pair (c₁, c₂)

For decryption, the recipient:
1. Uses their private key sk to recover K = Asym_Dec(sk, c₂)
2. Decrypts the message m = Sym_Dec(K, c₁)

This approach combines the asymptotic efficiency of symmetric cryptography (O(n) with message size) with the key management benefits of asymmetric systems. Modern protocols like TLS 1.3 use ephemeral Diffie-Hellman key exchange (DHE or ECDHE) to establish forward secrecy, meaning the compromise of long-term keys cannot retroactively decrypt past communications.

Choosing the Right Algorithm for Different Applications

Different use cases require different cryptographic approaches. Here are some common scenarios and typical algorithm choices:

Secure Communications

  • Ephemeral messaging - ChaCha20-Poly1305 or AES-GCM with forward secrecy via ECDHE
  • Email security - AES for content, RSA or ECC for key protection
  • Real-time audio/video - AES in counter mode for low latency

Data at Rest

  • Full disk encryption - AES-XTS, often with hardware acceleration
  • Database field encryption - AES-GCM for authenticated encryption
  • Long-term archival - AES-256 with careful key management

Authentication and Signatures

  • Code signing - RSA with PSS padding or EdDSA (Ed25519)
  • Document signatures - RSA-3072, ECDSA, or EdDSA
  • Web authentication - ECDSA or EdDSA for compact signatures

Specialized Environments

  • IoT/embedded systems - Lightweight ciphers like PRESENT, ChaCha20, or AES-128
  • Blockchain/cryptocurrency - Curve25519, secp256k1 (Bitcoin), or Ed25519
  • Post-quantum concerns - Hybrid approaches combining traditional with new PQ algorithms

The Future of Encryption Algorithms

Cryptography continues to evolve in response to new threats and technological developments. Key areas of development include:

Post-Quantum Cryptography

With the development of quantum computers that could threaten current public key cryptosystems, new algorithms resistant to quantum attacks are being developed. NIST is currently standardizing several candidates based on:

  • Lattice-based cryptography - Systems like CRYSTALS-Kyber and CRYSTALS-Dilithium
  • Hash-based signatures - SPHINCS+ and similar constructions
  • Code-based systems - McEliece and its variants
  • Multivariate cryptography - For specialized signature applications

Homomorphic Encryption

These systems allow computation on encrypted data without decryption, opening new possibilities for privacy-preserving computation:

  • Fully Homomorphic Encryption (FHE) - Can perform arbitrary operations on encrypted data
  • Partially Homomorphic Encryption - Supports specific operations like addition or multiplication

Lightweight Cryptography

As encryption moves to smaller, lower-power devices, specialized algorithms are being developed:

  • NIST Lightweight Cryptography Project - Standardizing algorithms for constrained environments
  • Efficient implementations - Optimizing existing algorithms for minimal resource usage

The encryption landscape will continue to evolve, but the fundamental principles of algorithm selection remain: understand your security requirements, threat model, and operational constraints to choose the appropriate cryptographic tools.

In This Module

Share This Module

Related Modules