Skip to main content

fastCrypter

Professional Compression and Encryption Library with Native C/C++ Acceleration

Pipeline Status Python Version License PyPI Version Downloads

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 fastcrypter

# Get the recommended compressor (automatically uses native acceleration if available)
compressor = fastcrypter.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 fastcrypter 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 fastcrypter 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")

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 fastcrypter 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 fastcrypter.core import Compressor, CompressionAlgorithmType

# Use specific compression algorithm
compressor = Compressor(
    algorithm=CompressionAlgorithmType.BROTLI,
    level=9  # Maximum compression
)

Secure Key Management

from fastcrypter 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://gitlab.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

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


fastcrypter - Making encryption fast, secure, and accessible!

Release files for fastcrypter 2.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastcrypter 2.4.4
File Size Uploaded
fastcrypter-2.4.4.tar.gz 71.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastcrypter 2.4.4
File Interpreter ABI Platform
fastcrypter-2.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 127.3 kB

Release files / fastcrypter-2.4.4.tar.gz

Download URL fastcrypter-2.4.4.tar.gz
Size 71.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3f4927ae4ffa7de0cef79e8461d168bc11f84fb5758a424701ebe546be4c1b8c
BLAKE2b-256 checksum
How to use checksums
b9df6b2eab18618978b62cdb43db5864549877b41f9aca876a4249112a479e52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / fastcrypter-2.4.4-py3-none-any.whl

Download URL fastcrypter-2.4.4-py3-none-any.whl
Size 55.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc2b33e417e00fbd1444569d104527e34033b20b65dfad49d652d6c5303f59df
BLAKE2b-256 checksum
How to use checksums
5ad948814810880ce1f7d402630799737a0bc0f0f9cf75e33f2de22d418687e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

2.4.4 This release

2 release files

2.4.2

2 release files

2.4.0

2 release files

2.3.9

2 release files

2.3.6

2 release files

2.3.3

2 release files

2.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page