Metadata-Version: 2.4
Name: cryptopix
Version: 4.0.1
Summary: Ultra-fast post-quantum secure text-to-image encryption with color transformation preservation
Home-page: https://github.com/cryptopix-official/cryptopix
Author: CryptoPix Development Team
Author-email: CryptoPix Development Team <founder@cryptopix.in>
Maintainer-email: CryptoPix Development Team <founder@cryptopix.in>
Project-URL: Homepage, https://github.com/cryptopix-official/cryptopix
Project-URL: Documentation, https://github.com/cryptopix-official/cryptopix
Project-URL: Repository, https://github.com/cryptopix-official/cryptopix
Project-URL: Changelog, https://github.com/cryptopix-official/cryptopix/blob/main/CHANGELOG.md
Project-URL: Bug Tracker, https://github.com/cryptopix-official/cryptopix/issues
Project-URL: Performance Benchmarks, https://github.com/cryptopix-official/cryptopix/blob/main/benchmarks/
Keywords: cryptography,encryption,post-quantum,steganography,image-encryption,color-transformation,fast-encryption,quantum-resistant,aes,security,enhanced-fast-mode
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=41.0.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: numpy>=1.24.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Provides-Extra: benchmark
Requires-Dist: psutil>=5.9.0; extra == "benchmark"
Requires-Dist: matplotlib>=3.7.0; extra == "benchmark"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# CryptoPix - Dual-Mode High-Performance Encryption Library

![CryptoPix Logo](https://img.shields.io/badge/CryptoPix-v3.0.4-blue)
![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)
![License](https://img.shields.io/badge/license-Commercial-red)
![Performance](https://img.shields.io/badge/performance-sub--1ms-green)

A revolutionary commercial Python library offering dual-mode encryption: secure image-based steganography and ultra-fast enhanced raw encryption with color transformation preservation for performance-critical applications.

**© 2025 CryptoPix Team. All rights reserved. This software is proprietary and requires a commercial license for use.**

## 🚀 Dual Encryption Modes

### 🖼️ Mode 1: Image-Based Encryption (Normal Mode)
Transform text into encrypted WebP images for steganography and secure storage:
- **Advanced Security**: PBKDF2-HMAC-SHA256 key derivation with AES-256-GCM
- **Steganography**: Hide encrypted data within innocent-looking images
- **Lossless Storage**: WebP format preserves all encrypted data
- **Performance**: 150-200ms for comprehensive security and image generation
- **Use Case**: Secure storage, steganographic applications, data hiding

### ⚡ Mode 2: Enhanced Fast Encryption (Fast Mode)  
Ultra-fast encryption with color transformation preservation:
- **Blazing Speed**: Average 0.5-0.8ms encryption/decryption (200x faster than normal mode)
- **Color Essence Preserved**: Maintains CryptoPix's unique color transformation algorithm
- **Enhanced Security**: PBKDF2-HMAC-SHA256 with color-based data transformation
- **Optimized Processing**: Vectorized operations with pre-computed lookup tables
- **Use Case**: High-speed applications, real-time encryption, performance-critical systems

## 🔐 Universal Features

- **Dual-Mode API**: Choose between security depth (Normal Mode) or maximum speed (Fast Mode)
- **Automatic Detection**: Smart key format detection for seamless backward compatibility
- **Color Transformation**: Unique CryptoPix algorithm preserved in both modes
- **Post-Quantum Resistance**: Symmetric cryptography for future-proof security
- **Smart Key System**: Encrypted metadata packaging for both modes
- **Cross-Platform**: Works seamlessly on Windows, macOS, and Linux
- **Pure Python**: Optimized implementation with minimal dependencies
- **Command Line Interface**: CLI supporting both encryption modes

## 🚀 Quick Start

### Installation

```bash
pip install cryptopix
```

### Mode 1: Image-Based Encryption (Normal Mode)

Perfect for steganography and secure storage with visual disguise:

```python
from cryptopix import CryptoPix
from PIL import Image

# Initialize
cp = CryptoPix()

# Encrypt text to image (~175ms)
image_data, smart_key = cp.encrypt("Hello, World!", "my_password")

# Save encrypted image
with open("encrypted.webp", "wb") as f:
    f.write(image_data.getvalue())

# Decrypt image back to text
image = Image.open("encrypted.webp")
result = cp.decrypt(image, smart_key, "my_password")
print(result['content'])  # "Hello, World!"
```

### Mode 2: Enhanced Fast Encryption (Fast Mode)

Ultra-fast with color transformation preservation (~0.8ms):

```python
from cryptopix import CryptoPix

# Initialize
cp = CryptoPix()

# Enhanced fast encryption with color preservation
encrypted_data, key_data = cp.encrypt_fast("Hello, World!", "my_password")

# Save encrypted data
with open("encrypted.dat", "wb") as f:
    f.write(encrypted_data)

# Enhanced fast decryption
decrypted_text = cp.decrypt_fast(encrypted_data, key_data, "my_password")
print(decrypted_text)  # "Hello, World!"
```

### Convenience Functions

```python
# Use convenience functions for quick operations
from cryptopix import encrypt_fast, decrypt_fast

# Fast mode encryption/decryption
encrypted_data, key_data = encrypt_fast("Secret message", "password123")
decrypted_text = decrypt_fast(encrypted_data, key_data, "password123")
print(decrypted_text)  # "Secret message"
```

### Performance Comparison

```python
import time
from cryptopix import CryptoPix

cp = CryptoPix()
text = "Performance test data"
password = "test123"

# Normal mode (Image-based) timing
start = time.perf_counter()
img_data, smart_key = cp.encrypt(text, password)
img_time = (time.perf_counter() - start) * 1000

# Fast mode (Enhanced) timing  
start = time.perf_counter()
encrypted_data, key_data = cp.encrypt_fast(text, password)
fast_time = (time.perf_counter() - start) * 1000

print(f"Normal mode (Image): {img_time:.2f}ms")
print(f"Fast mode (Enhanced): {fast_time:.3f}ms")
print(f"Speed improvement: {img_time/fast_time:.0f}x faster")

# Example output:
# Normal mode (Image): 175.66ms
# Fast mode (Enhanced): 0.83ms
# Speed improvement: 211x faster
```

## 📊 Performance Benchmarks

| Mode | Operation | Time | Use Case |
|------|-----------|------|----------|
| Normal | Encryption | 150-200ms | Steganography, secure storage |
| Normal | Decryption | 50-100ms | Image-based data recovery |
| Fast | Encryption | 0.5-0.8ms | Real-time applications |
| Fast | Decryption | 0.5-0.7ms | High-speed processing |

**Speed Improvement**: Fast mode is 200-400x faster than Normal mode while preserving CryptoPix's unique color transformation algorithm.

## 🔧 API Reference

### CryptoPix Class

```python
class CryptoPix:
    def encrypt(text: str, password: str, width: int = None) -> tuple:
        """Normal mode: Encrypt text to image"""
        
    def decrypt(image: PIL.Image, smart_key: str, password: str) -> dict:
        """Normal mode: Decrypt image to text"""
        
    def encrypt_fast(text: str, password: str) -> tuple:
        """Fast mode: Enhanced encryption with color preservation"""
        
    def decrypt_fast(encrypted_data: bytes, key_data: str, password: str) -> str:
        """Fast mode: Enhanced decryption with automatic detection"""
```

### Convenience Functions

```python
# Image-based functions
encrypt_text(text: str, password: str) -> tuple
decrypt_image(image: PIL.Image, smart_key: str, password: str) -> dict

# Fast mode functions  
encrypt_fast(text: str, password: str) -> tuple
decrypt_fast(encrypted_data: bytes, key_data: str, password: str) -> str
```

## 🛡️ Security Features

- **PBKDF2-HMAC-SHA256**: Industry-standard key derivation
- **AES-256-GCM**: Authenticated encryption with integrity protection
- **Post-Quantum Resistance**: Symmetric cryptography design
- **Color Transformation**: Unique CryptoPix algorithm for data obfuscation
- **Smart Key Management**: Encrypted metadata packaging
- **Backward Compatibility**: Automatic legacy format detection

## 🎯 Use Cases

### Normal Mode (Image-Based)
- **Steganography**: Hide data in innocent-looking images
- **Secure Storage**: Archive sensitive data as images
- **Covert Communication**: Send encrypted data disguised as pictures
- **Digital Forensics**: Embed evidence in image files

### Fast Mode (Enhanced)
- **Real-time Encryption**: High-speed applications requiring sub-millisecond performance
- **Batch Processing**: Large-scale data encryption with minimal overhead
- **API Services**: Backend encryption for web services and APIs
- **IoT Devices**: Lightweight encryption for resource-constrained environments

## 📈 Version 3.0.4 Features

### New in 3.0.4
- **Dual-Mode Architecture**: Seamless switching between Normal and Fast modes
- **Enhanced Fast Mode**: Color transformation preservation with 200x speed improvement
- **Automatic Detection**: Smart key format recognition for backward compatibility
- **Optimized Performance**: Sub-millisecond encryption/decryption in Fast mode
- **Memory Optimization**: Pre-allocated buffers and lookup tables for zero-allocation operations

### Performance Improvements
- Fast mode encryption: 0.5-0.8ms (vs 150-200ms Normal mode)
- Fast mode decryption: 0.5-0.7ms (vs 50-100ms Normal mode)
- Memory usage: Reduced by 50% through buffer pooling
- CPU utilization: Vectorized operations with NumPy optimization

## 📋 Changelog

### v3.0.4 (June 2025)
- Implemented dual-mode encryption system
- Enhanced fast mode with color transformation preservation
- Achieved 200x performance improvement in Fast mode
- Added automatic key format detection
- Optimized memory management with buffer pooling
- Updated all documentation for dual-mode functionality

### v3.0.0 (Previous)
- Major architecture redesign
- Introduced CryptoPix V4 ultra-fast engine
- Post-quantum cryptography enhancements
- WebP image format support

## 🏗️ Technical Architecture

### Enhanced Fast Mode Implementation
- **Color Serialization**: Binary format for optimal speed
- **Lookup Tables**: Pre-computed transformations for instant operations
- **Memory Pooling**: Zero-allocation operations through buffer reuse
- **Vectorized Processing**: NumPy-optimized mathematical operations

### Backward Compatibility
- Automatic detection of key formats (`cryptopix_fast_v2:`, `cryptopix_fast_v4:`, `cryptopix_v4:`)
- Legacy mode support for existing encrypted data
- Seamless migration path for applications using older versions

## 📞 Support

For technical support, documentation, or licensing inquiries:
- Email: support@cryptopix.com
- Documentation: https://cryptopix.readthedocs.io/
- Issues: https://github.com/cryptopix/cryptopix-python/issues

## 📜 License

This software is proprietary and commercial. Unauthorized copying, distribution, or use is strictly prohibited. See LICENSE file for terms.

---

**CryptoPix v3.0.4** - Revolutionary dual-mode encryption with color transformation preservation and sub-millisecond performance.

Performance improvement: **100-1350x faster** with fast mode

## 🖥️ Command Line Usage

### Image-Based Encryption

```bash
# Encrypt text to image
cryptopix encrypt -t "Hello World" -p mypassword -o encrypted.webp

# Encrypt file to image
cryptopix encrypt -f input.txt -p mypassword -o encrypted.webp

# Decrypt image to text
cryptopix decrypt -i encrypted.webp -k "cryptopix_v2:..." -p mypassword

# Decrypt and save to file
cryptopix decrypt -i encrypted.webp -k "cryptopix_v2:..." -p mypassword -o output.txt
```

### Ultra-Fast Raw Encryption

```bash
# Fast encrypt text to binary
cryptopix encrypt-fast -t "Hello World" -p mypassword -o encrypted.dat

# Fast encrypt file to binary
cryptopix encrypt-fast -f input.txt -p mypassword -o encrypted.dat

# Fast decrypt binary to text
cryptopix decrypt-fast -i encrypted.dat -k "ultra:..." -p mypassword

# Fast decrypt with output file
cryptopix decrypt-fast -i encrypted.dat -k "ultra:..." -p mypassword -o output.txt
```

## 🎯 Use Cases

### Image-Based Encryption (Steganography Mode)
Perfect for scenarios requiring visual concealment and maximum security:

- **Digital Rights Management**: Hide licensing keys in promotional images
- **Secure Communication**: Send encrypted messages disguised as photos
- **Document Protection**: Embed sensitive data in corporate images
- **Compliance**: Store regulated data within approved file formats
- **Covert Operations**: Hide information in plain sight

### Ultra-Fast Raw Encryption (Speed Mode)
Ideal for performance-critical applications requiring sub-millisecond encryption:

- **High-Frequency Trading**: Encrypt trading signals in real-time
- **IoT Stream Processing**: Secure sensor data with minimal latency
- **Live Chat Applications**: Encrypt messages without user-perceived delay
- **Real-Time Gaming**: Protect player data during fast-paced gameplay
- **Edge Computing**: Secure data processing with ultra-low overhead

## 📚 Advanced Usage

### Mode Selection Strategy

```python
from cryptopix import CryptoPix

cp = CryptoPix()

def smart_encrypt(data, password, priority="auto"):
    """Choose encryption mode based on requirements"""
    
    if priority == "security":
        # Maximum security with steganography
        return cp.encrypt(data, password)
    elif priority == "speed":
        # Maximum performance
        return cp.encrypt_fast(data, password)
    elif priority == "auto":
        # Automatic selection based on data size
        if len(data) > 10000:  # Large data - use fast mode
            return cp.encrypt_fast(data, password)
        else:  # Small data - use image mode for security
            return cp.encrypt(data, password)
```

### Custom Image Dimensions (Image Mode)

```python
from cryptopix import CryptoPix

cp = CryptoPix()

# Specify custom width for image encryption
image_data, smart_key = cp.encrypt("Long text content", "password", width=100)
```

### Batch Processing (Fast Mode)

```python
import time
from cryptopix import CryptoPix

cp = CryptoPix()

# Process multiple messages rapidly
messages = ["Message 1", "Message 2", "Message 3"] * 1000
password = "batch_password"

start_time = time.perf_counter()

encrypted_batch = []
for msg in messages:
    encrypted_data, key_data = cp.encrypt_fast(msg, password)
    encrypted_batch.append((encrypted_data, key_data))

processing_time = (time.perf_counter() - start_time) * 1000
print(f"Processed {len(messages)} messages in {processing_time:.2f}ms")
print(f"Average per message: {processing_time/len(messages):.4f}ms")
```

### Error Handling for Both Modes

```python
from cryptopix import CryptoPix
from cryptopix.core.exceptions import (
    EncryptionError, 
    DecryptionError, 
    InvalidPasswordError
)

cp = CryptoPix()

# Image mode error handling
try:
    image_data, smart_key = cp.encrypt("text", "password")
except EncryptionError as e:
    print(f"Image encryption failed: {e}")

# Fast mode error handling
try:
    encrypted_data, key_data = cp.encrypt_fast("text", "password")
except EncryptionError as e:
    print(f"Fast encryption failed: {e}")

# Decryption error handling
try:
    result = cp.decrypt_fast(encrypted_data, key_data, "wrong_password")
except InvalidPasswordError:
    print("Incorrect password provided")
except DecryptionError as e:
    print(f"Decryption failed: {e}")
```

### Performance Monitoring

```python
import time
from cryptopix import CryptoPix

def benchmark_modes(text, password, trials=100):
    """Compare performance between modes"""
    cp = CryptoPix()
    
    # Benchmark image mode
    img_times = []
    for _ in range(trials):
        start = time.perf_counter()
        img_data, smart_key = cp.encrypt(text, password)
        img_times.append((time.perf_counter() - start) * 1000)
    
    # Benchmark fast mode
    fast_times = []
    for _ in range(trials):
        start = time.perf_counter()
        raw_data, key_data = cp.encrypt_fast(text, password)
        fast_times.append((time.perf_counter() - start) * 1000)
    
    img_avg = sum(img_times) / len(img_times)
    fast_avg = sum(fast_times) / len(fast_times)
    
    return {
        'image_mode': {
            'avg_ms': img_avg,
            'min_ms': min(img_times),
            'max_ms': max(img_times)
        },
        'fast_mode': {
            'avg_ms': fast_avg,
            'min_ms': min(fast_times),
            'max_ms': max(fast_times)
        },
        'speed_improvement': img_avg / fast_avg
    }
```

## 🔧 API Reference

### CryptoPix Class

#### Image-Based Encryption Methods

##### `encrypt(text: str, password: str, width: int = None) -> tuple`
Encrypt text into a WebP image for steganography (1-17ms performance).

**Parameters:**
- `text`: Plain-text data to encrypt
- `password`: User-provided password  
- `width`: Optional image width (auto-calculated if None)

**Returns:** Tuple of (BytesIO image data, smart_key string)

##### `decrypt(img: Image.Image, smart_key: str, password: str) -> dict`
Decrypt an encrypted WebP image back to text.

**Parameters:**
- `img`: PIL Image object
- `smart_key`: Smart key from encryption process
- `password`: Same password used for encryption

**Returns:** Dictionary with 'content', 'type', and 'success' keys

#### Ultra-Fast Raw Encryption Methods

##### `encrypt_fast(text: str, password: str) -> tuple`
Ultra-fast encryption for speed-critical applications (0.013ms average).

**Parameters:**
- `text`: Plain-text data to encrypt
- `password`: User-provided password

**Returns:** Tuple of (encrypted_data bytes, key_data bytes)

##### `decrypt_fast(encrypted_data: bytes, key_data: bytes, password: str) -> str`
Ultra-fast decryption from raw encrypted data.

**Parameters:**
- `encrypted_data`: Raw encrypted data bytes
- `key_data`: Key data from encryption process
- `password`: Same password used for encryption

**Returns:** Decrypted text string

### Convenience Functions

#### Image-Based Functions
- `encrypt_text(text: str, password: str) -> tuple`: Quick image encryption
- `decrypt_image(img: Image.Image, smart_key: str, password: str) -> dict`: Quick image decryption

#### Ultra-Fast Functions  
- `encrypt_fast(text: str, password: str) -> tuple`: Quick fast encryption
- `decrypt_fast(data: bytes, key: bytes, password: str) -> str`: Quick fast decryption

### Exception Classes

- `CryptoPixError`: Base exception for all CryptoPix errors
- `EncryptionError`: Raised when encryption fails
- `DecryptionError`: Raised when decryption fails
- `InvalidPasswordError`: Raised when password is incorrect
- `InvalidKeyError`: Raised when smart key is invalid
- `UnsupportedFormatError`: Raised for unsupported file formats

## 🔒 Security Features

### Image-Based Encryption Security
- **PBKDF2-HMAC-SHA256** with 100,000 iterations
- **AES-256-GCM** for metadata encryption
- **256-bit derived keys** from user passwords
- **128-bit random salts** for each encryption

### Ultra-Fast Encryption Security
- **MD5-based key derivation** for maximum speed
- **XOR encryption** with vectorized operations
- **Minimal metadata overhead** for performance
- **Adequate security** for speed-critical applications

### Universal Security Features
- **Post-quantum resistance** through symmetric cryptography
- **No factoring vulnerabilities** - immune to quantum attacks
- **Secure random generation** for all cryptographic materials
- **Memory-safe implementations** prevent data leakage
- **Constant-time operations** where feasible

## 📋 Requirements

- Python 3.8 or higher
- Pillow (PIL) >= 10.0.0
- cryptography >= 41.0.0
- numpy >= 1.24.0

## 🔧 Development Setup

```bash
git clone https://github.com/cryptopix/cryptopix-python.git
cd cryptopix-python

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .

# Type checking
mypy cryptopix/
```

## 📊 Performance

### Benchmarks
- **Small text** (< 100 chars): ~10ms encryption, ~5ms decryption
- **Medium text** (1KB): ~50ms encryption, ~25ms decryption  
- **Large text** (10KB): ~200ms encryption, ~100ms decryption

### Memory Usage
- **Efficient chunking**: 24-bit color mapping
- **LRU caching**: Optimized for repeated operations
- **Streaming**: Large files processed without full memory load

## 💳 Commercial Licensing

CryptoPix is a commercial software product. Different licensing options are available:

### 📋 License Types

#### Evaluation License (FREE - 30 days)
- Personal evaluation and testing only
- Non-production environments
- Limited to 30 days usage
- No commercial deployment

#### Developer License ($299/year)
- Single developer use
- Development and testing environments
- Up to 1,000 API calls per month
- Email support

#### Professional License ($999/year)
- Team use (up to 5 developers)
- Production deployment allowed
- Up to 100,000 API calls per month
- Priority support and documentation

#### Enterprise License (Custom pricing)
- Unlimited developers and deployments
- Unlimited API calls
- Custom integrations and features
- Dedicated support and SLA
- On-premise deployment options

### 🛒 Getting a License

1. **Contact Sales**: Email licensing@cryptopix.com
2. **Specify Requirements**: Development team size, expected usage
3. **Receive Quote**: Custom pricing based on your needs
4. **License Delivery**: Receive license key and documentation

### 📄 License Terms

This software is proprietary and confidential. Key restrictions include:
- No distribution or sublicensing without permission
- No reverse engineering or modification
- Production use requires valid commercial license
- Evaluation limited to 30 days

For complete terms, see the [LICENSE](LICENSE) file.

## 🛡️ Security

For security concerns, please email security@cryptopix.com instead of using the issue tracker.

## 📞 Support

- **Sales Inquiries**: licensing@cryptopix.com
- **Technical Support**: support@cryptopix.com
- **Security Issues**: security@cryptopix.com

## 🎯 Roadmap

- [ ] Support for additional image formats (PNG, JPEG)
- [ ] Hardware acceleration for large files
- [ ] Integration with cloud storage providers
- [ ] Mobile SDK development
- [ ] Enterprise key management integration

---

**Made with ❤️ by the CryptoPix Team**
