# hibi-10000/hashcalculator architecture

> Architecture diagram of the GitHub repository hibi-10000/hashcalculator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hibi-10000/hashcalculator
- Repository: https://github.com/hibi-10000/hashcalculator

## Overview

##### Main Components
- UI/Presentation Layer: Represented by the “Hash.Wpf” project. This component contains all the XAML files (e.g., MainWindow, AboutWindow) and related code-behind. It manages user interactions, such as launching the hash calculation via the context menu.
- Business/Logic Layer: Represented by the “Hash.Core” project. This contains classes for different hash algorithms (e.g., CRC.cs, MACTripleDES.cs, RIPEMD160Managed.cs, etc.) and manages the core functionality of computing file hashes. Emphasize that the UI layer calls into this library.
- Installer/Deployment: Captured by the “WixInstallerSetup” project. This handles packaging and installation details, including UI elements for the installer, configuration files, and localized resources.
- Test Suite: The “tests” directory (particularly “tests/Hash.Core.Tests”) is used for unit testing the hash calculations, ensuring reliability and correctness.
- CI/CD Integration: Note the existence of GitHub workflows for build, test, and release which form part of the automated build and deployment pipeline.
- External Dependencies: These include the .NET Desktop Runtime and Windows (as the target OS and environment), as well as any third-party libraries the project might use (for example, for specialized hash functions when provided by external utilities).

##### Relationships and Data Flow
- The user interacts with the application through the WPF-based UI.
- The UI component forwards user commands (e.g., file selection and algorithm choice) to the core library for processing.
- The “Hash.Core” library processes the file (perhaps reading it and determining the hash based on the chosen algorithm) and returns the calculated hash.
- After computation, the UI displays the results.
- Parallel to this, the test suite interacts with the “Hash.Core” library to verify the integrity and correctness of the hash algorithms.
- The CI/CD pipelines (GitHub workflows) automatically build the projects, run the tests, and package the app via the WiX installer for deployment.

##### Architectural Patterns and Principles
- Separation of Concerns: The key design principle here is splitting the UI from the core logic, ensuring that the hash calculation code is independent and testable.
- Layered Architecture: At least three layers (presentation via WPF, business logic via the core library, and deployment through the Wix Installer) are clearly delineated.
- Modular Design: The file tree indicates that each functional part (hash algorithms, UI components, installer, and tests) is organized in discrete folders/projects.
- CI/CD Pipeline: The GitHub workflows indicate a modern development approach involving automated testing and deployment.

##### Technologies, Frameworks, and Libraries
- .NET (likely .NET 6 or later, judging by the global.json and project types)
- WPF for the UI layer
- WiX Toolset for creating the installer
- Testing frameworks as evidenced by the “tests” directory
- GitHub Actions for CI/CD workflows

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Layer"
        User["User"]:::user
        UI["UI (WPF)"]:::ui
        Core["Core Hash Library"]:::core
    end

    subgraph "Deployment & Testing"
        Installer["Installer (WiX)"]:::installer
        Tests["Test Suite"]:::test
        Pipeline["CI/CD Pipeline"]:::pipeline
    end

    User -->|"interacts"| UI
    UI -->|"FileHashRequest"| Core
    Core -->|"returnsHash"| UI
    Core -->|"UnitTests"| Tests
    Pipeline -->|"Build_Test"| UI
    Pipeline -->|"Build_Test"| Core
    Pipeline -->|"Package"| Installer
    Pipeline -->|"RunTests"| Tests

    click UI "https://github.com/hibi-10000/hashcalculator/blob/main/src/Hash.Wpf"
    click Core "https://github.com/hibi-10000/hashcalculator/blob/main/src/Hash.Core"
    click Installer "https://github.com/hibi-10000/hashcalculator/tree/main/src/WixInstallerSetup"
    click Tests "https://github.com/hibi-10000/hashcalculator/blob/main/tests/Hash.Core.Tests"
    click Pipeline "https://github.com/hibi-10000/hashcalculator/tree/main/.github/workflows"

    classDef ui fill:#AED6F1,stroke:#21618C,stroke-width:2px;
    classDef core fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef installer fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef test fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef pipeline fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px;
    classDef user fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
```
