# adityasinha-1988/cse2221-cryptography architecture

> Architecture diagram of the GitHub repository adityasinha-1988/cse2221-cryptography, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityasinha-1988/cse2221-cryptography
- Repository: https://github.com/adityasinha-1988/cse2221-cryptography

## Overview

This repository is a **static, client-side educational web portal** (GitHub Pages) for experimenting with **classical cryptography**. There is **no backend/service layer** and (based on the tree) no explicit build system—just HTML pages that run **JavaScript in the browser**.

So the “system” you’re diagramming is primarily:
- **Browser UI + JS cipher logic**
- Navigation between module pages
- Any client-side-only data flows (plaintext → algorithm → ciphertext; optional analysis)

##### File tree analysis (what components exist)
Top-level files are individual modules/pages:
- `index.html` — the **Dashboard / main menu**
- `Vigenere.html` — Vigenère cipher module
- `Hill.html` — Hill cipher module
- `Play.html` — Playfair cipher module
- `tranpost_railfence.html` — Rail Fence (transposition) module
- `Attacks.html` — Cryptanalysis / attacks (frequency analysis, brute force, etc.)
- `Randomness.html` — randomness-related lab page (likely demonstrating randomness tests or key/material generation concepts)

Notably absent (in the provided tree):
- Separate `/js`, `/css`, `/assets` folders. This implies the JS/CSS might be **inline** in each HTML file or loaded from CDNs.
- Any server code, DB, API routes, authentication, storage.

##### README signals (architecture + runtime model)
README confirms:
- **HTML/CSS/JS (ES6)** only
- “single-page portal” in the sense of a dashboard hub, but the tree indicates it’s really a **multi-page static site** with a consistent navigation pattern (“Back to Dashboard”).
- Modules are interactive cipher demos + cryptanalysis tools.

##### Component (per page): UI Controls, Validation, Algorithm Core, Visualization/Output

- `Hill.html` (matrix operations / modular inverse)
- `Attacks.html` (analysis pipelines)

That yields maximum detail without overthinking, and it captures the essential architecture of this specific project.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% ============== Actors / Runtime ==============
  U["Student / User"]:::actor
  B["Web Browser<br/>(HTML5 + CSS3 + JavaScript ES6)<br/>Client-side execution"]:::runtime

  U -->|"uses"| B

  %% ============== Hosting / Delivery ==============
  subgraph "Hosting / Delivery"
    GH["GitHub Pages<br/>(Static hosting)"]:::hosting
  end

  B -->|"GETstaticHTML/CSS/JS"| GH

  %% ============== External Assets (Optional) ==============
  subgraph "External Assets (Optional)"
    FA["FontAwesome CDN<br/>(icons)"]:::cdn
    GF["Fonts CDN<br/>(Plus Jakarta Sans)"]:::cdn
  end

  B -.->|"loadicons"| FA
  B -.->|"loadfonts"| GF

  %% ============== In-Browser App ==============
  subgraph "Cryptography Interactive Lab (Static Site)"
    direction TB

    D["Dashboard / Main Menu<br/>(index.html)"]:::page

    subgraph "Cipher & Analysis Modules (One page per module)"
      direction TB

      V["Vigenère Module<br/>(Vigenere.html)"]:::page
      H["Hill Module<br/>(Hill.html)"]:::page
      P["Playfair Module<br/>(Play.html)"]:::page
      R["Rail Fence Module<br/>(tranpost_railfence.html)"]:::page
      A["Cryptanalysis / Attacks Module<br/>(Attacks.html)"]:::page
      RN["Randomness Lab<br/>(Randomness.html)"]:::page
    end
  end

  B -->|"renders"| D
  B -->|"renders"| V
  B -->|"renders"| H
  B -->|"renders"| P
  B -->|"renders"| R
  B -->|"renders"| A
  B -->|"renders"| RN

  %% ============== Navigation (Dashboard Hub) ==============
  D -->|"navigate"| V
  D -->|"navigate"| H
  D -->|"navigate"| P
  D -->|"navigate"| R
  D -->|"navigate"| A
  D -->|"navigate"| RN

  V -->|"backToDashboard"| D
  H -->|"backToDashboard"| D
  P -->|"backToDashboard"| D
  R -->|"backToDashboard"| D
  A -->|"backToDashboard"| D
  RN -->|"backToDashboard"| D

  %% ============== Shared Conceptual Concerns (Client-side, possibly duplicated per page) ==============
  subgraph "Shared UI/UX Concerns (Conceptual, client-side)"
    direction TB
    W["UI Widgets<br/>(text/key inputs, buttons)"]:::ui
    S["Theme / Styling<br/>(dark mode, glassmorphism)"]:::ui
    IV["Educational Visualization Layer"]:::viz
  end

  D -.->|"uses"| W
  D -.->|"uses"| S

  V -.->|"uses"| W
  V -.->|"uses"| S
  V -.->|"uses"| IV

  H -.->|"uses"| W
  H -.->|"uses"| S
  H -.->|"uses"| IV

  P -.->|"uses"| W
  P -.->|"uses"| S
  P -.->|"uses"| IV

  R -.->|"uses"| W
  R -.->|"uses"| S
  R -.->|"uses"| IV

  A -.->|"uses"| W
  A -.->|"uses"| S
  A -.->|"uses"| IV

  RN -.->|"uses"| W
  RN -.->|"uses"| S
  RN -.->|"uses"| IV

  %% ============== Per-Module Component Views (Focused detail for Hill + Attacks) ==============
  subgraph "Hill Module Components (Hill.html)"
    direction TB
    H_UI["UI Controls<br/>(plaintext/ciphertext, key matrix)"]:::ui
    H_VAL["Input Parsing & Validation<br/>(matrix size, mod N, invertibility)"]:::logic
    H_CORE["Algorithm Core<br/>(matrix multiply mod N, inverse for decrypt)"]:::logic
    H_VIZ["Visualization<br/>(matrices, step-by-step ops)"]:::viz
    H_OUT["Output Rendering<br/>(ciphertext/plaintext)"]:::ui

    H_UI -->|"submit"| H_VAL
    H_VAL -->|"validInput"| H_CORE
    H_CORE -->|"results"| H_OUT
    H_CORE -->|"steps"| H_VIZ
  end

  H -->|"contains"| H_UI

  subgraph "Attacks Module Components (Attacks.html)"
    direction TB
    A_UI["UI Controls<br/>(ciphertext input, attack options)"]:::ui
    A_PIPE["Analysis Pipeline<br/>(frequency counts, scoring, ranking)"]:::logic
    A_BRUTE["Brute Force / Search Loops<br/>(candidate keys/plaintexts)"]:::logic
    A_VIZ["Visualization<br/>(tables/charts/metrics)"]:::viz
    A_OUT["Results Rendering<br/>(top candidates, stats)"]:::ui

    A_UI -->|"startAttack"| A_PIPE
    A_PIPE -->|"mayInvoke"| A_BRUTE
    A_PIPE -->|"metrics"| A_VIZ
    A_PIPE -->|"rankedCandidates"| A_OUT
    A_BRUTE -->|"candidates"| A_PIPE
  end

  A -->|"contains"| A_UI

  %% ============== Typical In-Page Data Flow (Generic pattern) ==============
  subgraph "In-Page Data Flow (Client-side computation)"
    direction TB
    IN["Plaintext/Ciphertext + Key"]:::data
    ENC["Transform Functions<br/>(Encrypt/Decrypt/Analyze)"]:::logic
    OUT["Ciphertext/Plaintext + Visual Steps"]:::data

    IN -->|"computeInBrowser"| ENC -->|"render"| OUT
  end

  W -.->|"collects"| IN
  IV -.->|"displays"| OUT

  %% ============== Documentation / Notes ==============
  DOC["Documentation / Architecture Notes<br/>(README.md)"]:::doc
  DOC -.->|"describes"| D
  DOC -.->|"describes"| V
  DOC -.->|"describes"| H
  DOC -.->|"describes"| P
  DOC -.->|"describes"| R
  DOC -.->|"describes"| A
  DOC -.->|"describes"| RN

  NOTE["Note: Educational only<br/>No backend, no database, no auth"]:::note
  NOTE -.->|"appliesTo"| B

  %% ============== Click Events (from component mapping) ==============
  click D "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/index.html"
  click V "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/Vigenere.html"
  click H "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/Hill.html"
  click P "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/Play.html"
  click R "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/tranpost_railfence.html"
  click A "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/Attacks.html"
  click RN "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/Randomness.html"
  click DOC "https://github.com/adityasinha-1988/cse2221-cryptography/blob/main/README.md"

  %% ============== Styles ==============
  classDef actor fill:#6b7280,stroke:#111827,color:#ffffff,stroke-width:1px
  classDef runtime fill:#0ea5e9,stroke:#0b4a6f,color:#ffffff,stroke-width:1px
  classDef hosting fill:#f59e0b,stroke:#92400e,color:#111827,stroke-width:1px
  classDef cdn fill:#fb923c,stroke:#9a3412,color:#111827,stroke-width:1px
  classDef page fill:#2563eb,stroke:#1e3a8a,color:#ffffff,stroke-width:1px
  classDef ui fill:#60a5fa,stroke:#1e40af,color:#0b1220,stroke-width:1px
  classDef logic fill:#22c55e,stroke:#14532d,color:#052e16,stroke-width:1px
  classDef viz fill:#a78bfa,stroke:#5b21b6,color:#1f1147,stroke-width:1px
  classDef data fill:#e5e7eb,stroke:#374151,color:#111827,stroke-width:1px
  classDef doc fill:#f472b6,stroke:#9d174d,color:#111827,stroke-width:1px
  classDef note fill:#fde68a,stroke:#b45309,color:#111827,stroke-width:1px
```
