# mahdighr/asymmetric-cryptography-cystem-diypg architecture

> Architecture diagram of the GitHub repository mahdighr/asymmetric-cryptography-cystem-diypg, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahdighr/asymmetric-cryptography-cystem-diypg
- Repository: https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg

## Overview

DIYPG is an educational RSA privacy tool spanning byte-level and GMP block encryption, an interactive key/contact directory, file signing and verification, and a documented Python blockchain key-management phase. The main C entry points are the demonstration program (`src/main.c`) and the interactive shell (`src/interprete.c`); the shell dispatches directory, file-crypto, conversion, and signature commands. Supporting layers provide RSA arithmetic, SHA-256, and Base64. The phase-5 directory appears in the tree, but its implementation files are not listed or sampled, so its internal components and connections are not inferred.

Main entry points: [`src/interprete.c`](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c) (Interactive shell), [`src/main.c`](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/main.c) (C demonstrations), [`src/phase4/sign.c`](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/sign.c) (File signing), [`src/phase4/clef.c`](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/clef.c) (Key directory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_demo["C demonstrations<br/>[main.c]"]
  node_shell["Interactive shell<br/>[interprete.c]"]
end

subgraph group_rsa["RSA operations"]
  node_smallrsa["Byte RSA<br/>[phase1.c]"]
  node_rsa_math["RSA key math<br/>[rsa_tools.c]"]
  node_blockrsa["Block and file RSA<br/>[phase2.c]"]
  node_base64["Base64 conversion<br/>[other_base64.c]"]
end

subgraph group_directory["Key directory"]
  node_keydir["Key directory<br/>[clef.c]"]
  node_contacts["Contact directory<br/>[contact.c]"]
  node_savedirectory["Directory save/load<br/>[interprete.c]"]
  node_certreq["Certificate requests<br/>[interprete.c]"]
end

subgraph group_integrity["Signing and integrity"]
  node_signflow["File signing<br/>[sign.c]"]
  node_sha["SHA-256<br/>[sha256.c]"]
  node_signature["Signature verification<br/>[sign.c]"]
end

subgraph group_decentralized["Decentralized keys"]
  node_blockchain["Blockchain key management"]
end

node_user(("User"))

node_user -->|"runs demo"| node_demo
node_user -->|"enters commands"| node_shell
node_user -.->|"uses phase 5"| node_blockchain
node_demo -->|"demonstrates byte RSA"| node_smallrsa
node_demo -->|"demonstrates block RSA"| node_blockrsa
node_smallrsa -->|"computes modular powers"| node_rsa_math
node_demo -->|"generates keys"| node_rsa_math
node_shell -->|"manages keys"| node_keydir
node_shell -->|"manages contacts"| node_contacts
node_shell -->|"encrypts or decrypts files"| node_blockrsa
node_shell -->|"converts files"| node_base64
node_shell -->|"saves or loads directory"| node_savedirectory
node_shell -->|"creates requests"| node_certreq
node_shell -->|"signs files"| node_signflow
node_shell -->|"verifies signatures"| node_signature
node_signflow -->|"looks up keys"| node_keydir
node_signflow -->|"hashes input file"| node_sha
node_signature -->|"looks up keys"| node_keydir
node_signature -->|"rehashes input file"| node_sha

click node_demo "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/main.c"
click node_shell "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c"
click node_smallrsa "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase1/phase1.c"
click node_rsa_math "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/core/rsa_tools.c"
click node_blockrsa "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase2/phase2.c"
click node_base64 "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/core/other_base64.c"
click node_keydir "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/clef.c"
click node_contacts "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/contact.c"
click node_savedirectory "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c"
click node_certreq "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c"
click node_signflow "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/sign.c"
click node_sha "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/core/sha256.c"
click node_signature "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/sign.c"
click node_blockchain "https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/tree/main/src/phase5/python_blockchain_app"

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_demo,node_shell,node_user toneBlue
class node_smallrsa,node_rsa_math,node_blockrsa,node_base64 toneAmber
class node_keydir,node_contacts,node_savedirectory,node_certreq toneMint
class node_signflow,node_sha,node_signature toneRose
class node_blockchain toneIndigo
```

## Components

### User interfaces

- [C demonstrations](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/main.c): `src/main.c`
- [Interactive shell](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c): `src/interprete.c`

### RSA operations

- [Byte RSA](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase1/phase1.c): `src/phase1/phase1.c`
- [RSA key math](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/core/rsa_tools.c): `src/core/rsa_tools.c`
- [Block and file RSA](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase2/phase2.c): `src/phase2/phase2.c`
- [Base64 conversion](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/core/other_base64.c): `src/core/other_base64.c`

### Key directory

- [Key directory](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/clef.c): `src/phase4/clef.c`
- [Contact directory](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/contact.c): `src/phase4/contact.c`
- [Directory save/load](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c): `src/interprete.c`
- [Certificate requests](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/interprete.c): `src/interprete.c`

### Signing and integrity

- [File signing](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/sign.c): `src/phase4/sign.c`
- [SHA-256](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/core/sha256.c): `src/core/sha256.c`
- [Signature verification](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/blob/main/src/phase4/sign.c): `src/phase4/sign.c`

### Decentralized keys

- [Blockchain key management](https://github.com/mahdighr/asymmetric-cryptography-cystem-diypg/tree/main/src/phase5/python_blockchain_app): `src/phase5/python_blockchain_app`

### Other components

- **User**

## Connections

- User → C demonstrations: runs demo
- User → Interactive shell: enters commands
- User → Blockchain key management: uses phase 5
- C demonstrations → Byte RSA: demonstrates byte RSA
- C demonstrations → Block and file RSA: demonstrates block RSA
- Byte RSA → RSA key math: computes modular powers
- C demonstrations → RSA key math: generates keys
- Interactive shell → Key directory: manages keys
- Interactive shell → Contact directory: manages contacts
- Interactive shell → Block and file RSA: encrypts or decrypts files
- Interactive shell → Base64 conversion: converts files
- Interactive shell → Directory save/load: saves or loads directory
- Interactive shell → Certificate requests: creates requests
- Interactive shell → File signing: signs files
- Interactive shell → Signature verification: verifies signatures
- File signing → Key directory: looks up keys
- File signing → SHA-256: hashes input file
- Signature verification → Key directory: looks up keys
- Signature verification → SHA-256: rehashes input file
