Skip to content

Modern Cryptography 
for C++

Actively maintained fork of Crypto++ with modern algorithms, 
better organisation, and regular security updates.

Why cryptopp-modern?

What’s New

2026.12.0

  • LMS: verification for the 20 SHA-256/192 LMS and LM-OTS parameter pairs of RFC 9858, checked against NIST ACVP vectors; signing and key generation for these sets are not included (details)
  • LMS and HSS: a verifier returns false for a public key whose typecodes or level count differ from the verifier’s parameter set
  • ML-KEM: key import runs the FIPS 203 key checks, the hash check for decapsulation keys and the modulus check for encapsulation keys; Decapsulate throws InvalidArgument when no private key is set
  • X-Wing: decapsulation computes X25519 for every ciphertext, as the draft specifies, and the draft’s test vectors run in the validation suite
  • Ed25519: the verifier rejects small-order public keys and signatures that are not 64 bytes
  • DSA and ElGamal: DSAConvertSignatureFormat returns 0 without writing when the input is malformed or the output does not fit; ElGamal encryption throws InvalidArgument for a message longer than FixedMaxPlaintextLength()
  • Builds: the unported cross-build scripts are removed; Android builds use the CMake presets

Previously in 2026.11.1

  • BLAKE2: BLAKE2b and BLAKE2s validate digest size and keyed-constructor key length at run time; invalid arguments throw InvalidKeyLength or InvalidArgument
  • SLH-DSA: stack secrets are wiped on exceptions as well as normal exits
  • Link-time optimisation: tested in CI with GCC through the GNUmakefile and CMake and with Clang through the GNUmakefile; the GNUmakefile feature probes no longer disable SIMD under -flto
  • Packaging: the GNUmakefile no longer installs the test-only validate.h and bench.h; CMake installs factory.h and xaes_256_gcm.h
  • Builds: GNUmakefile per-file rules keep the SIMD flags on rebuilds; CMake 32-bit ARM NEON probes work for Clang and soft-float builds; the Cryptogams ARM assembly no longer requests an executable stack; armhf and armel CI jobs added

Previously in 2026.11.0

  • EAX and AES-CTR-HMAC: repeated EAX resynchronisation carried stale CMAC state into the nonce tag, and AES-CTR-HMAC one-shot calls threw BadState when an object was reused; ciphertext produced through the faulty EAX one-shot path will not verify through the corrected path
  • CMAC: Restart no longer runs a block encryption, which makes EAX resynchronisation cheaper
  • BLAKE3: the SSE4.1 path is compiled without AVX2, fixing SIGILL on CPUs without AVX; the nmake x64 build links again
  • Argon2: unknown variants and input lengths exceeding the RFC 9106 limits are rejected
  • ML-DSA: key generation, signing and verification are checked against NIST ACVP vectors in the validation suite
  • Builds: 32-bit x86 builds with GCC link-time optimisation link again; msvc-debug and msvc-release are build and test presets on the msvc configure preset

Previously in 2026.10.0

  • Argon2i and Argon2id corrected: releases 2025.11.0 through 2026.9.1 computed them differently from RFC 9106 for affected parameter sets, so their output may not match other implementations; ARGON2I_LEGACY and ARGON2ID_LEGACY reproduce the earlier output so stored hashes can be verified and rehashed (migration guide)
  • Ed25519 validation: Validate now rejects all small-order public keys at level 2 and above, completing the 2026.5.2 check
  • ML-DSA and ML-KEM: secret stack buffers are wiped on normal exits and exceptions; ML-DSA key generation and import leave the key unchanged on failure
  • Build fixes: LM-OTS hash length bounded before sizing buffers for ARM-32 GCC -Wstringop-overflow, and the Apple machine-info helper compiled only on PowerPC

Previously in 2026.9.1

  • ARM acceleration restored: the CRC32 and PMULL feature probes could not find arm_simd.h since 2025.12.0, so default CMake and GNUmakefile builds left CRC32 and GCM multiplication on the software paths
  • Apple arm64 hardware dispatch: hardware AES, PMULL, SHA-1 and SHA-256 on Apple Silicon, with the optional CRC32, SHA-3 and SHA-512 extensions detected through sysctl
  • HSS error paths: signer caches are rebuilt after a failed signing attempt, so a retry no longer produces an invalid signature and a burned index; LMS and HSS key generation leaves the key unchanged on failure
  • Shared and static in one pass: CRYPTOPP_BUILD_STATIC alongside CRYPTOPP_BUILD_SHARED, and BUILD_SHARED_LIBS now selects the library type
  • CMake packaging and detection: the configured include directory is exported, pkg-config output is per configuration and carries the Debug postfix, the feature probes no longer fail on warnings under -Werror, a failed AVX-512 probe falls back cleanly, and a new CRYPTOPP_WERROR option turns warnings into errors for the library build

View Full Changelog

Quick Example

#include <cryptopp/blake3.h>
#include <cryptopp/hex.h>
#include <iostream>

int main() {
    CryptoPP::BLAKE3 hash;
    std::string message = "Hello, cryptopp-modern!";
    std::string digest;

    CryptoPP::StringSource(message, true,
        new CryptoPP::HashFilter(hash,
            new CryptoPP::HexEncoder(
                new CryptoPP::StringSink(digest))));

    std::cout << "BLAKE3: " << digest << std::endl;
    return 0;
}