rafimahesaadyaksa/mahesavault
GitHub: rafimahesaadyaksa/mahesavault
MahesaVault 是一个结合密码学与图像隐写术的 Web 安全教学平台,通过「加密后隐藏」的双层架构实现信息保护并提供质量评估与隐写分析。
Stars: 1 | Forks: 0


## 📌 项目描述
[README.md](https://github.com/user-attachments/files/28848621/README.md)
**MahesaVault** 是一个基于 Web 的统一数据安全平台,它结合了两种安全协议:
| 模块 | 技术 | 功能 |
|-------|--------|--------|
| 🕵️ **隐写术** | Dual-Variant LSB (Sequential + Random) + XOR | 将秘密信息隐藏在 PNG 图像中 |
| 🔒 **密码术** | Classical Cipher + Modern Cipher (AES-256 / RSA) | 对信息进行加密以防被读取 |
### 💡 核心思想:“Double-Lock Architecture”
```
[Pesan Asli]
↓ LAYER 1: Kriptografi
[Ciphertext (terenkripsi AES-256)]
↓ LAYER 2: Steganografi LSB
[Gambar PNG biasa — tidak mencurigakan]
↓ Kirim via WhatsApp / Google Drive
[Penerima: Ekstrak LSB → Dekripsi AES]
[Pesan Asli diterima] ✅
```
即使图像泄露 → 攻击者仍然需要**两把**不同的密钥。
即使加密密钥已知 → 攻击者也必须首先知道隐写术的存在。
## 🎯 主要功能
### 隐写术模块
- ✅ **Sequential LSB**:从像素 (0,0) 开始按顺序嵌入比特
- ✅ **Random LSB**:使用 PRNG + 来自密码的 seed 随机化像素位置
- ✅ **XOR Pre-Encryption**:在嵌入之前对信息进行 XOR 加密(组合模式)
- ✅ **质量指标**:自动计算 PSNR、MSE 和 SSIM
- ✅ **隐写分析直方图**:可视化对比前后的 RGB 情况
- ✅ **容量计算器**:计算每张图像的最大字符容量
- ✅ **Bit-Plane Slicer**:可视化图像的 8 个比特层,用于取证分析
- ✅ **Error Map Generator**:映射发生变化的像素(可视化 MSE)
### 密码术模块
- ✅ **Classical Cipher**(选择 1 种):Caesar / Vigenere / Playfair / Hill / Affine
- ✅ **Modern Cipher**(选择 1 种):AES-256 / RSA / DES / 3DES / Blowfish / ChaCha20
- ✅ **密钥生成器**:自动生成 RSA 密钥对或 AES 密钥
- ✅ **数学分析**:展示 Classical Cipher 与 Modern Cipher 计算的逐步过程
- ✅ **安全性对比**:Classical 与 Modern 的对比表格 + 数学解释
- ✅ **数字签名(附加)**:使用 RSA 的数字签名
### 组合模式(MahesaVault 专属)
- ✅ **Encrypt-then-Hide**:在一个 workflow 中完成 AES/RSA → LSB 隐写
- ✅ **Extract-then-Decrypt**:LSB 提取 → 自动解密
- ✅ **安全报告**:提供完整的多层安全报告,用于学术文档
## 🗂️ 文件夹结构
```
mahesavault/
├── app.py # Entry point Streamlit
├── requirements.txt # Dependencies
├── README.md # File ini
│
├── modules/
│ ├── steganography/
│ │ ├── lsb_sequential.py # LSB Sequential embed/extract
│ │ ├── lsb_random.py # LSB Random (PRNG) embed/extract
│ │ ├── xor_cipher.py # XOR pre-encryption
│ │ ├── quality_metrics.py # PSNR, MSE, SSIM
│ │ ├── steganalysis.py # Histogram + Bit-plane analysis
│ │ └── capacity.py # Capacity calculator
│ │
│ ├── cryptography/
│ │ ├── classical/
│ │ │ ├── caesar.py
│ │ │ ├── vigenere.py
│ │ │ ├── playfair.py
│ │ │ ├── hill.py
│ │ │ └── affine.py
│ │ ├── modern/
│ │ │ ├── aes_cipher.py # AES-256 CBC mode
│ │ │ ├── rsa_cipher.py # RSA 2048-bit
│ │ │ ├── des_cipher.py
│ │ │ └── chacha20.py
│ │ ├── key_generator.py
│ │ ├── digital_signature.py # RSA digital signature
│ │ └── math_visualizer.py # Tampilkan perhitungan step-by-step
│ │
│ └── combined/
│ ├── dual_lock.py # Encrypt-then-Hide workflow
│ └── security_report.py # Generate laporan PDF/text
│
├── ui/
│ ├── home.py # Landing page dengan animasi
│ ├── stego_ui.py # UI modul steganografi
│ ├── crypto_ui.py # UI modul kriptografi
│ ├── combined_ui.py # UI mode dual-lock
│ └── components/
│ ├── metric_card.py # Komponen kartu metrik
│ └── histogram_plot.py # Komponen histogram
│
├── assets/
│ ├── sample_images/ # Contoh gambar cover
│ └── styles/
│ └── custom.css # CSS tambahan untuk Streamlit
```
## 🛠️ 安装与运行
```
# 克隆 / 下载项目
git clone https://github.com/yourusername/mahesavault.git
cd mahesavault
# 创建 virtual environment(可选但推荐)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 运行应用
streamlit run app.py
```
### requirements.txt
```
streamlit>=1.32.0
opencv-python>=4.9.0
numpy>=1.26.0
matplotlib>=3.8.0
scikit-image>=0.22.0
cryptography>=42.0.0
Pillow>=10.2.0
pandas>=2.2.0
reportlab>=4.1.0
```
## 📊 技术对比(用于报告)
### 隐写术:Sequential 与 Random LSB 对比
| 参数 | Sequential LSB | Random LSB |
|-----------|---------------|------------|
| 可见性 | 不可见 | 不可见 |
| PSNR | ~50 dB | ~52 dB |
| 安全性 | 低(无密钥) | 高(需要 seed/key) |
| 修改分布 | 集中在图像开头 | 均匀分布 |
| 抗隐写分析能力 | 弱 | 强 |
### 密码术:Classical 与 Modern 对比
| 参数 | Classical (例如 Vigenere) | Modern (例如 AES-256) |
|-----------|--------------------------|----------------------|
| 密钥空间 | 小 (26^n) | 极大 (2^256) |
| 暴力破解 | 可能 | 不可行 |
| Known-plaintext attack | 脆弱 | 抵抗 |
| 计算 | 简单 / 手动 | 复杂 / 计算机 |
| 工业标准 | 否 | 是 (NIST standard) |
## 👥 团队 / 创建者
## Rafi Mahesa Adyaksa
## 📚 参考
**学术文献与期刊:**
* Cheddad, A., et al. (2010). *Digital Image Steganography: Survey and Analysis of Current Methods*. Signal Processing.
* Cox, I. J., Miller, M. L., Bloom, J. A., Fridrich, J., & Kalker, T. (2007). *Digital Watermarking and Steganography* (2nd ed.). Morgan Kaufmann.
* Schneier, B. (2015). *Applied Cryptography: Protocols, Algorithms, and Source Code in C* (20th Anniversary Edition). John Wiley & Sons.
* Stallings, W. (2020). *Cryptography and Network Security: Principles and Practice* (8th ed.). Pearson.
**技术文档:**
* [Python 3.11 文档](https://docs.python.org/3/)
* [Streamlit 文档](https://docs.streamlit.io/)
* [OpenCV 文档](https://docs.opencv.org/)
* [Python Cryptography 包](https://cryptography.io/en/latest/)
## 📝 许可证
本项目为 2026/2027 春季学期期末考试(UAS)的学术用途而创建。
标签:Kubernetes, 图像隐写, 密码学, 手动系统调用, 逆向工具, 隐写术