Skip to content
Algorithm Selection Guide

Algorithm Selection Guide

This page covers the commonly used algorithms in cryptopp-modern and how to choose between them. It is a curated selection, not an exhaustive catalogue: the library also carries the wider inherited Crypto++ algorithm set, and fork additions such as XAES-256-GCM and AES-CTR-HMAC appear in their sections below.

Hash Functions

Recommended for new work

AlgorithmOutput SizeStandardUse Case
BLAKE3256-bit (variable)BLAKE3 specFast general-purpose hashing, file integrity, content addressing
SHA-256256-bitFIPS 180-4FIPS-standardised, general purpose
SHA-512512-bitFIPS 180-4FIPS-standardised, faster on 64-bit systems
SHA3-256256-bitFIPS 202NIST standard, alternative construction to SHA-2
SHA3-512512-bitFIPS 202NIST standard, larger output
BLAKE2b512-bit (variable)RFC 7693High performance alternative to SHA-2
BLAKE2s256-bit (variable)RFC 7693Optimised for 32-bit systems

Legacy (Compatibility Only)

AlgorithmOutput SizeStatusNotes
SHA-1160-bit⚠️ DeprecatedUse only for legacy compatibility
MD5128-bit❌ BrokenNon-adversarial compatibility checks only
RIPEMD-160160-bit⚠️ LegacyBitcoin compatibility
Tiger192-bit⚠️ LegacyRare use cases
Whirlpool512-bit⚠️ LegacySuperseded by SHA-3

Header files: blake3.h, sha.h, sha3.h, blake2.h, md5.h, ripemd.h, tiger.h, whirlpool.h


Password Hashing & Key Derivation

Password Hashing

AlgorithmMemory-HardCostGuidance
Argon2id✅ YesTunableRecommended for password hashing (RFC 9106 primary variant)
Argon2i✅ YesTunableSpecialised side-channel-sensitive use
Argon2d✅ YesTunableData-dependent access; not the general password default
scrypt✅ YesTunable (N, r, p)Compatibility or existing deployments (RFC 7914)
PBKDF2❌ NoTunableCompatibility and constrained compliance profiles

Key Derivation Functions (KDF)

AlgorithmTypeUse Case
HKDFExtract-and-expandKey derivation from shared secrets
PBKDF2IterativeLegacy key derivation, PKCS #5
scryptMemory-hardExisting scrypt-based deployments

Header files: argon2.h, scrypt.h, pwdbased.h, hkdf.h


Symmetric Encryption

Block Ciphers

CipherKey SizesBlock SizeStandardNotes
AES128, 192, 256-bit128-bitFIPS 197Industry standard, hardware-accelerated where AES-NI exists
Serpent128, 192, 256-bit128-bitAES finalistHigh security margin, slower
Twofish128, 192, 256-bit128-bitAES finalistCompatibility
Camellia128, 192, 256-bit128-bitISO/IEC 18033-3International standard
ARIA128, 192, 256-bit128-bitRFC 5794Korean standard

Stream Ciphers

CipherKey SizeStandardNotes
ChaCha20256-bitRFC 8439Fast in software on platforms without AES hardware; use as part of ChaCha20-Poly1305 for authenticated encryption

Authenticated Encryption

ModeAuthenticationNotes
AES-GCMBuilt-inFast authenticated encryption, the common default
ChaCha20-Poly1305Built-inRFC 8439 AEAD, strong software performance
XAES-256-GCMBuilt-inExtended-nonce AES-GCM (C2SP specification), fork addition
AES-CTR-HMACEncrypt-then-MACComposed AEAD with explicit HMAC, fork addition
CCMBuilt-inConstrained environments
EAXBuilt-inSimple authenticated encryption

Classical Modes (Require Separate MAC)

ModeTypeUse Case
CBCBlockTraditional encryption (use with HMAC)
CTRStreamParallelisable encryption
CFBStreamSelf-synchronising stream cipher
OFBStreamStream cipher mode
ECBBlock⚠️ Insecure - do not use

Header files: aes.h, chacha.h, serpent.h, twofish.h, camellia.h, aria.h, modes.h, gcm.h, ccm.h, eax.h, chachapoly.h, xaes_256_gcm.h, aes_ctr_hmac.h


Public-Key Cryptography

Digital Signatures

AlgorithmClassical Security StrengthStandardNotes
Ed25519128-bitRFC 8032Default choice for new classical signatures
ECDSA (P-256)128-bitFIPS 186-5NIST standard, wide compatibility
ECDSA (P-384)192-bitFIPS 186-5Higher strength NIST curve
ECDSA (P-521)256-bitFIPS 186-5Highest strength NIST curve
RSA (2048-bit)112-bitPKCS #1Legacy compatibility
RSA (3072-bit)128-bitPKCS #1Long-term classical security
RSA (4096-bit)~140-bit (estimated)PKCS #1Larger keys at significant performance cost
DSAUp to 128-bitFIPS 186-4 (legacy)Verification of existing signatures only; do not generate new DSA signatures

Key Exchange

AlgorithmClassical Security StrengthStandardNotes
X25519128-bitRFC 7748Default choice for new classical key exchange
ECDH (P-256)128-bitSP 800-56ANIST standard key exchange
ECDH (P-384)192-bitSP 800-56AHigher strength key exchange
DH (2048-bit)112-bitRFC 3526 groupsTraditional Diffie-Hellman, legacy

Public-Key Encryption

AlgorithmKey SizeUse Case
RSA-OAEP2048-4096-bitLegacy public-key encryption
ECIESVariableElliptic curve integrated encryption

Header files: xed25519.h, eccrypto.h, rsa.h, dsa.h


Post-Quantum Cryptography

Key Encapsulation

AlgorithmStandardSecurity CategoryPublic Key SizeCiphertext SizeSince
ML-KEM-512FIPS 203Category 1800 bytes768 bytes2026.3.0
ML-KEM-768FIPS 203Category 31,184 bytes1,088 bytes2026.3.0
ML-KEM-1024FIPS 203Category 51,568 bytes1,568 bytes2026.3.0
X-Wingdraft-connolly-cfrg-xwing-kem-09Category 31,216 bytes1,120 bytes2026.3.0

X-Wing is a hybrid of X25519 and ML-KEM-768. It implements a specific draft revision, named above; confirm the peer implements the same revision before relying on wire interoperability.

Digital Signatures

AlgorithmStandardSecurityPublic Key SizeSignature SizeSince
ML-DSA-44FIPS 204Category 21,312 bytes2,420 bytes2026.3.0
ML-DSA-65FIPS 204Category 31,952 bytes3,309 bytes2026.3.0
ML-DSA-87FIPS 204Category 52,592 bytes4,627 bytes2026.3.0
SLH-DSAFIPS 205Categories 1, 3 and 532-64 bytes7,856-49,856 bytes2026.3.0
LMS/HSSSP 800-208, SHA-256/N=32 parameter setsHash-based56-60 bytesVaries by height, width and hierarchy2026.6.0

LMS/HSS is stateful: each signature consumes state that must be persisted durably. See the Stateful Signing Guide before using, and the Choosing LMS/HSS Parameters guide for signature sizes per configuration. Mixed per-level hierarchies and the LM-OTS W1/W2/W4 sets arrive in 2026.8.0.

Header files: mlkem.h, mldsa.h, slhdsa.h, xwing.h, lms.h, hss.h, stateful.h


Message Authentication Codes (MAC)

AlgorithmOutput SizeStandardUse Case
HMAC-SHA256256-bitRFC 2104, FIPS 198-1General purpose MAC
HMAC-SHA512512-bitRFC 2104, FIPS 198-1Larger output MAC
BLAKE3 (keyed mode)256-bitBLAKE3 specNative keyed hashing; fast MAC without the HMAC construction
CMAC-AES128-bitSP 800-38BBlock cipher-based MAC
Poly1305128-bitRFC 8439One-time MAC; each key authenticates one message. Use the ChaCha20-Poly1305 AEAD rather than composing it yourself
GMAC128-bitSP 800-38DGCM authentication only
SipHash64-bitSipHash specKeyed hashing for hash tables and short messages

Header files: hmac.h, blake3.h, cmac.h, poly1305.h, siphash.h


Elliptic Curves

Modern Curves

CurveTypeClassical Security StrengthUse Case
Curve25519Montgomery128-bitX25519 key exchange
Ed25519Edwards128-bitEd25519 signatures

NIST Curves

CurveTypeClassical Security StrengthUse Case
P-256 (secp256r1)Weierstrass128-bitNIST standard, wide support
P-384 (secp384r1)Weierstrass192-bitHigher strength applications
P-521 (secp521r1)Weierstrass256-bitHighest strength NIST curve

Other Curves

CurveTypeNotes
secp256k1WeierstrassBitcoin, Ethereum
brainpoolP256r1WeierstrassEuropean standard, 128-bit strength
brainpoolP384r1WeierstrassEuropean standard, 192-bit strength
brainpoolP512r1WeierstrassEuropean standard, 256-bit strength

Header files: xed25519.h, eccrypto.h, asn.h (for curve OIDs)


Random Number Generators

Application CSPRNGs

GeneratorTypeUse Case
AutoSeededRandomPoolCSPRNGThe application default
OS_GenerateRandomBlockOS entropyDirect OS random source
RandomPoolCSPRNGManual seeding
LC_RNGDeterministicTesting only (not cryptographically secure)

Hardware entropy sources

SourceTypeNotes
RDRANDCPU instructionIntel/AMD instruction-level source; feed a CSPRNG rather than using directly
RDSEEDCPU instructionEntropy-conditioning source; same guidance

Header files: osrng.h, randpool.h, rdrand.h


Encoding & Utilities

Encoders

EncoderUse Case
HexEncoderHexadecimal encoding
Base64EncoderBase64 encoding
Base32EncoderBase32 encoding

Compression

AlgorithmType
GzipDeflate compression
ZlibZlib compression

Header files: hex.h, base64.h, base32.h, gzip.h, zlib.h


Algorithm Selection Guide

By Use Case

I need to hash data (file integrity, checksums):

  • Modern projects: BLAKE3
  • FIPS-standardised: SHA-256 or SHA-512
  • Legacy compatibility: SHA-1 (deprecated)

I need to hash passwords:

  • Modern projects: Argon2id
  • Compatibility: PBKDF2 or scrypt

I need to encrypt data:

  • Modern projects: AES-GCM or ChaCha20-Poly1305
  • No AES hardware: ChaCha20-Poly1305
  • FIPS-standardised: AES-GCM

I need digital signatures:

  • Modern projects: Ed25519
  • NIST-standardised: ECDSA (P-256)
  • Legacy systems: RSA (2048-bit minimum)
  • Long-lived or post-quantum requirements: ML-DSA, or a hybrid classical + PQC design where the protocol requires it
  • Hash-based post-quantum: SLH-DSA for stateless use; LMS/HSS only where durable signer state can be managed

I need key exchange:

  • Modern projects: X25519
  • NIST-standardised: ECDH (P-256)
  • Long-lived or post-quantum requirements: ML-KEM, or X-Wing where its exact draft revision is acceptable
  • Legacy systems: DH (2048-bit minimum)

I need message authentication:

  • General purpose: HMAC-SHA256
  • Fast keyed hashing: BLAKE3 keyed mode
  • Block cipher-based: CMAC-AES

Security Levels

Key Size Equivalents

SymmetricHash outputRSAECCClassical Strength
128-bit256-bit3072-bit256-bit128-bit
192-bit384-bit7680-bit384-bit192-bit
256-bit512-bit15360-bit521-bit256-bit

Hash equivalence in this table refers to collision resistance.

Recommended Minimum Sizes (2026)

  • Symmetric encryption: 128-bit (AES-128)
  • Hash functions: 256-bit (SHA-256, BLAKE3)
  • RSA: 2048-bit (3072-bit for long-term)
  • Elliptic curves: 256-bit (P-256, Curve25519)
  • Diffie-Hellman: 2048-bit

Standards Compliance

FIPS 140-2/140-3

FIPS-standardised algorithms implemented by cryptopp-modern:

  • AES (all key sizes)
  • SHA-2 family (SHA-224, SHA-256, SHA-384, SHA-512)
  • SHA-3 family
  • RSA (2048-bit minimum)
  • ECDSA (P-256, P-384, P-521)
  • HMAC (with approved hash functions)

Note: implementing a FIPS-specified algorithm is not the same as providing a FIPS-approved operational implementation. cryptopp-modern is not a FIPS 140-validated module; it implements the algorithms in a form suitable for integration into an appropriately validated module.

FIPS Post-Quantum Standards

  • FIPS 203 - ML-KEM (Module-Lattice-Based Key-Encapsulation Mechanism)
  • FIPS 204 - ML-DSA (Module-Lattice-Based Digital Signature Algorithm)
  • FIPS 205 - SLH-DSA (Stateless Hash-Based Digital Signature Algorithm)
  • SP 800-208 - LMS/HSS (Stateful Hash-Based Signature Schemes). Conformant signing deployments have additional hardware-module and key-handling requirements beyond the algorithm implementation; see the LMS/HSS API reference.

NIST Recommendations

  • Hash: SHA-256, SHA-384, SHA-512, SHA-3
  • Symmetric: AES-128, AES-256
  • Signatures: ECDSA (P-256+), RSA (2048-bit+), ML-DSA, SLH-DSA, LMS/HSS (stateful)
  • Key Exchange: ECDH (P-256+), ML-KEM

RFC Standards

  • Argon2: RFC 9106
  • scrypt: RFC 7914
  • ChaCha20-Poly1305: RFC 8439
  • Ed25519: RFC 8032
  • X25519: RFC 7748
  • HMAC: RFC 2104
  • HKDF: RFC 5869
  • ARIA: RFC 5794

Deprecated Algorithms

Do not use for new projects:

AlgorithmStatusReason
DES❌ Broken56-bit key too small
3DES⚠️ DeprecatedSlow, small block size
RC4❌ BrokenMultiple vulnerabilities
MD5❌ BrokenCollision attacks
SHA-1⚠️ DeprecatedCollision attacks
DSA (1024-bit)❌ InsecureKey size too small
RSA (1024-bit)❌ InsecureKey size too small

Quick Reference

Most common combinations:

// File hashing
BLAKE3 or SHA-256

// Password storage
Argon2id

// Symmetric encryption
AES-256-GCM or ChaCha20-Poly1305

// Digital signatures
Ed25519 or ECDSA-P256 (classical), ML-DSA (post-quantum)

// Key exchange
X25519 or ECDH-P256 (classical), ML-KEM (post-quantum)

// Message authentication
HMAC-SHA256 or BLAKE3 keyed mode

Documentation Links


Platform Support

The library baseline is C++11. See the build documentation and the repository CI matrix for the compilers and architectures currently built and tested; algorithm availability is not separately guaranteed per platform beyond what CI covers.

Hardware acceleration is used where the CPU supports it:

  • AES (AES-NI on x86/x64)
  • SHA-256 (SHA extensions)
  • ChaCha20 (SSE2, SSSE3, AVX2, NEON, Altivec)
  • BLAKE3 (SSE4.1, AVX2, AVX-512)