# ascon/ascon-hardware architecture

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

- Interactive diagram: https://gitdiagram.com/ascon/ascon-hardware
- Repository: https://github.com/ascon/ascon-hardware

## Overview

This software subset provides Ascon v1.2 reference cryptography and cryptotvgen, a command-line tool for producing hardware test vectors. The documented workflow is to prepare candidate libraries, select vector-generation options, run generation, and use the resulting vectors with the hardware testbench. The graph includes both AEAD and hashing reference variants and their permutation layer. Relationships involving unexcerpted implementations are limited to references in the SOURCE INDEX or README; the hardware-side consumption of generated files is documented, not represented as inspected source.

Main entry points: [`software/cryptotvgen/cryptotvgen/generator.py`](https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/generator.py) (Vector generator), [`software/ascon_ref/crypto_aead/ascon128v12/ref/round.h`](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/round.h) (Round functions), [`software/cryptotvgen/cryptotvgen/cli.py`](https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/cli.py) (CLI), [`software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h`](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h) (AEAD permutations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tool["Vector generation"]
  node_cli["CLI<br/>[cli.py]"]
  node_options["Options<br/>[options.py]"]
  node_generator["Vector generator<br/>[generator.py]"]
  node_prepare["Library preparation<br/>[prepare_libs.py]"]
  node_vectors["Test vectors"]
end

subgraph group_aead["AEAD references"]
  node_aead128["Ascon-128 AEAD<br/>[encrypt.c]"]
  node_aead128dec["Ascon-128 decrypt<br/>[decrypt.c]"]
  node_aead128a["Ascon-128a AEAD<br/>[encrypt.c]"]
  node_aead128adec["Ascon-128a decrypt<br/>[decrypt.c]"]
end

subgraph group_hash["Hash references"]
  node_hashv["Ascon hash<br/>[hash.c]"]
  node_hashav["Ascon- a hash<br/>[hash.c]"]
end

subgraph group_crypto["Crypto primitives"]
  node_aeadperm["AEAD permutations<br/>[permutations.h]"]
  node_aeadaperm["AEAD-a permutations<br/>[permutations.h]"]
  node_hashperm["Hash permutations<br/>[permutations.h]"]
  node_hashaperm["Hash-a permutations<br/>[permutations.h]"]
  node_round["Round functions<br/>[round.h]"]
  node_state["State representation<br/>[ascon.h]"]
  node_print["State tracing<br/>[printstate.h]"]
end

node_user(("Engineer"))
node_hw(("Hardware testbench"))

node_user -->|"runs"| node_cli
node_cli -->|"parses"| node_options
node_cli -->|"prepares libraries"| node_prepare
node_cli -->|"starts generation"| node_generator
node_generator -->|"uses routines"| node_options
node_generator -->|"loads library helpers"| node_prepare
node_generator -.->|"loads crypto library"| node_aead128
node_generator -.->|"loads crypto library"| node_aead128a
node_generator -.->|"loads crypto library"| node_hashv
node_generator -.->|"loads crypto library"| node_hashav
node_generator -->|"writes vectors"| node_vectors
node_aead128 -->|"uses permutation"| node_aeadperm
node_aead128dec -->|"uses permutation"| node_aeadperm
node_aead128a -->|"uses permutation"| node_aeadaperm
node_aead128adec -->|"uses permutation"| node_aeadaperm
node_hashv -->|"uses permutation"| node_hashperm
node_hashav -->|"uses permutation"| node_hashaperm
node_aeadperm -->|"applies rounds"| node_round
node_aeadaperm -->|"applies rounds"| node_round
node_hashperm -->|"applies rounds"| node_round
node_hashaperm -->|"applies rounds"| node_round
node_round -->|"updates"| node_state
node_aeadperm -->|"traces state"| node_print
node_hw -->|"consumes vectors"| node_vectors

click node_cli "https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/cli.py"
click node_options "https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/options.py"
click node_generator "https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/generator.py"
click node_prepare "https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/prepare_libs.py"
click node_aead128 "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/encrypt.c"
click node_aead128dec "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/decrypt.c"
click node_aead128a "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128av12/ref/encrypt.c"
click node_aead128adec "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128av12/ref/decrypt.c"
click node_hashv "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashv12/ref/hash.c"
click node_hashav "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashav12/ref/hash.c"
click node_aeadperm "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h"
click node_aeadaperm "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128av12/ref/permutations.h"
click node_hashperm "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashv12/ref/permutations.h"
click node_hashaperm "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashav12/ref/permutations.h"
click node_round "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/round.h"
click node_state "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/ascon.h"
click node_print "https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/printstate.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_cli,node_options,node_generator,node_prepare,node_vectors toneBlue
class node_aead128,node_aead128dec,node_aead128a,node_aead128adec toneAmber
class node_hashv,node_hashav toneMint
class node_aeadperm,node_aeadaperm,node_hashperm,node_hashaperm,node_round,node_state,node_print toneRose
class node_user,node_hw toneIndigo
```

## Components

### Vector generation

- [CLI](https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/cli.py): `software/cryptotvgen/cryptotvgen/cli.py`
- [Options](https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/options.py): `software/cryptotvgen/cryptotvgen/options.py`
- [Vector generator](https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/generator.py): `software/cryptotvgen/cryptotvgen/generator.py`
- [Library preparation](https://github.com/ascon/ascon-hardware/blob/master/software/cryptotvgen/cryptotvgen/prepare_libs.py): `software/cryptotvgen/cryptotvgen/prepare_libs.py`
- **Test vectors**

### AEAD references

- [Ascon-128 AEAD](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/encrypt.c): `software/ascon_ref/crypto_aead/ascon128v12/ref/encrypt.c`
- [Ascon-128 decrypt](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/decrypt.c): `software/ascon_ref/crypto_aead/ascon128v12/ref/decrypt.c`
- [Ascon-128a AEAD](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128av12/ref/encrypt.c): `software/ascon_ref/crypto_aead/ascon128av12/ref/encrypt.c`
- [Ascon-128a decrypt](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128av12/ref/decrypt.c): `software/ascon_ref/crypto_aead/ascon128av12/ref/decrypt.c`

### Hash references

- [Ascon hash](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashv12/ref/hash.c): `software/ascon_ref/crypto_hash/asconhashv12/ref/hash.c`
- [Ascon- a hash](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashav12/ref/hash.c): `software/ascon_ref/crypto_hash/asconhashav12/ref/hash.c`

### Crypto primitives

- [AEAD permutations](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h): `software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h`
- [AEAD-a permutations](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128av12/ref/permutations.h): `software/ascon_ref/crypto_aead/ascon128av12/ref/permutations.h`
- [Hash permutations](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashv12/ref/permutations.h): `software/ascon_ref/crypto_hash/asconhashv12/ref/permutations.h`
- [Hash-a permutations](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_hash/asconhashav12/ref/permutations.h): `software/ascon_ref/crypto_hash/asconhashav12/ref/permutations.h`
- [Round functions](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/round.h): `software/ascon_ref/crypto_aead/ascon128v12/ref/round.h`
- [State representation](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/ascon.h): `software/ascon_ref/crypto_aead/ascon128v12/ref/ascon.h`
- [State tracing](https://github.com/ascon/ascon-hardware/blob/master/software/ascon_ref/crypto_aead/ascon128v12/ref/printstate.h): `software/ascon_ref/crypto_aead/ascon128v12/ref/printstate.h`

### Other components

- **Engineer**
- **Hardware testbench**

## Connections

- Engineer → CLI: runs
- CLI → Options: parses (evidence: `software/cryptotvgen/cryptotvgen/cli.py`)
- CLI → Library preparation: prepares libraries (evidence: `software/cryptotvgen/cryptotvgen/cli.py`)
- CLI → Vector generator: starts generation (evidence: `software/cryptotvgen/cryptotvgen/cli.py`)
- Vector generator → Options: uses routines (evidence: `software/cryptotvgen/cryptotvgen/generator.py`)
- Vector generator → Library preparation: loads library helpers (evidence: `software/cryptotvgen/cryptotvgen/generator.py`)
- Vector generator → Ascon-128 AEAD: loads crypto library
- Vector generator → Ascon-128a AEAD: loads crypto library
- Vector generator → Ascon hash: loads crypto library
- Vector generator → Ascon- a hash: loads crypto library
- Vector generator → Test vectors: writes vectors
- Ascon-128 AEAD → AEAD permutations: uses permutation (evidence: `software/ascon_ref/crypto_aead/ascon128v12/ref/encrypt.c`)
- Ascon-128 decrypt → AEAD permutations: uses permutation (evidence: `software/ascon_ref/crypto_aead/ascon128v12/ref/decrypt.c`)
- Ascon-128a AEAD → AEAD-a permutations: uses permutation (evidence: `software/ascon_ref/crypto_aead/ascon128av12/ref/encrypt.c`)
- Ascon-128a decrypt → AEAD-a permutations: uses permutation (evidence: `software/ascon_ref/crypto_aead/ascon128av12/ref/decrypt.c`)
- Ascon hash → Hash permutations: uses permutation (evidence: `software/ascon_ref/crypto_hash/asconhashv12/ref/hash.c`)
- Ascon- a hash → Hash-a permutations: uses permutation (evidence: `software/ascon_ref/crypto_hash/asconhashav12/ref/hash.c`)
- AEAD permutations → Round functions: applies rounds (evidence: `software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h`)
- AEAD-a permutations → Round functions: applies rounds (evidence: `software/ascon_ref/crypto_aead/ascon128av12/ref/permutations.h`)
- Hash permutations → Round functions: applies rounds (evidence: `software/ascon_ref/crypto_hash/asconhashv12/ref/permutations.h`)
- Hash-a permutations → Round functions: applies rounds (evidence: `software/ascon_ref/crypto_hash/asconhashav12/ref/permutations.h`)
- Round functions → State representation: updates (evidence: `software/ascon_ref/crypto_aead/ascon128v12/ref/round.h`)
- AEAD permutations → State tracing: traces state (evidence: `software/ascon_ref/crypto_aead/ascon128v12/ref/permutations.h`)
- Hardware testbench → Test vectors: consumes vectors
