DEC! - High-Performance File Encryption Tool
DEC! is a high-performance file encryption tool written in Rust that provides strong security with excellent performance through parallel processing capabilities.
Features
- 🔒 Military-Grade Encryption: AES-256-CTR with Argon2id key derivation
- ⚡ Parallel Processing: Utilizes all CPU cores for maximum performance
- 🛡️ Integrity Protection: HMAC-SHA256 validation to detect tampering
- 📈 Real-time Progress Tracking: Visual progress bar with throughput metrics
- 💾 Memory Efficient: Streams files with configurable buffer sizes
- 🖥️ Cross-platform: Works on Windows, macOS, and Linux
Technical Details
Cryptographic Design
DEC! implements a robust cryptographic architecture:
-
Key Derivation:
- Uses Argon2id (winner of the Password Hashing Competition) with:
- 65,536 KiB memory usage
- 3 iterations
- 4-way parallelism
- HKDF-SHA256 for expanding the master key into separate encryption and HMAC keys
- Uses Argon2id (winner of the Password Hashing Competition) with:
-
Encryption:
- AES-256 in CTR mode (no padding required)
- Unique salt (16 bytes) and IV (16 bytes) for each operation
- Authenticated encryption with HMAC-SHA256
-
File Format:
[Magic Number][Version][Salt][IV][Encrypted Data][HMAC]
Parallel Processing Architecture
DEC! achieves remarkable performance through intelligent parallelization:
- Adaptive Threading: Automatically detects CPU core count
- Chunk-based Processing: Splits data into chunks for parallel processing
- CTR Mode Compatibility: Uses stream cipher seeking to maintain cryptographic consistency
- Threshold-based Fallback: Uses single-threaded processing for small files (<16KB) to minimize overhead
Test Environment:
- Device: MacBook Pro (M4 Max)
- Test Command:
cargo test --release --test integration_test -- --nocapture
Performance benchmarks on a 500MB file:
- Encryption: ~320 MB/s
- Decryption: ~325 MB/s
- Utilizes all available CPU cores efficiently
Security Features
- Forward Secrecy: New salt and IV for every operation
- Tamper Detection: HMAC validation prevents modification attacks
- Memory Safety: Written in Rust with zero runtime crashes
- Password Security: Secure password input that doesn't echo to terminal
Installation
Prerequisites
- Rust 1.65 or higher
Building from Source
# Clone the repository
# Build in release mode (recommended for performance)
# The executable will be in target/release/dec
Installing via Cargo
Usage
Basic Commands
# Encrypt a file
# Decrypt a file
# Specify output file name
# Specify password (otherwise prompted)
# Quiet mode (skip overwrite confirmation)
Command Line Options
Operations:
-e, --encrypt Encrypt a file
-d, --decrypt Decrypt a file
Options:
-o, --output Set output file name
-p, --password Set password (not recommended for security)
-q, --quiet Skip overwrite confirmation
Others:
-v, --version Show version information
Examples
# Encrypt a document
# Encrypt with custom output name
# Decrypt with explicit password
# Batch processing (bash script example)
for; do
done
Performance
DEC! is designed for high-performance encryption:
- Buffer Size: 256KB chunks for optimal I/O
- Parallel Threshold: Automatically switches to parallel mode for files >16KB
- Memory Usage: Constant memory footprint regardless of file size
- CPU Utilization: Near 100% usage on all cores during processing
Typical performance on modern hardware:
- Small files (<1MB): Limited by I/O rather than CPU
- Large files (100MB+): Fully utilizes all CPU cores
- Very large files (1GB+): Sustained throughput of hundreds of MB/s
Comparison with Alternatives
| Tool | Algorithm | Parallel | Language | Performance |
|---|---|---|---|---|
| DEC! | AES-256-CTR + Argon2id | ✅ Yes | Rust | Excellent |
| GPG | AES-128/256 | ❌ No | C | Good |
| OpenSSL | Various | ❌ No | C | Fair |
| 7-Zip | AES-256 | ❌ No | C++ | Fair |
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Development Setup
# Run tests
# Run with specific optimizations
# Check code formatting
# Run clippy for code quality checks
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Rust Crypto for excellent cryptographic primitives
- Rayon for seamless parallel processing
- Argon2 for secure key derivation
Support
For issues, feature requests, or questions:
- Check existing issues
- Create a new issue with detailed information
- Include version information and steps to reproduce problems