# paulowh/sistema-criptografia architecture

> Architecture diagram of the GitHub repository paulowh/sistema-criptografia, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paulowh/sistema-criptografia
- Repository: https://github.com/paulowh/sistema-criptografia

## Overview

##### Project Type & Purpose
- This is a Python application focused on encryption and decryption of text messages.
- The system is built to transmit and receive encrypted messages so that only users with the appropriate keys can access them.
- Key features include text encryption/decryption (using public key cryptography), file saving, integration with WhatsApp, and QR Code reading, along with automated key generation.

##### Analyzing the File Structure
- The project contains a few top-level files, indicating a relatively small and self-contained system:
- main.py: Likely the entry point that orchestrates the encryption and decryption processes.
- config.txt: Stores configuration settings for encryption parameters or other options.
- requirements.txt: Lists dependencies, ensuring that the right Python libraries are installed.
- texto.txt: Possibly a sample input or output file for testing the encryption/decryption routines.
- .gitignore and README.md: Standard support files for version control and project documentation.
- The lack of separate directories suggests that the application is monolithic, with most logic handled within a central script (or a few modules).

- Main Components to Include:
- Entry Point (main.py): The central controller initiating encryption/decryption workflows.
- Configuration Module: Reads from config.txt to set the parameters or options necessary for the operations.
- Cryptographic Engine:
- Encryption Module: Handles encrypting text using public keys.
- Decryption Module: Handles decrypting text provided a proper key.
- Key Generation Module: Responsible for generating the necessary cryptographic keys.
- File I/O Module: Manages reading of plaintext inputs (possibly from texto.txt) and saving encrypted messages to files.
- External Integration:
- WhatsApp Integration: Takes care of sharing encrypted messages.
- QR Code Handling: Reads QR codes which might encode keys or messages.
- Relationships & Flow:
- The main.py module will coordinate between reading the configuration, obtaining text input, encrypting or decrypting the text, and finally, managing file output or external communications.
- Architectural Patterns & Design Principles:
- Despite its small size, emphasize a layered or modular pattern: separating concerns between configuration, processing (encryption/decryption), and I/O/external integrations.
- Clearly delineate how the data flows between these components.
- Technologies and Frameworks:
- Python is the core language.
- Although not explicitly detailed in the file tree, dependencies listed in requirements.txt likely include cryptographic libraries (such as PyCryptodome or similar) and possibly libraries for QR code processing and WhatsApp integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layers
    A["Main Controller (main.py)"]:::main
    B["Configuration Module (config.txt)"]:::config
    C["File I/O Module (texto.txt)"]:::io
    D["WhatsApp Integration"]:::integration
    E["QR Code Handler"]:::integration

    %% Cryptographic Engine Subgraph
    subgraph "Cryptographic Engine"
        F["Encryption Module"]:::crypto
        G["Decryption Module"]:::crypto
        H["Key Generation Module"]:::crypto
    end

    %% Support Files Subgraph
    subgraph "Support Files"
        I["Dependencies (requirements.txt)"]:::support
        J["Version Control (.gitignore)"]:::support
        K["Documentation (README.md)"]:::support
    end

    %% Data Flow Connections
    A -->|"reads"| B
    A -->|"invokes"| F
    A -->|"invokes"| G
    A -->|"triggers"| H
    F -->|"saves output to"| C
    G -->|"saves output to"| C
    A -->|"sends to"| D
    A -->|"sends to"| E
    B -->|"configures"| F
    B -->|"configures"| G
    B -->|"configures"| H

    %% Support Files connected to Main Controller
    I -->|"required_for"| A
    J -->|"supports"| A
    K -->|"documents"| A

    %% Click Events
    click A "https://github.com/paulowh/sistema-criptografia/blob/main/main.py"
    click B "https://github.com/paulowh/sistema-criptografia/blob/main/config.txt"
    click C "https://github.com/paulowh/sistema-criptografia/blob/main/texto.txt"
    click I "https://github.com/paulowh/sistema-criptografia/blob/main/requirements.txt"
    click J "https://github.com/paulowh/sistema-criptografia/blob/main/.gitignore"
    click K "https://github.com/paulowh/sistema-criptografia/blob/main/README.md"

    %% Styles
    classDef main fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef config fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef crypto fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef io fill:#98FB98,stroke:#000,stroke-width:2px;
    classDef integration fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef support fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
