# nidhi-bhatt/imagecrypto architecture

> Architecture diagram of the GitHub repository nidhi-bhatt/imagecrypto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nidhi-bhatt/imagecrypto
- Repository: https://github.com/nidhi-bhatt/imagecrypto

## Overview

##### Project type and purpose
- This is an open-source Python library (“ImageCrypto”) for secure image encryption using multiple symmetric ciphers and ECC for key generation.
- The README calls out a consistent API across modules, performance metrics, and image visualization.

##### File structure
Top-level:
- pyproject.toml / requirements / dist – packaging and distribution artifacts
- src/imagecrypto – core source code
– _init_.py
– main.py (entrypoint / orchestrator)
– aes_gcm_128.py, aes_ccm_128.py, aes_gcm_256.py, aes_eax_128.py, chacha20_poly1305.py, salsa20.py (one module per algorithm)

##### README for additional insights
- Core features: ECC key generation (SECP256R1), symmetric encryption algorithms, consistent API (get_encrypted_image, get_encryption_time, display_images), dependencies (cryptography, pycryptodome, cv2, numpy, matplotlib).
- Usage: user’s Python code imports a cipher module and calls its API.

##### Elements
– Another for external dependencies

##### Final recommendations
- Six cipher modules under a shared “Encryption Strategies” container.
- Optional branches (e.g., display_images path).
- Keep the ECC key-gen component visually centralized if shared.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Boundary
    UserApp["User Application"]:::user

    %% Internal Components
    API["API Layer"]:::internal

    subgraph "Encryption Strategies" 
        direction TB
        AESGCM128["AES-GCM-128 Module"]:::internal
        AESGCM256["AES-GCM-256 Module"]:::internal
        AESCCM128["AES-CCM-128 Module"]:::internal
        AESEAX128["AES-EAX-128 Module"]:::internal
        ChaCha20["ChaCha20-Poly1305 Module"]:::internal
        Salsa20["Salsa20 Module"]:::internal
    end

    subgraph "Utilities" 
        direction TB
        ECC["ECC Key Generator"]:::utility
        IO["Image I/O & Processing"]:::utility
        Timer["Performance Timer"]:::utility
        Viz["Visualization Module"]:::utility
    end

    subgraph "External Dependencies"
        direction TB
        CryptoLib["cryptography / pycryptodome"]:::external
        OpenCV["OpenCV (cv2)"]:::external
        NumPy["numpy"]:::external
        Matplotlib["matplotlib"]:::external
    end

    %% Data Flows
    UserApp -->|"get_encrypted_image()"| API
    API -->|"selects strategy"| AESGCM128
    API -->|"selects strategy"| AESGCM256
    API -->|"selects strategy"| AESCCM128
    API -->|"selects strategy"| AESEAX128
    API -->|"selects strategy"| ChaCha20
    API -->|"selects strategy"| Salsa20

    AESGCM128 -->|"generate_key() / encrypt()"| ECC
    AESGCM128 -->|"load_image() / to_array"| IO
    AESGCM128 -->|"encrypt_bytes"| CryptoLib
    AESGCM128 -->|"record_time()"| Timer
    AESGCM128 -->|"returns data + time"| API

    AESGCM256 -->|"generate_key() / encrypt()"| ECC
    AESGCM256 -->|"load_image() / to_array"| IO
    AESGCM256 -->|"encrypt_bytes"| CryptoLib
    AESGCM256 -->|"record_time()"| Timer
    AESGCM256 -->|"returns data + time"| API

    AESCCM128 -->|"generate_key() / encrypt()"| ECC
    AESCCM128 -->|"load_image() / to_array"| IO
    AESCCM128 -->|"encrypt_bytes"| CryptoLib
    AESCCM128 -->|"record_time()"| Timer
    AESCCM128 -->|"returns data + time"| API

    AESEAX128 -->|"generate_key() / encrypt()"| ECC
    AESEAX128 -->|"load_image() / to_array"| IO
    AESEAX128 -->|"encrypt_bytes"| CryptoLib
    AESEAX128 -->|"record_time()"| Timer
    AESEAX128 -->|"returns data + time"| API

    ChaCha20 -->|"generate_key() / encrypt()"| ECC
    ChaCha20 -->|"load_image() / to_array"| IO
    ChaCha20 -->|"encrypt_bytes"| CryptoLib
    ChaCha20 -->|"record_time()"| Timer
    ChaCha20 -->|"returns data + time"| API

    Salsa20 -->|"generate_key() / encrypt()"| ECC
    Salsa20 -->|"load_image() / to_array"| IO
    Salsa20 -->|"encrypt_bytes"| CryptoLib
    Salsa20 -->|"record_time()"| Timer
    Salsa20 -->|"returns data + time"| API

    API -->|"display_images() (optional)"| Viz
    Viz -->|"uses data"| IO
    Viz -->|"plots"| Matplotlib

    IO -->|"reads/writes"| OpenCV
    IO -->|"arrays"| NumPy
    CryptoLib -->|"primitives"| ECC
    CryptoLib -->|"primitives"| Timer

    %% Click Events
    click API "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/main.py"
    click AESGCM128 "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/aes_gcm_128.py"
    click AESGCM256 "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/aes_gcm_256.py"
    click AESCCM128 "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/aes_ccm_128.py"
    click AESEAX128 "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/aes_eax_128.py"
    click ChaCha20 "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/chacha20_poly1305.py"
    click Salsa20 "https://github.com/nidhi-bhatt/imagecrypto/blob/main/src/imagecrypto/salsa20.py"
    click pyproject "https://github.com/nidhi-bhatt/imagecrypto/blob/main/pyproject.toml"
    click README "https://github.com/nidhi-bhatt/imagecrypto/blob/main/README.md"

    %% Styles
    classDef user fill:#b6e6bd,stroke:#2d5f2d,color:#000;
    classDef internal fill:#cdeffd,stroke:#036bfc,color:#000;
    classDef utility fill:#fff2b2,stroke:#c79e00,color:#000;
    classDef external fill:#e0e0e0,stroke:#999,color:#000;
```
