# weidai11/cryptopp architecture

> Architecture diagram of the GitHub repository weidai11/cryptopp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/weidai11/cryptopp
- Repository: https://github.com/weidai11/cryptopp

## Overview

Crypto++ is a C++ cryptographic library, not a standalone application: callers select algorithms and use a common API to process data. Its capabilities span symmetric encryption and authentication, hashing, public-key operations, key derivation and random generation, plus encoding, checksums, compression, and arithmetic utilities. The README also describes a filter/pipeline interface and hardware-accelerated implementations. The excerpts do not show a single end-to-end runtime entry point, so the graph presents these as library capabilities rather than an invented execution chain.

Main entry points: [`filters.h`](https://github.com/weidai11/cryptopp/blob/master/filters.h) (Filter pipeline), [`cryptlib.h`](https://github.com/weidai11/cryptopp/blob/master/cryptlib.h) (Crypto interfaces), [`cpu.h`](https://github.com/weidai11/cryptopp/blob/master/cpu.h) (CPU feature detection), [`algparam.h`](https://github.com/weidai11/cryptopp/blob/master/algparam.h) (Algorithm parameters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Core API"]
  node_cryptlib["Crypto interfaces<br/>[cryptlib.h]"]
  node_filterpipeline["Filter pipeline<br/>[filters.h]"]
  node_algorithmparams["Algorithm parameters<br/>[algparam.h]"]
  node_securememory["Secure memory<br/>[secblock.h]"]
  node_ownership["Resource ownership<br/>[smartptr.h]"]
  node_commonutilities["Common utilities<br/>[misc.h]"]
  node_standardheaders["C++ support<br/>[stdcpp.h]"]
end

subgraph group_symmetric["Symmetric Cryptography"]
  node_blockciphers["Block ciphers and modes<br/>[modes.h]"]
  node_streamciphers["Stream ciphers<br/>[chacha.h]"]
  node_authenticatedencryption["Authenticated encryption<br/>[authenc.h]"]
  node_hashing["Hash functions<br/>[sha.h]"]
  node_macs["Message authentication<br/>[hmac.h]"]
end

subgraph group_publickey["Public-Key Cryptography"]
  node_publickey["Public-key schemes<br/>[pubkey.h]"]
  node_asymmetricencoding["Key encoding<br/>[asn.h]"]
  node_multiprecision["Multiprecision arithmetic<br/>[integer.h]"]
  node_numbertheory["Number theory<br/>[nbtheory.h]"]
end

subgraph group_support["Supporting Capabilities"]
  node_randomgeneration["Random generation<br/>[rng.cpp]"]
  node_keyderivation["Key derivation<br/>[pwdbased.h]"]
  node_encoding["Data encoding<br/>[base64.h]"]
  node_compression["Compression<br/>[zlib.h]"]
  node_checksums["Checksums<br/>[crc.h]"]
  node_validation["Validation support<br/>[validate.h]"]
end

subgraph group_platform["Platform Acceleration"]
  node_cpu["CPU feature detection<br/>[cpu.h]"]
  node_simdimplementations["SIMD implementations<br/>[adv_simd.h]"]
  node_curve25519implementations["Curve25519 implementations<br/>[donna.h]"]
end

node_caller(("Library caller"))

node_caller -->|"uses API"| node_cryptlib
node_caller -->|"uses pipeline"| node_filterpipeline
node_cryptlib -->|"defines transformation API"| node_filterpipeline
node_filterpipeline -->|"uses parameters"| node_algorithmparams
node_filterpipeline -->|"uses buffers"| node_securememory
node_caller -->|"selects algorithms"| node_blockciphers
node_caller -->|"selects algorithms"| node_streamciphers
node_caller -->|"selects algorithms"| node_authenticatedencryption
node_caller -->|"selects algorithms"| node_hashing
node_caller -->|"selects algorithms"| node_macs
node_caller -->|"selects schemes"| node_publickey
node_caller -->|"uses encoding"| node_asymmetricencoding
node_caller -->|"uses arithmetic"| node_multiprecision
node_caller -->|"uses operations"| node_numbertheory
node_caller -->|"uses generators"| node_randomgeneration
node_caller -->|"derives keys"| node_keyderivation
node_caller -->|"encodes data"| node_encoding
node_caller -->|"compresses data"| node_compression
node_caller -->|"computes checksums"| node_checksums
node_cpu -.->|"selects features"| node_simdimplementations
node_caller -->|"runs validation"| node_validation

click node_cryptlib "https://github.com/weidai11/cryptopp/blob/master/cryptlib.h"
click node_filterpipeline "https://github.com/weidai11/cryptopp/blob/master/filters.h"
click node_algorithmparams "https://github.com/weidai11/cryptopp/blob/master/algparam.h"
click node_securememory "https://github.com/weidai11/cryptopp/blob/master/secblock.h"
click node_ownership "https://github.com/weidai11/cryptopp/blob/master/smartptr.h"
click node_commonutilities "https://github.com/weidai11/cryptopp/blob/master/misc.h"
click node_standardheaders "https://github.com/weidai11/cryptopp/blob/master/stdcpp.h"
click node_blockciphers "https://github.com/weidai11/cryptopp/blob/master/modes.h"
click node_streamciphers "https://github.com/weidai11/cryptopp/blob/master/chacha.h"
click node_authenticatedencryption "https://github.com/weidai11/cryptopp/blob/master/authenc.h"
click node_hashing "https://github.com/weidai11/cryptopp/blob/master/sha.h"
click node_macs "https://github.com/weidai11/cryptopp/blob/master/hmac.h"
click node_publickey "https://github.com/weidai11/cryptopp/blob/master/pubkey.h"
click node_asymmetricencoding "https://github.com/weidai11/cryptopp/blob/master/asn.h"
click node_multiprecision "https://github.com/weidai11/cryptopp/blob/master/integer.h"
click node_numbertheory "https://github.com/weidai11/cryptopp/blob/master/nbtheory.h"
click node_randomgeneration "https://github.com/weidai11/cryptopp/blob/master/rng.cpp"
click node_keyderivation "https://github.com/weidai11/cryptopp/blob/master/pwdbased.h"
click node_encoding "https://github.com/weidai11/cryptopp/blob/master/base64.h"
click node_compression "https://github.com/weidai11/cryptopp/blob/master/zlib.h"
click node_checksums "https://github.com/weidai11/cryptopp/blob/master/crc.h"
click node_cpu "https://github.com/weidai11/cryptopp/blob/master/cpu.h"
click node_simdimplementations "https://github.com/weidai11/cryptopp/blob/master/adv_simd.h"
click node_curve25519implementations "https://github.com/weidai11/cryptopp/blob/master/donna.h"
click node_validation "https://github.com/weidai11/cryptopp/blob/master/validate.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cryptlib,node_filterpipeline,node_algorithmparams,node_securememory,node_ownership,node_commonutilities,node_standardheaders toneBlue
class node_blockciphers,node_streamciphers,node_authenticatedencryption,node_hashing,node_macs toneAmber
class node_publickey,node_asymmetricencoding,node_multiprecision,node_numbertheory toneMint
class node_randomgeneration,node_keyderivation,node_encoding,node_compression,node_checksums,node_validation toneRose
class node_cpu,node_simdimplementations,node_curve25519implementations,node_caller toneIndigo
```

## Components

### Core API

- [Crypto interfaces](https://github.com/weidai11/cryptopp/blob/master/cryptlib.h): `cryptlib.h`
- [Filter pipeline](https://github.com/weidai11/cryptopp/blob/master/filters.h): `filters.h`
- [Algorithm parameters](https://github.com/weidai11/cryptopp/blob/master/algparam.h): `algparam.h`
- [Secure memory](https://github.com/weidai11/cryptopp/blob/master/secblock.h): `secblock.h`
- [Resource ownership](https://github.com/weidai11/cryptopp/blob/master/smartptr.h): `smartptr.h`
- [Common utilities](https://github.com/weidai11/cryptopp/blob/master/misc.h): `misc.h`
- [C++ support](https://github.com/weidai11/cryptopp/blob/master/stdcpp.h): `stdcpp.h`

### Symmetric Cryptography

- [Block ciphers and modes](https://github.com/weidai11/cryptopp/blob/master/modes.h): `modes.h`
- [Stream ciphers](https://github.com/weidai11/cryptopp/blob/master/chacha.h): `chacha.h`
- [Authenticated encryption](https://github.com/weidai11/cryptopp/blob/master/authenc.h): `authenc.h`
- [Hash functions](https://github.com/weidai11/cryptopp/blob/master/sha.h): `sha.h`
- [Message authentication](https://github.com/weidai11/cryptopp/blob/master/hmac.h): `hmac.h`

### Public-Key Cryptography

- [Public-key schemes](https://github.com/weidai11/cryptopp/blob/master/pubkey.h): `pubkey.h`
- [Key encoding](https://github.com/weidai11/cryptopp/blob/master/asn.h): `asn.h`
- [Multiprecision arithmetic](https://github.com/weidai11/cryptopp/blob/master/integer.h): `integer.h`
- [Number theory](https://github.com/weidai11/cryptopp/blob/master/nbtheory.h): `nbtheory.h`

### Supporting Capabilities

- [Random generation](https://github.com/weidai11/cryptopp/blob/master/rng.cpp): `rng.cpp`
- [Key derivation](https://github.com/weidai11/cryptopp/blob/master/pwdbased.h): `pwdbased.h`
- [Data encoding](https://github.com/weidai11/cryptopp/blob/master/base64.h): `base64.h`
- [Compression](https://github.com/weidai11/cryptopp/blob/master/zlib.h): `zlib.h`
- [Checksums](https://github.com/weidai11/cryptopp/blob/master/crc.h): `crc.h`
- [Validation support](https://github.com/weidai11/cryptopp/blob/master/validate.h): `validate.h`

### Platform Acceleration

- [CPU feature detection](https://github.com/weidai11/cryptopp/blob/master/cpu.h): `cpu.h`
- [SIMD implementations](https://github.com/weidai11/cryptopp/blob/master/adv_simd.h): `adv_simd.h`
- [Curve25519 implementations](https://github.com/weidai11/cryptopp/blob/master/donna.h): `donna.h`

### Other components

- **Library caller**

## Connections

- Library caller → Crypto interfaces: uses API
- Library caller → Filter pipeline: uses pipeline
- Crypto interfaces → Filter pipeline: defines transformation API (evidence: `filters.h`)
- Filter pipeline → Algorithm parameters: uses parameters (evidence: `filters.h`)
- Filter pipeline → Secure memory: uses buffers (evidence: `filters.h`)
- Library caller → Block ciphers and modes: selects algorithms
- Library caller → Stream ciphers: selects algorithms
- Library caller → Authenticated encryption: selects algorithms
- Library caller → Hash functions: selects algorithms
- Library caller → Message authentication: selects algorithms
- Library caller → Public-key schemes: selects schemes
- Library caller → Key encoding: uses encoding
- Library caller → Multiprecision arithmetic: uses arithmetic
- Library caller → Number theory: uses operations
- Library caller → Random generation: uses generators
- Library caller → Key derivation: derives keys
- Library caller → Data encoding: encodes data
- Library caller → Compression: compresses data
- Library caller → Checksums: computes checksums
- CPU feature detection → SIMD implementations: selects features
- Library caller → Validation support: runs validation
