Slient Layer
A high-performance, compression-resistant steganography library for Rust with support for images and audio files.
🔗 Navigation
- Features
- Installation
- Quick Start
- How It Works
- FFI Examples
- Performance
- Compression Resistance Tests
- Future Features
- Contributing
Features
- 🖼️ Image Steganography: Hide data in PNG/JPEG images using DCT-based embedding
- 🎵 Audio Steganography: Hide data in WAV files using spread spectrum techniques
- 🔒 Compression Resistant: Data survives JPEG compression and lossy audio encoding
- 🔐 Encryption: Optional AES-GCM encryption for embedded data
- 🛠️ CLI Tool: Easy-to-use command-line interface
- 🌐 FFI Support: C-compatible API for use in other languages (Python, JavaScript, etc.)
- ⚡ Fast: Optimized implementation with benchmarks
- ✅ Well-Tested: Comprehensive test suite with >90% coverage
Installation
As a Library
Add this to your Cargo.toml:
[]
= "0.1.0"
As a CLI Tool
Quick Start
Library Usage
Image Steganography
use ;
use Path;
Audio Steganography
use ;
use Path;
Advanced Usage with Options
use ;
CLI Usage
Embed Data
# Embed a text message in an image
# Embed a file in an image
# Embed in audio
Extract Data
# Extract and print as text
# Extract to file
# Extract from audio
Check Capacity
# Check how much data can be hidden
# Output: Capacity of image.png: 15420 bytes (15 KB)
Verify Embedded Data
# Check if file contains hidden data
# Output: ✓ File contains embedded data
How It Works
Image Steganography (DCT-Based)
Slient Layer uses Discrete Cosine Transform (DCT) for image steganography, the same technique used in JPEG compression. This makes the hidden data resistant to JPEG compression:
- Block Division: Image is split into 8×8 pixel blocks
- DCT Transform: Each block is transformed to frequency domain
- Mid-Frequency Embedding: Data is embedded in middle-frequency coefficients (less affected by compression)
- Quantization Index Modulation (QIM): Robust embedding technique that survives lossy compression
- IDCT Transform: Blocks are transformed back to spatial domain
Key Benefits:
- Survives JPEG compression (quality 75+) with <5% data loss
- Imperceptible visual changes
- Large capacity (typically 10-20% of image size)
Audio Steganography (Spread Spectrum)
For audio files, Slient Layer uses Spread Spectrum techniques:
- Frame Processing: Audio is divided into overlapping frames
- FFT Transform: Each frame is transformed to frequency domain
- Pseudo-Random Spreading: Data is spread across multiple frequency bands using PN sequences
- Magnitude Modulation: Frequency magnitudes are slightly modified
- IFFT & Overlap-Add: Frames are transformed back and combined
Key Benefits:
- Resistant to MP3 encoding (128 kbps+)
- Inaudible to human ear
- Robust against noise and filtering
FFI (Foreign Function Interface)
Slient Layer can be used from other programming languages through its C-compatible FFI.
C Example
// Function declarations
extern int ;
extern int ;
extern void ;
int
Python Example (using ctypes)
# Load library
=
# Define function signatures
=
=
=
=
=
# Embed
= b
=
# Extract
=
=
=
=
Performance
Benchmarks on an Intel i7-9750H @ 2.60GHz:
| Operation | Image (512×512) | Audio (2 sec @ 44.1kHz) |
|---|---|---|
| Embed | ~45 ms | ~120 ms |
| Extract | ~40 ms | ~110 ms |
| Capacity | ~15 KB | ~5 KB |
Run benchmarks yourself:
Compression Resistance Tests
The library has been tested with:
- JPEG Compression: Quality 75-95 → <3% data loss
- JPEG Compression: Quality 50-75 → <5% data loss
- MP3 Encoding: 128 kbps+ → <5% data loss
- PNG Optimization: 100% data retention
Future Features (Roadmap)
- Video steganography (MP4, AVI)
- Additional embedding algorithms (LSB-matching, F5)
- Reed-Solomon error correction
- Multi-file embedding
- GUI application
- WASM support for browser usage
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.