Algorithm Reference

Algorithm Reference

This page provides a comprehensive reference of all cryptographic algorithms available in cryptopp-modern.

Hash Functions

Modern (Recommended)

AlgorithmOutput SizeSpeedSecurityUse Case
BLAKE3256-bit (variable)⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐General purpose, file integrity, content addressing
SHA-256256-bit⭐⭐⭐⭐⭐⭐⭐⭐FIPS compliance, general purpose
SHA-512512-bit⭐⭐⭐⭐⭐⭐⭐⭐⭐High security, 64-bit systems
SHA3-256256-bit⭐⭐⭐⭐⭐⭐⭐NIST standard, alternative to SHA-2
SHA3-512512-bit⭐⭐⭐⭐⭐⭐⭐High security NIST standard
BLAKE2b512-bit (variable)⭐⭐⭐⭐⭐⭐⭐⭐⭐High performance alternative to SHA-2
BLAKE2s256-bit (variable)⭐⭐⭐⭐⭐⭐⭐⭐⭐Optimised for 32-bit systems

Legacy (Compatibility Only)

AlgorithmOutput SizeStatusNotes
SHA-1160-bit⚠️ DeprecatedUse only for legacy compatibility
MD5128-bit❌ BrokenNon-cryptographic purposes 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-HardTime CostUse Case
Argon2id✅ YesTunablePassword hashing (recommended)
Argon2i✅ YesTunableSide-channel resistance
Argon2d✅ YesTunableMaximum GPU resistance
Scrypt✅ YesFixedLegacy password hashing
PBKDF2❌ NoTunableLegacy systems, NIST compliance

Key Derivation Functions (KDF)

AlgorithmTypeUse Case
HKDFExtract-and-expandKey derivation from shared secrets
PBKDF2IterativeLegacy key derivation, PKCS #5
ScryptMemory-hardAlternative to Argon2

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


Symmetric Encryption

Block Ciphers

CipherKey SizesBlock SizeSpeedSecurityUse Case
AES128, 192, 256-bit128-bit⭐⭐⭐⭐⭐⭐⭐⭐⭐Industry standard, FIPS approved
ChaCha20256-bitStream⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐Modern stream cipher, mobile-optimised
Serpent128, 192, 256-bit128-bit⭐⭐⭐⭐⭐⭐⭐High security margin
Twofish128, 192, 256-bit128-bit⭐⭐⭐⭐⭐⭐⭐⭐AES finalist
Camellia128, 192, 256-bit128-bit⭐⭐⭐⭐⭐⭐⭐⭐ISO/IEC 18033-3 standard
ARIA128, 192, 256-bit128-bit⭐⭐⭐⭐⭐⭐⭐⭐Korean standard (RFC 5794)

Authenticated Encryption Modes (Recommended)

ModeAuthenticationUse Case
GCMBuilt-inFast authenticated encryption (AES-GCM, recommended)
CCMBuilt-inConstrained environments
EAXBuilt-inSimple authenticated encryption
ChaCha20-Poly1305Built-inModern AEAD, mobile-optimised

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


Public-Key Cryptography

Digital Signatures

AlgorithmKey SizeSpeedSecurityUse Case
Ed25519256-bit⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐Modern signatures (recommended)
ECDSA (P-256)256-bit⭐⭐⭐⭐⭐⭐⭐⭐⭐NIST standard, wide compatibility
ECDSA (P-384)384-bit⭐⭐⭐⭐⭐⭐⭐⭐High security NIST standard
ECDSA (P-521)521-bit⭐⭐⭐⭐⭐⭐⭐⭐Maximum security NIST curve
RSA (2048-bit)2048-bit⭐⭐⭐⭐⭐⭐Legacy compatibility
RSA (3072-bit)3072-bit⭐⭐⭐⭐⭐Long-term security
RSA (4096-bit)4096-bit⭐⭐⭐⭐⭐Maximum RSA security
DSA1024-3072-bit⭐⭐⭐⭐⭐Legacy FIPS 186

Key Exchange

AlgorithmKey SizeSpeedSecurityUse Case
X25519256-bit⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐Modern key exchange (recommended)
ECDH (P-256)256-bit⭐⭐⭐⭐⭐⭐⭐⭐⭐NIST standard key exchange
ECDH (P-384)384-bit⭐⭐⭐⭐⭐⭐⭐⭐High security key exchange
DH (2048-bit)2048-bit⭐⭐⭐⭐⭐⭐Traditional Diffie-Hellman

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


Message Authentication Codes (MAC)

AlgorithmOutput SizeSpeedUse Case
HMAC-SHA256256-bit⭐⭐⭐⭐General purpose MAC
HMAC-SHA512512-bit⭐⭐⭐⭐High security MAC
HMAC-BLAKE3256-bit⭐⭐⭐⭐⭐Fastest MAC
CMAC-AES128-bit⭐⭐⭐⭐Block cipher-based MAC
Poly1305128-bit⭐⭐⭐⭐⭐Fast one-time MAC (use with ChaCha20)
GMAC128-bit⭐⭐⭐⭐GCM authentication only
SipHash64-bit⭐⭐⭐⭐⭐Cryptographic MAC for hash-table keys / short messages

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


Elliptic Curves

Modern Curves (Recommended)

CurveTypeSecurity LevelUse Case
Curve25519Montgomery128-bitX25519 key exchange
Ed25519Edwards128-bitEd25519 signatures

NIST Curves

CurveTypeSecurity LevelUse Case
P-256 (secp256r1)Weierstrass128-bitNIST standard, wide support
P-384 (secp384r1)Weierstrass192-bitHigh security applications
P-521 (secp521r1)Weierstrass256-bitMaximum NIST security

Other Curves

CurveTypeNotes
secp256k1WeierstrassBitcoin, Ethereum
brainpoolP256r1WeierstrassEuropean standard
brainpoolP384r1WeierstrassEuropean high security
brainpoolP512r1WeierstrassEuropean maximum security

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


Random Number Generators

GeneratorTypeUse Case
AutoSeededRandomPoolCSPRNGGeneral purpose (recommended)
OS_GenerateRandomBlockOS entropyDirect OS random source
RDRANDHardwareIntel/AMD RDRAND instruction
RDSEEDHardwareIntel/AMD RDSEED instruction
RandomPoolCSPRNGManual seeding
LC_RNGDeterministicTesting only (not cryptographically secure)

Header files: osrng.h, randpool.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 compliance: SHA-256 or SHA-512
  • Legacy compatibility: SHA-1 (deprecated)

I need to hash passwords:

  • Modern projects: Argon2id
  • Legacy systems: PBKDF2 or Scrypt

I need to encrypt data:

  • Modern projects: AES-GCM or ChaCha20-Poly1305
  • Mobile/embedded: ChaCha20-Poly1305
  • FIPS compliance: AES-GCM

I need digital signatures:

  • Modern projects: Ed25519
  • NIST compliance: ECDSA (P-256)
  • Legacy systems: RSA (2048-bit minimum)

I need key exchange:

  • Modern projects: X25519
  • NIST compliance: ECDH (P-256)
  • Legacy systems: DH (2048-bit minimum)

I need message authentication:

  • General purpose: HMAC-SHA256
  • Maximum speed: HMAC-BLAKE3
  • Block cipher-based: CMAC-AES

Security Levels

Key Size Equivalents

SymmetricHashRSAECCSecurity Level
128-bit256-bit3072-bit256-bitStandard
192-bit384-bit7680-bit384-bitHigh
256-bit512-bit15360-bit521-bitMaximum

Recommended Minimum Sizes (2025)

  • 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

Approved algorithms:

  • 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: cryptopp-modern implements these algorithms, but cryptopp-modern itself is not a FIPS 140-validated module.

NIST Recommendations

  • Hash: SHA-256, SHA-384, SHA-512, SHA-3
  • Symmetric: AES-128, AES-256
  • Signatures: ECDSA (P-256+), RSA (2048-bit+)
  • Key Exchange: ECDH (P-256+)

RFC Standards

  • Argon2: RFC 9106
  • ChaCha20-Poly1305: RFC 7539
  • 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

// Key exchange
X25519 or ECDH-P256

// Message authentication
HMAC-SHA256 or HMAC-BLAKE3

Documentation Links


Platform Support

All algorithms are supported on:

  • Windows: Visual Studio 2010+, MinGW
  • Linux: GCC 4.8+, Clang 3.4+
  • macOS: Xcode Command Line Tools
  • Architectures: x86, x86_64, ARM, ARM64, RISC-V

Hardware acceleration available for:

  • AES (AES-NI on x86/x64)
  • SHA-256 (SHA extensions)
  • ChaCha20 (SSSE3, AVX2)
  • Curve25519 (AVX2, AVX-512)