Skip to main content

Password manager using steganography to embed encrypted credentials in images

Project description

StegVault

Secure password manager using steganography to embed encrypted credentials within images

Python Version License Tests Coverage

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:

  1. Pseudo-random Pixel Ordering: Seed derived from salt ensures reproducible but unpredictable pixel sequence
  2. Distributed Embedding: Payload bits spread across R, G, B channels
  3. 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

  1. Strong Passphrase: Use 16+ character passphrase with mixed case, numbers, symbols
  2. Multiple Backups: Store copies in different locations
  3. PNG Format: Always use PNG (lossless) not JPEG (lossy)
  4. Verify Backups: Test restore process after creating backup
  5. 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

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Make changes with tests
  4. Commit (git commit -m 'feat: add amazing feature')
  5. Push (git push origin feature/amazing-feature)
  6. 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stegvault-0.3.2.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stegvault-0.3.2-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

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

Hashes for stegvault-0.3.2.tar.gz
Algorithm Hash digest
SHA256 24e3eb4b2fc1e42921f6dff8495e18d2ab16ac811bbeab38e186ec852d486fcd
MD5 e1452a19c240e48d5fb2ed52f1aedc15
BLAKE2b-256 a9af1604be24645604d11a3182f293f807092123b719344a511a689728ca6dbc

See more details on using hashes here.

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

Hashes for stegvault-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c08fddc1f246db469cb29bd3c85c5a390d6d504aa89557d9f1bcbc34f6c4199
MD5 1082b61fecaa590171a07be22a34fd57
BLAKE2b-256 b23d21a7a8c0df0711f8cb85ffcdb7ed1e1e0d05b0ee93d893837d04d6ceb374

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page