|
| 1 | +# 🚀 fastCrypter |
| 2 | + |
| 3 | +**Professional Compression and Encryption Library with Native C/C++ Acceleration** |
| 4 | + |
| 5 | +[](https://python.org) |
| 6 | +[](LICENSE) |
| 7 | +[](https://pypi.org/project/fastCrypter/) |
| 8 | +[](https://pypi.org/project/fastCrypter/) |
| 9 | + |
| 10 | +fastCrypter is a powerful Python library that combines advanced compression and encryption techniques with native C/C++ acceleration for maximum performance. It provides a comprehensive suite of tools for secure data handling, from simple file encryption to complex custom encoding schemes. |
| 11 | + |
| 12 | +## ✨ Key Features |
| 13 | + |
| 14 | +### 🔐 **Advanced Encryption** |
| 15 | +- **Multiple Algorithms**: AES-256-GCM, ChaCha20-Poly1305, RSA |
| 16 | +- **Secure Key Management**: PBKDF2, Argon2, secure random generation |
| 17 | +- **Digital Signatures**: RSA and ECC-based signing |
| 18 | +- **Custom Encoding**: User-defined character sets for obfuscation |
| 19 | + |
| 20 | +### 🗜️ **High-Performance Compression** |
| 21 | +- **Multiple Formats**: ZLIB, LZMA, Brotli, custom RLE |
| 22 | +- **Adaptive Algorithms**: Automatic best-fit selection |
| 23 | +- **Native Acceleration**: C/C++ libraries for critical operations |
| 24 | +- **Memory Efficient**: Streaming support for large files |
| 25 | + |
| 26 | +### ⚡ **Native Performance** |
| 27 | +- **C/C++ Libraries**: Optimized crypto and hash operations |
| 28 | +- **SIMD Instructions**: Vectorized operations where available |
| 29 | +- **Cross-Platform**: Windows (.dll), Linux (.so), macOS (.dylib) |
| 30 | +- **Automatic Fallback**: Pure Python when native libs unavailable |
| 31 | + |
| 32 | +### 🛡️ **Security Features** |
| 33 | +- **Secure Memory**: Protected key storage and cleanup |
| 34 | +- **Entropy Analysis**: Data randomness validation |
| 35 | +- **Side-Channel Protection**: Constant-time operations |
| 36 | +- **Audit Trail**: Comprehensive logging and validation |
| 37 | + |
| 38 | +## 🚀 Quick Start |
| 39 | + |
| 40 | +### Installation |
| 41 | + |
| 42 | +```bash |
| 43 | +# Install from PyPI |
| 44 | +pip install fastCrypter |
| 45 | + |
| 46 | +# Install with development dependencies |
| 47 | +pip install fastCrypter[dev] |
| 48 | + |
| 49 | +# Install with native compilation support |
| 50 | +pip install fastCrypter[native] |
| 51 | +``` |
| 52 | + |
| 53 | +### Basic Usage |
| 54 | + |
| 55 | +```python |
| 56 | +import fastCrypter |
| 57 | + |
| 58 | +# Get the recommended compressor (automatically uses native acceleration if available) |
| 59 | +compressor = fastCrypter.get_recommended_compressor(password="your_secure_password") |
| 60 | + |
| 61 | +# Compress and encrypt data |
| 62 | +data = b"Your sensitive data here" |
| 63 | +encrypted = compressor.compress_and_encrypt(data) |
| 64 | + |
| 65 | +# Decrypt and decompress |
| 66 | +decrypted = compressor.decrypt_and_decompress(encrypted) |
| 67 | +assert data == decrypted |
| 68 | +``` |
| 69 | + |
| 70 | +### Custom Encoding Example |
| 71 | + |
| 72 | +```python |
| 73 | +from fastCrypter import CustomEncoder |
| 74 | + |
| 75 | +# Create custom encoder with your character set |
| 76 | +encoder = CustomEncoder(charset="abcdef98Xvbvii") |
| 77 | + |
| 78 | +# Encode data |
| 79 | +original = b"Hello, World!" |
| 80 | +encoded = encoder.encode(original) |
| 81 | +print(f"Encoded: {encoded}") |
| 82 | + |
| 83 | +# Decode back |
| 84 | +decoded = encoder.decode(encoded) |
| 85 | +assert original == decoded |
| 86 | +``` |
| 87 | + |
| 88 | +### File Encryption |
| 89 | + |
| 90 | +```python |
| 91 | +from fastCrypter import FileEncryptor |
| 92 | + |
| 93 | +# Initialize file encryptor |
| 94 | +encryptor = FileEncryptor(password="your_password") |
| 95 | + |
| 96 | +# Encrypt a file |
| 97 | +encryptor.encrypt_file("document.pdf", "document.pdf.encrypted") |
| 98 | + |
| 99 | +# Decrypt the file |
| 100 | +encryptor.decrypt_file("document.pdf.encrypted", "document_restored.pdf") |
| 101 | +``` |
| 102 | + |
| 103 | +## 🔧 Native Compilation |
| 104 | + |
| 105 | +fastCrypter includes C/C++ libraries for performance-critical operations: |
| 106 | + |
| 107 | +### Automatic Compilation |
| 108 | + |
| 109 | +```bash |
| 110 | +# Build native libraries |
| 111 | +python build_native.py |
| 112 | + |
| 113 | +# Build with specific compiler |
| 114 | +python build_native.py --compiler gcc |
| 115 | + |
| 116 | +# Build optimized release version |
| 117 | +python build_native.py --release |
| 118 | +``` |
| 119 | + |
| 120 | +### Manual Compilation |
| 121 | + |
| 122 | +```bash |
| 123 | +# Using Make (Linux/macOS) |
| 124 | +cd fastCrypter/native |
| 125 | +make all |
| 126 | + |
| 127 | +# Using MinGW (Windows) |
| 128 | +cd fastCrypter/native |
| 129 | +mingw32-make all |
| 130 | +``` |
| 131 | + |
| 132 | +### Performance Benefits |
| 133 | + |
| 134 | +Native libraries provide significant performance improvements: |
| 135 | + |
| 136 | +- **XOR Operations**: 3-5x faster with SIMD instructions |
| 137 | +- **Hash Functions**: 2-3x faster SHA-256 and HMAC |
| 138 | +- **Key Derivation**: 2-4x faster PBKDF2 |
| 139 | +- **Compression**: 1.5-2x faster RLE compression |
| 140 | + |
| 141 | +## 📊 Performance Benchmarks |
| 142 | + |
| 143 | +```python |
| 144 | +# Run comprehensive benchmarks |
| 145 | +results = fastCrypter.benchmark_available_features(data_size=1024*1024) |
| 146 | +print(f"Native acceleration: {results['performance']['native']['available']}") |
| 147 | +print(f"Speedup factor: {results['performance'].get('speedup', 'N/A')}") |
| 148 | +``` |
| 149 | + |
| 150 | +Example results on modern hardware: |
| 151 | +- **Standard Mode**: ~50 MB/s compression + encryption |
| 152 | +- **Enhanced Mode**: ~150 MB/s with native acceleration |
| 153 | +- **Memory Usage**: <100MB for 1GB files (streaming) |
| 154 | + |
| 155 | +## 🔍 Advanced Features |
| 156 | + |
| 157 | +### Enhanced Compressor |
| 158 | + |
| 159 | +```python |
| 160 | +from fastCrypter import EnhancedCompressor |
| 161 | + |
| 162 | +# Create enhanced compressor with native acceleration |
| 163 | +compressor = EnhancedCompressor( |
| 164 | + password="secure_password", |
| 165 | + use_native=True, |
| 166 | + compression_level=6 |
| 167 | +) |
| 168 | + |
| 169 | +# Check if native libraries are available |
| 170 | +if compressor.is_native_available(): |
| 171 | + print("🚀 Native acceleration enabled!") |
| 172 | +``` |
| 173 | + |
| 174 | +### Custom Algorithms |
| 175 | + |
| 176 | +```python |
| 177 | +from fastCrypter.core import Compressor, CompressionAlgorithmType |
| 178 | + |
| 179 | +# Use specific compression algorithm |
| 180 | +compressor = Compressor( |
| 181 | + algorithm=CompressionAlgorithmType.BROTLI, |
| 182 | + level=9 # Maximum compression |
| 183 | +) |
| 184 | +``` |
| 185 | + |
| 186 | +### Secure Key Management |
| 187 | + |
| 188 | +```python |
| 189 | +from fastCrypter import KeyManager |
| 190 | + |
| 191 | +# Generate secure keys |
| 192 | +key_manager = KeyManager() |
| 193 | +master_key = key_manager.generate_key(password="user_password", salt=b"unique_salt") |
| 194 | + |
| 195 | +# Derive multiple keys from master key |
| 196 | +encryption_key = key_manager.derive_key(master_key, b"encryption", 32) |
| 197 | +signing_key = key_manager.derive_key(master_key, b"signing", 32) |
| 198 | +``` |
| 199 | + |
| 200 | +## 🧪 Testing |
| 201 | + |
| 202 | +fastCrypter includes comprehensive tests: |
| 203 | + |
| 204 | +```bash |
| 205 | +# Run all tests |
| 206 | +python -m pytest tests/ -v |
| 207 | + |
| 208 | +# Run with coverage |
| 209 | +python -m pytest tests/ --cov=fastCrypter --cov-report=html |
| 210 | + |
| 211 | +# Run performance tests |
| 212 | +python -m pytest tests/test_performance.py -v |
| 213 | + |
| 214 | +# Run native library tests |
| 215 | +python final_test.py |
| 216 | +``` |
| 217 | + |
| 218 | +## 🔧 Development |
| 219 | + |
| 220 | +### Setting Up Development Environment |
| 221 | + |
| 222 | +```bash |
| 223 | +# Clone repository |
| 224 | +git clone https://github.com/Pymmdrza/fastCrypter.git |
| 225 | +cd fastCrypter |
| 226 | + |
| 227 | +# Install in development mode |
| 228 | +pip install -e .[dev] |
| 229 | + |
| 230 | +# Build native libraries |
| 231 | +python build_native.py |
| 232 | + |
| 233 | +# Run tests |
| 234 | +python -m pytest |
| 235 | +``` |
| 236 | + |
| 237 | +### Code Quality |
| 238 | + |
| 239 | +```bash |
| 240 | +# Format code |
| 241 | +black fastCrypter/ tests/ |
| 242 | + |
| 243 | +# Lint code |
| 244 | +flake8 fastCrypter/ tests/ |
| 245 | + |
| 246 | +# Type checking |
| 247 | +mypy fastCrypter/ |
| 248 | +``` |
| 249 | + |
| 250 | +## 📚 Documentation |
| 251 | + |
| 252 | +- **API Reference**: [ [Document](https://fastcrypter.readthedocs.io) ] |
| 253 | +- **Examples**: See `examples/` directory [Examples](https://github.com/Pymmdrza/fastCrypter/tree/main/examples) |
| 254 | +- **Performance Guide**: [Performance Optimization](docs/performance.md) |
| 255 | + |
| 256 | +## 🤝 Contributing |
| 257 | + |
| 258 | +We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. |
| 259 | + |
| 260 | +### Development Workflow |
| 261 | + |
| 262 | +1. Fork the repository |
| 263 | +2. Create a feature branch |
| 264 | +3. Make your changes |
| 265 | +4. Add tests for new functionality |
| 266 | +5. Ensure all tests pass |
| 267 | +6. Submit a pull request |
| 268 | + |
| 269 | +## 📄 License |
| 270 | + |
| 271 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 272 | + |
| 273 | +## 🙏 Acknowledgments |
| 274 | + |
| 275 | +- **Cryptography**: Built on industry-standard libraries |
| 276 | +- **Performance**: Inspired by high-performance computing practices |
| 277 | +- **Security**: Following OWASP and NIST guidelines |
| 278 | +- **Community**: Thanks to all contributors and users |
| 279 | + |
| 280 | +## 📞 Support |
| 281 | + |
| 282 | +- **Issues**: [GitHub Issues](https://github.com/Pymmdrza/fastCrypter/issues) |
| 283 | +- **Discussions**: [GitHub Discussions](https://github.com/Pymmdrza/fastCrypter/discussions) |
| 284 | +- **Email**: pymmdrza@gmail.com |
| 285 | + |
| 286 | +--- |
| 287 | + |
| 288 | +**`fastCrypter`** - Making encryption fast, secure, and accessible! 🚀🔐 |
0 commit comments