Password manager using steganography to embed encrypted credentials in images
Project description
StegVault
Secure password manager using steganography to embed encrypted credentials within images
StegVault combines modern cryptography with steganography to create a secure, portable password backup system. Your master password is encrypted using battle-tested algorithms (XChaCha20-Poly1305 + Argon2id) and then hidden within ordinary PNG images using LSB steganography.
Features
- ๐ Strong Encryption: XChaCha20-Poly1305 AEAD with Argon2id KDF
- ๐ผ๏ธ Invisible Storage: LSB steganography with pseudo-random pixel ordering
- ๐ Zero-Knowledge: All operations performed locally, no cloud dependencies
- โ Authenticated: AEAD tag ensures data integrity
- ๐งช Well-Tested: 145 unit tests with 87% overall coverage (all passing)
- โฑ๏ธ User-Friendly: Progress indicators for long operations
- ๐ Easy to Use: Simple CLI interface
Quick Start
Installation
# Install from PyPI (recommended)
pip install stegvault
# Or install from source
git clone https://github.com/kalashnikxvxiii-collab/stegvault.git
cd stegvault
pip install -e .
Usage
1. Check Image Capacity
stegvault check -i myimage.png
Output:
Image: myimage.png
Format: PNG
Mode: RGB
Size: 500x500 pixels
Capacity: 93750 bytes (91.55 KB)
Max password size: ~93686 bytes (93686 characters)
โ Image has sufficient capacity for password storage.
2. Create Backup
stegvault backup -i cover.png -o backup.png
You'll be prompted for:
- Master password (the password to encrypt and store)
- Encryption passphrase (keep this secret!)
3. Restore Password
stegvault restore -i backup.png
You'll be prompted for your encryption passphrase, then your password is displayed.
How It Works
Architecture Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ StegVault Workflow โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
BACKUP CREATION PASSWORD RECOVERY
โ โ
1. User Input 1. Load Stego Image
โข Master Password โข backup.png
โข Passphrase โข Enter Passphrase
โข Cover Image
2. Extract Payload
2. Encryption โข LSB Extraction
โข Generate Salt (16B) โข Pseudo-random Order
โข Derive Key (Argon2id) โข Parse Binary Format
โข Encrypt (XChaCha20)
3. Decryption
3. Payload Format โข Verify AEAD Tag
โข Magic: "SPW1" โข Derive Key (Argon2id)
โข Salt + Nonce โข Decrypt Ciphertext
โข Ciphertext + Tag
4. Recover Password
4. LSB Embedding โข Display/Save Password
โข Pseudo-random Pixels
โข Modify LSB of R,G,B
โข Save Stego Image
5. Output: backup.png
Cryptographic Stack
| Component | Algorithm | Parameters |
|---|---|---|
| AEAD Cipher | XChaCha20-Poly1305 | 256-bit key, 192-bit nonce |
| KDF | Argon2id | 3 iterations, 64MB memory, 4 threads |
| Salt | CSPRNG | 128 bits (16 bytes) |
| Nonce | CSPRNG | 192 bits (24 bytes) |
| Tag | Poly1305 | 128 bits (16 bytes) |
Payload Format
Binary structure embedded in images:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Offset โ Size โ Field โ Description โ
โโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค
โ 0 โ 4B โ Magic Header โ "SPW1" โ
โ 4 โ 16B โ Salt โ For Argon2id โ
โ 20 โ 24B โ Nonce โ For XChaCha20โ
โ 44 โ 4B โ CT Length โ Big-endian โ
โ 48 โ N โ Ciphertext โ Variable โ
โ 48+N โ 16B โ AEAD Tag โ (appended) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Steganography Technique
LSB (Least Significant Bit) Embedding:
- Pseudo-random Pixel Ordering: Seed derived from salt ensures reproducible but unpredictable pixel sequence
- Distributed Embedding: Payload bits spread across R, G, B channels
- Minimal Visual Impact: Only LSB modified (imperceptible to human eye)
# Simplified example
seed = int.from_bytes(salt[:4], 'big')
pixels = shuffle_pixels(image, seed) # Pseudo-random order
for pixel in pixels:
for channel in [R, G, B]:
channel_value = (channel_value & 0xFE) | payload_bit
Security Considerations
โ Strong Security Features
- Modern Cryptography: XChaCha20-Poly1305 is a modern AEAD cipher resistant to various attacks
- Strong KDF: Argon2id winner of Password Hashing Competition, resistant to GPU/ASIC attacks
- Authenticated Encryption: Poly1305 MAC ensures integrity; tampering detected automatically
- Detection Resistance: Pseudo-random bit placement resists basic steganographic analysis
- No Key Reuse: Fresh nonce generated for each encryption
โ ๏ธ Limitations & Warnings
- Not Invisible: Advanced steganalysis may detect embedded data
- No Deniability: Payload has identifiable magic header
- JPEG Lossy: Recompressing JPEG images destroys payload (use PNG)
- Both Required: Losing either image OR passphrase = permanent data loss
- Offline Attacks: Attacker with image can attempt brute-force (mitigated by Argon2id)
๐ Best Practices
- Strong Passphrase: Use 16+ character passphrase with mixed case, numbers, symbols
- Multiple Backups: Store copies in different locations
- PNG Format: Always use PNG (lossless) not JPEG (lossy)
- Verify Backups: Test restore process after creating backup
- Secure Storage: Protect image files as you would protect passwords
Development
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=stegvault --cov-report=html
# Run specific module tests
pytest tests/unit/test_crypto.py -v
Code Quality
# Format code
black stegvault tests
# Type checking
mypy stegvault
Project Structure
stegvault/
โโโ stegvault/ # Source code
โ โโโ crypto/ # Cryptography (Argon2id + XChaCha20)
โ โ โโโ __init__.py
โ โ โโโ core.py
โ โโโ stego/ # Steganography (PNG LSB)
โ โ โโโ __init__.py
โ โ โโโ png_lsb.py
โ โโโ utils/ # Payload format handling
โ โ โโโ __init__.py
โ โ โโโ payload.py
โ โโโ __init__.py
โ โโโ cli.py # Command-line interface
โโโ tests/ # Test suite
โ โโโ unit/
โ โ โโโ test_crypto.py # 26 tests
โ โ โโโ test_payload.py # 22 tests
โ โ โโโ test_stego.py # 15 tests
โ โโโ __init__.py
โโโ docs/ # Documentation
โโโ examples/ # Example images
โโโ .gitignore
โโโ CHANGELOG.md
โโโ CONTRIBUTING.md
โโโ LICENSE # MIT License
โโโ README.md # This file
โโโ ROADMAP.md
โโโ pyproject.toml
โโโ requirements.txt
Roadmap
See ROADMAP.md for planned features and development timeline.
Coming Soon
- GUI application (Electron or Qt)
- JPEG DCT steganography (more robust)
- Multiple password vault support
- Image capacity auto-check
- Compression for large passwords
- Optional cloud storage integration
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
Quick Contribution Guide
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Make changes with tests
- Commit (
git commit -m 'feat: add amazing feature') - Push (
git push origin feature/amazing-feature) - Open Pull Request
License
This project is licensed under the MIT License - see LICENSE file for details.
Disclaimer
StegVault is provided "as-is" for educational and personal use. The authors are not responsible for any data loss or security breaches. Always maintain multiple backups of critical passwords.
Security Notice: While StegVault uses strong cryptography, no system is perfect. This tool is best used as a supplementary backup method alongside traditional password managers.
Acknowledgments
- PyNaCl - libsodium bindings for Python
- argon2-cffi - Argon2 password hashing
- Pillow - Python Imaging Library
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stegvault-0.3.2.tar.gz.
File metadata
- Download URL: stegvault-0.3.2.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24e3eb4b2fc1e42921f6dff8495e18d2ab16ac811bbeab38e186ec852d486fcd
|
|
| MD5 |
e1452a19c240e48d5fb2ed52f1aedc15
|
|
| BLAKE2b-256 |
a9af1604be24645604d11a3182f293f807092123b719344a511a689728ca6dbc
|
File details
Details for the file stegvault-0.3.2-py3-none-any.whl.
File metadata
- Download URL: stegvault-0.3.2-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c08fddc1f246db469cb29bd3c85c5a390d6d504aa89557d9f1bcbc34f6c4199
|
|
| MD5 |
1082b61fecaa590171a07be22a34fd57
|
|
| BLAKE2b-256 |
b23d21a7a8c0df0711f8cb85ffcdb7ed1e1e0d05b0ee93d893837d04d6ceb374
|