Choosing the wrong encryption algorithm is worse than choosing no encryption at all — it creates a false sense of security. This guide provides a structured approach to selecting the right algorithm for your specific use case, threat model, and performance constraints.

How to use this document: Start with the decision flowchart to narrow your options. Then consult the comparison tables for detailed trade-offs. The recommendations at the end provide specific algorithm choices for common scenarios.


Fundamental Categories

Before selecting an algorithm, understand the four categories and when each applies.

CategoryPurposeKey CharacteristicExample Algorithms
Symmetric EncryptionEncrypting data (at rest or in transit)Same key encrypts and decryptsAES-256-GCM, ChaCha20-Poly1305, XSalsa20
Asymmetric EncryptionKey exchange, digital signatures, encrypting for a recipientPublic/private key pairRSA-OAEP, ECDH, Ed25519, X25519
HashingIntegrity verification, password storageOne-way function, no decryptionSHA-256, SHA-3, BLAKE3, Argon2
Post-QuantumFuture-proofing against quantum computersResistant to Shor’s and Grover’s algorithmsML-KEM (Kyber), ML-DSA (Dilithium), SLH-DSA (SPHINCS+) — see our post-quantum cryptography deep dive

Decision Flowchart

Follow this text-based flowchart to determine which algorithm category and specific algorithm you need.

START: What are you trying to do?
│
├─► Encrypt data at rest (files, databases, storage)
│   │
│   ├─► Hardware supports AES-NI instructions?
│   │   ├─► YES → AES-256-GCM
│   │   └─► NO → ChaCha20-Poly1305
│   │
│   └─► Data size?
│       ├─► < 64 KB per operation → AES-256-GCM (single block efficient)
│       └─► Streaming / large files → AES-256-GCM-SIV or ChaCha20-Poly1305
│
├─► Encrypt data in transit (TLS, API calls, WebSocket)
│   │
│   └─► Use TLS 1.3 with:
│       ├─► AES-256-GCM (hardware-accelerated environments)
│       └─► ChaCha20-Poly1305 (mobile, software-only environments)
│
├─► Exchange keys securely between parties
│   │
│   ├─► Need post-quantum resistance?
│   │   ├─► YES → ML-KEM-768 (Kyber) + X25519 hybrid
│   │   └─► NO → X25519 (ECDH on Curve25519)
│   │
│   └─► Legacy compatibility required?
│       ├─► YES → ECDH P-256 or RSA-2048 (minimum)
│       └─► NO → X25519
│
├─► Sign data or verify authenticity
│   │
│   ├─► Need post-quantum resistance?
│   │   ├─► YES → ML-DSA-65 (Dilithium) or SLH-DSA (SPHINCS+)
│   │   └─► NO → Ed25519
│   │
│   └─► Legacy compatibility required?
│       ├─► YES → ECDSA P-256 or RSA-PSS-2048
│       └─► NO → Ed25519
│
├─► Hash data for integrity
│   │
│   ├─► Password hashing?
│   │   └─► Argon2id (always)
│   │
│   ├─► Content integrity / checksums?
│   │   ├─► Speed critical → BLAKE3
│   │   └─► Interoperability critical → SHA-256
│   │
│   └─► Blockchain / Merkle trees?
│       └─► SHA-256 or Keccak-256
│
└─► [End-to-end encrypted](/cryptography/end-to-end-encryption/) messaging
    │
    └─► Use [Signal Protocol](/cryptography/signal-protocol-deep-dive/) (or derivative):
        ├─► X25519 for key agreement
        ├─► Ed25519 for identity keys
        ├─► AES-256-GCM or ChaCha20-Poly1305 for message encryption
        └─► Double Ratchet for forward secrecy

Symmetric Encryption Comparison

These algorithms encrypt and decrypt with the same key. Use symmetric encryption for bulk data encryption.

Algorithm Comparison

CriteriaAES-256-GCMAES-256-CBCChaCha20-Poly1305XSalsa20-Poly1305AES-256-GCM-SIV
Security Level256-bit256-bit256-bit256-bit256-bit
ModeAEAD (authenticated)Non-authenticatedAEAD (authenticated)AEAD (authenticated)AEAD (nonce-misuse resistant)
Nonce Size96-bit128-bit IV96-bit192-bit96-bit
Nonce Reuse ToleranceCatastrophic (key+nonce reuse breaks auth)IV reuse leaks patternsCatastrophicBetter (larger nonce space)Tolerant (reveals only duplicate plaintexts)
Hardware AccelerationYes (AES-NI)Yes (AES-NI)No (but fast in software)NoYes (AES-NI)
Software PerformanceFast with AES-NI; slow withoutModerateVery fast (3x AES without AES-NI)Very fastSlightly slower than GCM
Max Message Size~64 GB per nonceNo practical limit~256 GB~256 GB~64 GB
Browser SupportYes (Web Crypto API)Yes (Web Crypto API)No (Web Crypto API)No (requires library)No (requires library)
NIST ApprovedYesYesNo (but IETF standardized)NoYes
RecommendedYesNo (use GCM instead)YesSituationalSituational

When to Choose What

ScenarioRecommended AlgorithmReasoning
Web application (browser-based)AES-256-GCMNative Web Crypto API support; no library dependency
Mobile app (iOS/Android)ChaCha20-Poly1305Better performance on ARM without AES-NI
Server-side with Intel/AMDAES-256-GCMHardware acceleration via AES-NI
Database field encryptionAES-256-GCM-SIVNonce-misuse resistance reduces risk of implementation errors
File encryptionAES-256-GCM or ChaCha20-Poly1305Depends on platform hardware
VPN / tunnel encryptionChaCha20-Poly1305WireGuard default; excellent cross-platform performance

Asymmetric Encryption and Key Exchange Comparison

These algorithms use public/private key pairs. Use them for key exchange, digital signatures, and encrypting data for specific recipients.

Key Exchange Algorithms

CriteriaRSA-2048RSA-4096ECDH P-256X25519ML-KEM-768 (Kyber)
Security Level~112-bit~140-bit~128-bit~128-bit~192-bit (post-quantum)
Key Size (Public)256 bytes512 bytes64 bytes32 bytes1,184 bytes
Key Size (Private)~1,200 bytes~2,400 bytes32 bytes32 bytes2,400 bytes
Ciphertext / Shared Secret Size256 bytes512 bytes64 bytes32 bytes1,088 bytes
Key Generation SpeedSlow (~100ms)Very slow (~500ms)Fast (~1ms)Very fast (<1ms)Fast (~1ms)
Operation SpeedSlowVery slowFastVery fastFast
Quantum ResistantNoNoNoNoYes
NIST ApprovedYesYesYesNo (IETF)Yes (FIPS 203)
Browser SupportYes (Web Crypto)Yes (Web Crypto)Yes (Web Crypto)No (requires library)No (requires library)
Recommended for New SystemsNoNoSituationalYesYes (hybrid with X25519)

Digital Signature Algorithms

CriteriaRSA-PSS-2048ECDSA P-256Ed25519ML-DSA-65 (Dilithium)SLH-DSA-128s (SPHINCS+)
Security Level~112-bit~128-bit~128-bit~192-bit (post-quantum)~128-bit (post-quantum)
Public Key Size256 bytes64 bytes32 bytes1,952 bytes32 bytes
Signature Size256 bytes64 bytes64 bytes3,293 bytes7,856 bytes
Signing SpeedModerateFastVery fastFastSlow
Verification SpeedFastModerateVery fastVery fastSlow
DeterministicOptionalNo (requires good RNG)YesYesYes
Quantum ResistantNoNoNoYesYes
RecommendedLegacy onlyInteroperabilityYes (default choice)Yes (post-quantum)Situational

Hashing Algorithm Comparison

CriteriaSHA-256SHA-3-256BLAKE3BLAKE2bArgon2idbcrypt
Output Size256-bit256-bit256-bit (default, variable)Up to 512-bitVariable184-bit
Speed (software)FastModerateVery fast (3x SHA-256)FastIntentionally slowIntentionally slow
ParallelizableNoNoYes (SIMD, multithreaded)NoYes (configurable)No
Use CaseGeneral integrity, TLSGovernment complianceFile checksums, KDFsGeneral purposePassword hashingPassword hashing (legacy)
Memory HardNoNoNoNoYes (configurable)No
GPU ResistanceLowLowLowLowHigh (memory-hard)Moderate
NIST ApprovedYesYesNoNoNo (but OWASP recommended)No
RecommendedYes (interop)SituationalYes (performance)SituationalYes (passwords)Legacy only

Password Hashing Parameters (Argon2id)

Security LevelMemoryIterationsParallelismTime Target
Minimum64 MB34~500ms
Recommended256 MB44~1 second
High Security1 GB68~3 seconds
Maximum4 GB88~5 seconds

Post-Quantum Readiness

Quantum computers threaten asymmetric cryptography (RSA, ECC, ECDH) via Shor’s algorithm. Symmetric algorithms (AES) and hashing functions (SHA) are weakened but not broken by Grover’s algorithm (requiring doubled key sizes). For enterprise readiness assessment, see our post-quantum migration readiness analysis.

Timeline Assessment

Threat LevelEstimated TimelineAction Required
Harvest Now, Decrypt LaterNow (active threat)Implement hybrid PQ for data with >10-year confidentiality requirement
Cryptographically Relevant Quantum Computer (CRQC)2030-2040 (estimated)Plan migration path for all asymmetric crypto
Quantum advantage for symmetric attacks2040+ (speculative)AES-256 provides adequate margin

NIST Post-Quantum Standards (Finalized)

StandardAlgorithmCategoryUse Case
FIPS 203ML-KEM (Kyber)Key EncapsulationKey exchange, TLS handshake
FIPS 204ML-DSA (Dilithium)Digital SignatureGeneral-purpose signatures
FIPS 205SLH-DSA (SPHINCS+)Digital Signature (hash-based)Long-term signatures, conservative choice

For systems being built in 2026, implement hybrid key exchange that combines a classical and post-quantum algorithm:

Hybrid Key Exchange:
  Classical:     X25519 (or ECDH P-256 for compliance)
  Post-Quantum:  ML-KEM-768

  Combined shared secret = KDF(X25519_secret || ML-KEM_secret)

Rationale:
  - If ML-KEM is broken → X25519 still provides security
  - If X25519 is broken by quantum → ML-KEM provides security
  - Defense in depth against unknown vulnerabilities in either

Key Size Reference

Algorithm FamilyMinimum AcceptableRecommendedHigh SecurityNotes
AES (symmetric)128-bit256-bit256-bit128-bit still secure; 256-bit for quantum margin
RSA (key exchange)2048-bit3072-bit4096-bitBeing phased out; migrate to ECC or PQ
ECC (NIST curves)P-256P-256P-384P-521 offers marginal benefit over P-384
Curve25519 (X25519/Ed25519)255-bit (fixed)255-bit (fixed)255-bit (fixed)Single key size by design
ML-KEM (Kyber)ML-KEM-512ML-KEM-768ML-KEM-1024768 recommended for general use
ML-DSA (Dilithium)ML-DSA-44ML-DSA-65ML-DSA-8765 recommended for general use

Common Mistakes

MistakeRiskCorrect Approach
Using AES-ECB modePlaintext patterns visible in ciphertextUse AES-GCM or AES-CTR with authentication
Reusing nonces with AES-GCMComplete loss of authentication; potential key recoveryUse a counter or random nonce with uniqueness guarantee; consider GCM-SIV
Using MD5 or SHA-1 for integrityCollision attacks are practicalUse SHA-256, SHA-3, or BLAKE3
Using SHA-256 for password hashingGPU brute-force feasibleUse Argon2id with high memory parameter
RSA key size < 2048 bitsFactorable with current resourcesMinimum 2048; prefer 3072+ or migrate to ECC
Implementing crypto primitives from scratchImplementation bugs lead to total compromiseUse audited libraries (libsodium, OpenSSL, Web Crypto API)
Static ECDH without ephemeral keysNo forward secrecyUse ephemeral ECDH (ECDHE)
Encrypting without authenticatingVulnerable to padding oracle and bitflip attacksAlways use AEAD modes (GCM, Poly1305)

PlatformRecommended LibraryAlgorithms Covered
Browser (JavaScript)Web Crypto API (native)AES-GCM, RSA, ECDH, ECDSA, SHA-256/384/512
Browser (extended)libsodium.jsChaCha20-Poly1305, X25519, Ed25519, Argon2, BLAKE2b
Node.jsnode:crypto (native) + libsodiumFull symmetric/asymmetric suite
Rustring, RustCryptoAES-GCM, ChaCha20, Ed25519, X25519, SHA-2, BLAKE3
Gocrypto/… (stdlib)AES-GCM, ChaCha20, Ed25519, ECDH, SHA-256
Pythoncryptography (pyca)Full suite
Java/KotlinTink (Google)AES-GCM, ECDH, Ed25519, hybrid encryption
iOS/macOSCryptoKit (Apple)AES-GCM, ChaCha20, P-256, Curve25519, SHA-256
AndroidTink (Google) or ConscryptAES-GCM, ChaCha20, ECDH, Ed25519
Post-Quantumliboqs (Open Quantum Safe)ML-KEM, ML-DSA, SLH-DSA

Quick Reference: What Stealth Cloud Uses

For transparency, here is the cryptographic stack used by Stealth Cloud’s Ghost Chat:

LayerAlgorithmRationale
Message encryptionAES-256-GCMWeb Crypto API native; hardware-accelerated; AEAD
Key derivationHKDF-SHA-256Standard KDF for deriving session keys
Client key exchangeX25519Fast, constant-time, small keys
Session authenticationEd25519 (via SIWE)Deterministic signatures, wallet-native
TransportTLS 1.3Cloudflare edge termination
Password hashingN/ANo passwords in architecture
Content integritySHA-256Interoperability with Web Crypto API

This guide is maintained by Stealth Cloud. Cryptographic standards evolve — verify all recommendations against current NIST, IETF, and OWASP guidance before implementation. This document does not constitute security advice for regulated systems.