# cranish07/research-project architecture

> Architecture diagram of the GitHub repository cranish07/research-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cranish07/research-project
- Repository: https://github.com/cranish07/research-project

## Overview

This Go application provides a web interface and REST API for priority-aware secret sharing. The principal flow accepts a text or file secret, encrypts it and adds a SHA-256 integrity check, generates BNB shares subject to threshold and mandatory-share constraints, and hides shares in PNG images for download. Reconstruction extracts uploaded shares, applies the access constraints, and recovers the encrypted message. The graph separates API orchestration, cryptography, sharing, steganography, and the browser UI. Source excerpts show only parts of the handlers and steganography functions, so uncertain links are omitted.

Main entry points: [`main.go`](https://github.com/cranish07/research-project/blob/main/main.go) (HTTP server and handlers), [`static/index.html`](https://github.com/cranish07/research-project/blob/main/static/index.html) (Browser UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Web API"]
  node_server["HTTP server and handlers<br/>[main.go]"]
  node_share_store[("Generated share files<br/>[main.go]")]
  node_uploads[("Uploaded files<br/>[main.go]")]
  node_download["Share download<br/>[main.go]"]
end

subgraph group_crypto["Cryptography"]
  node_crypto_layer["Crypto layer<br/>[main.go]"]
  node_chacha["ChaCha20-Poly1305<br/>[main.go]"]
  node_chaos["Logistic chaos cipher<br/>[main.go]"]
  node_integrity["SHA-256 integrity<br/>[main.go]"]
end

subgraph group_sharing["BNB sharing"]
  node_bnb["BNB share generation<br/>[main.go]"]
  node_reconstruct["BNB reconstruction<br/>[main.go]"]
  node_bit_conversion["Bit conversion<br/>[main.go]"]
end

subgraph group_stego["Image steganography"]
  node_embed["Share image embedding<br/>[main.go]"]
  node_extract["Share image extraction<br/>[main.go]"]
  node_carrier["Carrier PNG<br/>[main.go]"]
end

subgraph group_ui["Web interface"]
  node_browser["Browser UI<br/>[index.html]"]
end

node_user(("User"))

node_user -->|"uses"| node_browser
node_browser -.->|"sends requests"| node_server
node_server -.->|"builds or recovers"| node_crypto_layer
node_crypto_layer -.->|"encrypts or decrypts"| node_chacha
node_crypto_layer -.->|"selects cipher"| node_chaos
node_crypto_layer -->|"hashes and checks"| node_integrity
node_server -.->|"generates shares"| node_bnb
node_bnb -->|"uses"| node_bit_conversion
node_server -.->|"embeds shares"| node_embed
node_embed -->|"reads image"| node_carrier
node_embed -.->|"writes images"| node_share_store
node_server -->|"saves uploads"| node_uploads
node_server -.->|"extracts shares"| node_extract
node_extract -.->|"provides shares"| node_reconstruct
node_server -.->|"recovers message"| node_crypto_layer
node_server -->|"serves files"| node_download
node_download -.->|"reads images"| node_share_store

click node_server "https://github.com/cranish07/research-project/blob/main/main.go"
click node_crypto_layer "https://github.com/cranish07/research-project/blob/main/main.go"
click node_chacha "https://github.com/cranish07/research-project/blob/main/main.go"
click node_chaos "https://github.com/cranish07/research-project/blob/main/main.go"
click node_integrity "https://github.com/cranish07/research-project/blob/main/main.go"
click node_bnb "https://github.com/cranish07/research-project/blob/main/main.go"
click node_reconstruct "https://github.com/cranish07/research-project/blob/main/main.go"
click node_bit_conversion "https://github.com/cranish07/research-project/blob/main/main.go"
click node_embed "https://github.com/cranish07/research-project/blob/main/main.go"
click node_extract "https://github.com/cranish07/research-project/blob/main/main.go"
click node_share_store "https://github.com/cranish07/research-project/blob/main/main.go"
click node_uploads "https://github.com/cranish07/research-project/blob/main/main.go"
click node_browser "https://github.com/cranish07/research-project/blob/main/static/index.html"
click node_download "https://github.com/cranish07/research-project/blob/main/main.go"
click node_carrier "https://github.com/cranish07/research-project/blob/main/main.go"

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_server,node_share_store,node_uploads,node_download,node_user toneBlue
class node_crypto_layer,node_chacha,node_chaos,node_integrity toneAmber
class node_bnb,node_reconstruct,node_bit_conversion toneMint
class node_embed,node_extract,node_carrier toneRose
class node_browser toneIndigo
```

## Components

### Web API

- [HTTP server and handlers](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Generated share files](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Uploaded files](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Share download](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`

### Cryptography

- [Crypto layer](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [ChaCha20-Poly1305](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Logistic chaos cipher](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [SHA-256 integrity](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`

### BNB sharing

- [BNB share generation](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [BNB reconstruction](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Bit conversion](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`

### Image steganography

- [Share image embedding](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Share image extraction](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`
- [Carrier PNG](https://github.com/cranish07/research-project/blob/main/main.go): `main.go`

### Web interface

- [Browser UI](https://github.com/cranish07/research-project/blob/main/static/index.html): `static/index.html`

### Other components

- **User**

## Connections

- User → Browser UI: uses (evidence: `README.md`)
- Browser UI → HTTP server and handlers: sends requests
- HTTP server and handlers → Crypto layer: builds or recovers (evidence: `main.go`)
- Crypto layer → ChaCha20-Poly1305: encrypts or decrypts (evidence: `main.go`)
- Crypto layer → Logistic chaos cipher: selects cipher (evidence: `main.go`)
- Crypto layer → SHA-256 integrity: hashes and checks (evidence: `main.go`)
- HTTP server and handlers → BNB share generation: generates shares (evidence: `main.go`)
- BNB share generation → Bit conversion: uses (evidence: `main.go`)
- HTTP server and handlers → Share image embedding: embeds shares (evidence: `main.go`)
- Share image embedding → Carrier PNG: reads image (evidence: `main.go`)
- Share image embedding → Generated share files: writes images (evidence: `main.go`)
- HTTP server and handlers → Uploaded files: saves uploads (evidence: `main.go`)
- HTTP server and handlers → Share image extraction: extracts shares (evidence: `main.go`)
- Share image extraction → BNB reconstruction: provides shares (evidence: `main.go`)
- HTTP server and handlers → Crypto layer: recovers message (evidence: `main.go`)
- HTTP server and handlers → Share download: serves files (evidence: `main.go`)
- Share download → Generated share files: reads images (evidence: `main.go`)
