- Introduction
- Technical Description
- Technologies Used
- Main Features
- Installation
- Usage
- Possible Improvements
Pixel Crypt Engine is a command-line tool for secure image encryption and decryption. It uses AES-256-CTR encryption combined with smart compression to securely store and transfer image files. The tool provides a user-friendly interface with progress indicators and detailed statistics about the encryption/compression process.
The engine implements several key technical features:
- AES-256 Encryption: Uses CTR mode for secure encryption:
const algorithm = 'aes-256-ctr';
const cipher = crypto.createCipheriv(algorithm, key.padEnd(32).slice(0, 32), iv);- Smart Compression: Implements GZIP compression for files larger than 10KB:
if (compress && imageData.length > MIN_COMPRESS_SIZE) {
processedData = await gzip(imageData);
} else if (compress) {
spinner.info('File too small for effective compression, skipping...');
}- Progress Tracking: Uses Ora for elegant progress display:
const spinner = ora('Starting encryption process...').start();
spinner.text = 'Encrypting data...';-
Node.js:
- ES Modules structure
- Async/await operations
- Buffer handling
-
Core Modules:
cryptofor encryptionzlibfor compressionfsfor file operations
-
NPM Packages:
boxenfor styled boxeschalkfor colored outputorafor spinnersmeowfor CLI parsing
-
Encryption:
- AES-256-CTR encryption
- Random IV generation
- Smart compression (>10KB files)
- Secure key handling
-
User Experience:
- Progress spinners
- Compression statistics
- Size-based compression
- Informative messages
npm install pixel-crypt-engine# Encrypt an image
pixelcrypt -e -i input.jpg -o encrypted.bin -k "your-secret-key"
# Decrypt an image
pixelcrypt -d -i encrypted.bin -o decrypted.jpg -k "your-secret-key"
# Encrypt without compression
pixelcrypt -e -i input.jpg -o encrypted.bin -k "your-secret-key" --no-compress-e, --encrypt: Encrypt an image-d, --decrypt: Decrypt an image-i, --input: Input file path-o, --output: Output file path-k, --key: Secret key-c, --compress: Enable smart compression (default: true, applies to files >10KB)
-
Enhanced Security:
- Multiple encryption algorithms
- Key file support
- Digital signatures
- File integrity checks
-
Better Compression:
- Multiple compression algorithms
- Customizable size thresholds
- Format-specific compression
- Compression level options
-
Advanced Features:
- Batch processing
- Directory encryption
- Metadata preservation
- Password strength checks