Professional compression and encryption library with native C/C++ acceleration
Project description
๐ fastCrypter
Professional Compression and Encryption Library with Native C/C++ Acceleration
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.
โจ Key Features
๐ Advanced Encryption
- Multiple Algorithms: AES-256-GCM, ChaCha20-Poly1305, RSA
- Secure Key Management: PBKDF2, Argon2, secure random generation
- Digital Signatures: RSA and ECC-based signing
- Custom Encoding: User-defined character sets for obfuscation
๐๏ธ High-Performance Compression
- Multiple Formats: ZLIB, LZMA, Brotli, custom RLE
- Adaptive Algorithms: Automatic best-fit selection
- Native Acceleration: C/C++ libraries for critical operations
- Memory Efficient: Streaming support for large files
โก Native Performance
- C/C++ Libraries: Optimized crypto and hash operations
- SIMD Instructions: Vectorized operations where available
- Cross-Platform: Windows (.dll), Linux (.so), macOS (.dylib)
- Automatic Fallback: Pure Python when native libs unavailable
๐ก๏ธ Security Features
- Secure Memory: Protected key storage and cleanup
- Entropy Analysis: Data randomness validation
- Side-Channel Protection: Constant-time operations
- Audit Trail: Comprehensive logging and validation
๐ Quick Start
Installation
# Install from PyPI
pip install fastCrypter
# Install with development dependencies
pip install fastCrypter[dev]
# Install with native compilation support
pip install fastCrypter[native]
Basic Usage
import fastCrypterer
# Get the recommended compressor (automatically uses native acceleration if available)
compressor = fastCrypterer.get_recommended_compressor(password="your_secure_password")
# Compress and encrypt data
data = b"Your sensitive data here"
encrypted = compressor.compress_and_encrypt(data)
# Decrypt and decompress
decrypted = compressor.decrypt_and_decompress(encrypted)
assert data == decrypted
Custom Encoding Example
from fastCrypterer import CustomEncoder
# Create custom encoder with your character set
encoder = CustomEncoder(charset="abcdef98Xvbvii")
# Encode data
original = b"Hello, World!"
encoded = encoder.encode(original)
print(f"Encoded: {encoded}")
# Decode back
decoded = encoder.decode(encoded)
assert original == decoded
File Encryption
from fastCrypterer import FileEncryptor
# Initialize file encryptor
encryptor = FileEncryptor(password="your_password")
# Encrypt a file
encryptor.encrypt_file("document.pdf", "document.pdf.encrypted")
# Decrypt the file
encryptor.decrypt_file("document.pdf.encrypted", "document_restored.pdf")
๐๏ธ Architecture
fastCrypter is built with a modular architecture:
fastCrypter/
โโโ core/ # Core functionality
โ โโโ compressor.py # Compression algorithms
โ โโโ encryptor.py # Encryption algorithms
โ โโโ key_manager.py # Key derivation and management
โ โโโ custom_encoder.py # Custom encoding schemes
โโโ algorithms/ # Algorithm implementations
โ โโโ compression/ # Compression algorithms
โ โโโ encryption/ # Encryption algorithms
โโโ native/ # Native C/C++ libraries
โ โโโ libs/ # Compiled libraries (.so/.dll/.dylib)
โ โโโ native_loader.py # Python bindings
โโโ utils/ # Utility functions
โโโ exceptions.py # Custom exceptions
๐ง Native Compilation
fastCrypter includes C/C++ libraries for performance-critical operations:
Automatic Compilation
# Build native libraries
python build_native.py
# Build with specific compiler
python build_native.py --compiler gcc
# Build optimized release version
python build_native.py --release
Manual Compilation
# Using Make (Linux/macOS)
cd fastCrypter/native
make all
# Using MinGW (Windows)
cd fastCrypter/native
mingw32-make all
Performance Benefits
Native libraries provide significant performance improvements:
- XOR Operations: 3-5x faster with SIMD instructions
- Hash Functions: 2-3x faster SHA-256 and HMAC
- Key Derivation: 2-4x faster PBKDF2
- Compression: 1.5-2x faster RLE compression
๐ Performance Benchmarks
# Run comprehensive benchmarks
results = fastCrypter.benchmark_available_features(data_size=1024*1024)
print(f"Native acceleration: {results['performance']['native']['available']}")
print(f"Speedup factor: {results['performance'].get('speedup', 'N/A')}")
Example results on modern hardware:
- Standard Mode: ~50 MB/s compression + encryption
- Enhanced Mode: ~150 MB/s with native acceleration
- Memory Usage: <100MB for 1GB files (streaming)
๐ Advanced Features
Enhanced Compressor
from fastCrypterer import EnhancedCompressor
# Create enhanced compressor with native acceleration
compressor = EnhancedCompressor(
password="secure_password",
use_native=True,
compression_level=6
)
# Check if native libraries are available
if compressor.is_native_available():
print("๐ Native acceleration enabled!")
Custom Algorithms
from fastCrypterer.core import Compressor, CompressionAlgorithmType
# Use specific compression algorithm
compressor = Compressor(
algorithm=CompressionAlgorithmType.BROTLI,
level=9 # Maximum compression
)
Secure Key Management
from fastCrypterer import KeyManager
# Generate secure keys
key_manager = KeyManager()
master_key = key_manager.generate_key(password="user_password", salt=b"unique_salt")
# Derive multiple keys from master key
encryption_key = key_manager.derive_key(master_key, b"encryption", 32)
signing_key = key_manager.derive_key(master_key, b"signing", 32)
๐งช Testing
fastCrypter includes comprehensive tests:
# Run all tests
python -m pytest tests/ -v
# Run with coverage
python -m pytest tests/ --cov=fastCrypter --cov-report=html
# Run performance tests
python -m pytest tests/test_performance.py -v
# Run native library tests
python final_test.py
๐ง Development
Setting Up Development Environment
# Clone repository
git clone https://github.com/Pymmdrza/fastCrypter.git
cd fastCrypter
# Install in development mode
pip install -e .[dev]
# Build native libraries
python build_native.py
# Run tests
python -m pytest
Code Quality
# Format code
black fastCrypter/ tests/
# Lint code
flake8 fastCrypter/ tests/
# Type checking
mypy fastCrypter/
๐ Documentation
- API Reference: docs.fastCrypter.dev
- Examples: See
examples/directory - Performance Guide: Performance Optimization
- Security Guide: Security Best Practices
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Cryptography: Built on industry-standard libraries
- Performance: Inspired by high-performance computing practices
- Security: Following OWASP and NIST guidelines
- Community: Thanks to all contributors and users
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: pymmdrza@gmail.com
fastCrypter - Making encryption fast, secure, and accessible! ๐๐
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastcrypter-2.3.0.tar.gz.
File metadata
- Download URL: fastcrypter-2.3.0.tar.gz
- Upload date:
- Size: 49.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abcd6b872276a3e7752633f12cd9ac66bf54777bd5d051045dd6dbfdd2ba1219
|
|
| MD5 |
1a98a86678bbaad1085fdfac3799f4d6
|
|
| BLAKE2b-256 |
2535efbf2f78b44cae10436dd1e92fd3b54755d462127adebd8a489469ca051a
|
File details
Details for the file fastcrypter-2.3.0-py3-none-any.whl.
File metadata
- Download URL: fastcrypter-2.3.0-py3-none-any.whl
- Upload date:
- Size: 41.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
048585183492c628f69e49db1b3fd5768aea1a437041788d9a329d28aefb0927
|
|
| MD5 |
4a01ba94f87984e273bb66ed03bf1704
|
|
| BLAKE2b-256 |
71b945574ae2d122060da2ae1c278ec189225a3bce1b0a2dee2824b613bde539
|