Post-classical cryptographic engine with automated security profiles
STC v0.3.1 is a cryptographic system implementing post-classical techniques. It uses lattice-based entropy, multi-path hashing, and automated profile selection:
- File Type Detection - Detects file types using extensions and binary signatures
- 19 Predefined Profiles - Different parameter sets for documents, media, credentials, etc.
- Content Analysis - Pattern matching for keywords and file structure analysis
- Profile Selection - Automatically selects parameters based on detected file type
- Command-Line Interface - CLI tool for file encryption/decryption
- Continuous Entropy Lattice (CEL) - Lattice-based entropy generation with quality metrics
- Probabilistic Hashing Engine (PHE) - Multi-path hashing with configurable path count
- Contextual Key Emergence (CKE) - Key derivation from lattice state intersections
- Data-State Folding (DSF) - Data transformation using tensor operations
- Polymorphic Cryptographic Flow (PCF) - Parameter modification based on entropy state
- Decoy System - Variable-count fake data vectors for obfuscation
- State Persistence - Serialization of cryptographic state to binary format
core/
βββ cel/ # Continuous Entropy Lattice
βββ phe/ # Probabilistic Hashing Engine
βββ cke/ # Contextual Key Emergence
βββ dsf/ # Data-State Folding
βββ pcf/ # Polymorphic Cryptographic Flow
βββ state/ # State persistence and reconstruction
βββ profiles/ # Automated Security Profiles
βββ security_profiles.py # 5 basic profiles (Document, Media, etc.)
βββ intelligent_profiles.py # 19 specialized profiles with parameter sets
βββ adaptive_security.py # Parameter adjustment based on detected patterns
βββ content_optimizers.py # File-type specific optimizations
interfaces/
βββ api/ # Programmatic interface
βββ cli/ # Command-line tools
βββ bindings/ # Future cross-language bindings
utils/ # Mathematical primitives + TLV varint encoding
tests/ # Validation and integrity checks (100+ tests)
- Large File Support: Files >100GB supported through chunked processing
- Memory Usage: Approximately 7MB RAM usage during processing
- Decryption Optimization: Early decoy validation reduces processing time
- Automated Parameter Selection: Profile-based parameter selection
- Parameter Sets: Predefined parameter combinations for different file types
- File Type Detection: Extension and binary signature analysis
- Performance Tuning: Different lattice sizes and security parameters per profile
- CLI Integration: Single command encryption with automatic profile selection
- Document profile: ~0.8s encryption, ~200KB metadata (lattice 128x128x6)
- Media profile: ~0.5s encryption, ~150KB metadata (lattice 96x96x5)
- Credential profile: ~2.0s encryption, ~500KB metadata (lattice 256x256x8)
- Streaming throughput: 50-100 MB/s depending on profile and hardware
- v0.3.1: Added profile system, streaming support, CLI interface
- v0.3.0: Reduced lattice sizes for performance, added polymorphic decoys
- v0.2.1: Implemented varint encoding, reduced metadata size by 65%
- v0.2.0: Complete rewrite with lattice-based cryptography
pip install seigr-toolset-crypto==0.3.1Download the latest release from Releases:
# Install from wheel (recommended)
pip install seigr_toolset_crypto-0.3.1-py3-none-any.whl
# Or install from source tarball
pip install seigr_toolset_crypto-0.3.1.tar.gzgit clone https://github.com/Seigr-lab/SeigrToolsetCrypto.git
cd SeigrToolsetCrypto
pip install -e .- Python 3.9+
- NumPy 1.24.0+
# Install STC
pip install seigr-toolset-crypto==0.3.1
# Encrypt file with automatic profile selection
stc-cli encrypt --input my_file.pdf --password "my_password"
# File type detected and appropriate parameters applied automatically# Analyze file to see detected type and recommended profile
stc-cli analyze --input my_document.pdf
# Output shows detected file type and selected parameter set# Install and import
pip install seigr-toolset-crypto==0.3.1
from core.profiles import get_profile_for_file
from stc import STCContext
# Detect file type and get corresponding parameter set
profile = get_profile_for_file("my_file.pdf") # Returns detected profile
ctx = STCContext("my-app")
encrypted, metadata = ctx.encrypt_file("my_file.pdf", "password", profile=profile)# Encrypt file with automatic profile detection
stc-cli encrypt --input my_document.pdf --password "my_password"
# Decrypt file
stc-cli decrypt --input my_document.pdf.enc --password "my_password"
# Analyze file type and see recommended profile
stc-cli analyze --input family_photo.jpg
# Output shows detected file type and selected parameter setfrom core.profiles import get_profile_for_file, get_optimized_parameters
from stc import STCContext
# Automatic file type detection based on extension and content
profile = get_profile_for_file("tax_return.pdf") # Returns "document"
profile = get_profile_for_file("family_photo.jpg") # Returns "media"
profile = get_profile_for_file("passwords.txt") # Returns "credentials"
# Get parameter set for detected profile
params = get_optimized_parameters(profile, file_size=2048000)
# Encrypt with profile-specific parameters
ctx = STCContext("my-app")
encrypted, metadata = ctx.encrypt_file("tax_return.pdf", "password", profile_params=params)from core.profiles import IntelligentSecurityProfileManager
# Analyze file content using pattern matching and heuristics
with open("sensitive_document.pdf", "rb") as f:
data = f.read()
result = IntelligentSecurityProfileManager.analyze_and_recommend(
data, filename="sensitive_document.pdf"
)
print(f"Detected type: {result['content_analysis']['file_type']}")
print(f"Recommended profile: {result['recommended_profile']}")
print(f"Confidence: {result['confidence']:.2f}")
print(f"Analysis: {result['content_analysis']}")from interfaces.api.stc_api import STCContext
# Manual approach for developers
ctx = STCContext('my-unique-seed')
encrypted, metadata = ctx.encrypt("Secret message", password="strong_password")
decrypted = ctx.decrypt(encrypted, metadata, password="strong_password")
print(decrypted) # "Secret message"# Encrypt folder with media profile parameters
stc-cli encrypt-folder --input "Family Photos" --profile media --password "family_2024"
# Use credential profile for sensitive documents
stc-cli encrypt --input "tax_return.pdf" --profile credentials --password "tax_secure_2024"
# Use backup profile for system files
stc-cli encrypt --input "system_backup.tar.gz" --profile backup --password "backup_2024"# Content analysis with additional parameters
with open("patient_record.pdf", "rb") as f:
data = f.read()
result = IntelligentSecurityProfileManager.analyze_and_recommend(
data, filename="patient_record.pdf"
)
# Manual parameter adjustment based on requirements
from core.profiles import AdaptiveSecurityManager
adaptive = AdaptiveSecurityManager()
# Note: Threat detection is based on pattern analysis, not active monitoringfrom interfaces.api import stc_api
# Initialize STC context
context = stc_api.initialize(seed="your-seed-phrase")
# Encrypt data (uses seed as password)
encrypted, metadata = context.encrypt("sensitive information")
# Decrypt data
decrypted = context.decrypt(encrypted, metadata)
print(decrypted) # "sensitive information"
# Generate probabilistic hash
hash_result = context.hash("data to hash")from interfaces.api import stc_api
# Quick encrypt - returns encrypted data, metadata, and context
encrypted, metadata, context = stc_api.quick_encrypt(
"sensitive data",
seed="your-seed"
)
# Quick decrypt - reconstructs context from metadata
decrypted = stc_api.quick_decrypt(
encrypted,
metadata,
seed="your-seed"
)from interfaces.api.stc_api import STCContext
# Custom lattice and security parameters
context = STCContext(
seed="your-seed",
lattice_size=128, # Default: 128 (optimized in v0.2.0)
depth=6, # Default: 6 (optimized in v0.2.0)
morph_interval=100, # PCF morphing interval
adaptive_morphing=True, # v0.3.0: CEL-delta-driven intervals
adaptive_difficulty='balanced' # v0.3.0: 'fast', 'balanced', 'paranoid'
)
# Encrypt with custom context and v0.3.0 features
encrypted, metadata = context.encrypt(
"data",
password="password123",
use_decoys=True, # v0.3.0: Enabled by default
num_decoys=3, # v0.3.0: Default count
variable_decoy_sizes=True # v0.3.0: Polymorphic decoys
)
# Derive keys
key = context.derive_key(length=32)
# Hash data
hash_value = context.hash("data")# Save context state
state = context.save_state()
# Load state (for resuming)
context.load_state(state)
# Get context status
status = context.get_status()
print(status)- β 5 Basic Profiles - Document, Media, Credentials, Backup, Custom
- 19+ Specialized Profiles - Financial, Medical, Legal, Technical, Government, etc.
- β Auto-Detection - Analyzes file type/content and recommends perfect profile
- β Content Analysis - Detects sensitive patterns (SSN, credit cards, medical terms)
- β Adaptive Security - Automatically responds to detected threats
- β Compliance Ready - HIPAA, GDPR, SOX-compliant profiles available
- β Ultra-Fast Streaming - >100GB files at 50+ MB/s throughput
- β Constant Memory - Only 7MB RAM usage regardless of file size
- β Upfront Validation - 3-5x faster decryption via early decoy verification
- β Streaming Integration - Works seamlessly with all security profiles
- β
Simple Commands -
stc-cli encrypt --intelligenthandles everything - β Batch Operations - Encrypt/decrypt entire folders
- β
Smart Recommendations -
stc-cli analyzegives perfect suggestions - β No Programming Required - Accessible to non-technical users
- β Entropy Health API - Quality scoring, threshold enforcement, detailed metrics
- β Enhanced Decoy Polymorphism - Variable sizes (32Γ3 to 96Γ5), randomized counts
- β Context-Adaptive Morphing - CEL-delta-driven intervals (50/100/200 ops)
- β Adaptive Difficulty Scaling - Oracle attack detection, dynamic path scaling
- β Security-First Design - All features enabled by default
- β Password-based encryption with MAC verification
- β Metadata encryption using ephemeral keys
- β Binary TLV format for compact metadata storage
- β CEL entropy amplification with timing chains and multi-tier feedback
- β PHE multi-path hashing (3-15 parallel paths, adaptive)
- β Entropy quality auditing and collision monitoring
- Intelligent Profiles: Auto-optimized performance per file type
- Streaming: 50-100 MB/s throughput, 7MB constant memory
- Document Profile: ~0.8s encryption, ~200KB metadata (balanced)
- Media Profile: ~0.5s encryption, ~150KB metadata (speed-optimized)
- Credentials Profile: ~2.0s encryption, ~500KB metadata (maximum security)
- β 100+ Tests Passing - Comprehensive test coverage
- β Intelligent Defaults - Perfect settings chosen automatically
- β Non-Technical Friendly - Command-line interface for anyone
- β Enterprise Features - Compliance profiles, audit trails, threat response
β οΈ Security Audit Pending - Formal cryptographic review in progress
See CHANGELOG.md for detailed version history and docs/PERFORMANCE.md for optimization details.
- Zero Configuration:
stc-cli encrypt --intelligenthandles everything automatically - AI Content Analysis: Detects what you're encrypting and applies perfect security
- Smart Recommendations: Always know the optimal settings for your files
- Adaptive Security: Automatically responds to threats and attack patterns
- Intelligent Optimization: Different profiles for documents, photos, credentials, backups
- High-Speed Streaming: >100GB files at 50+ MB/s with only 7MB RAM
- Perfect Balance: Optimal speed/security ratio automatically chosen per file type
- Enterprise Ready: HIPAA, GDPR, SOX compliance profiles available
- Post-Classical Cryptography: No XOR, no block ciphers, no legacy vulnerabilities
- Adaptive Polymorphism: Security evolves based on usage patterns
- Threat Response: Automatically increases protection when attacks detected
- Self-Sovereign: No cloud dependencies, complete user control
- Non-Programmers: Simple command-line interface, no coding required
- Developers: Rich Python API with intelligent profile integration
- Enterprises: Compliance-ready profiles, audit trails, centralized management
- Security Professionals: Advanced cryptographic techniques with intelligent optimization
- Intelligence over complexity - STC chooses optimal settings automatically
- Security by default - Maximum protection without manual configuration
- Performance through intelligence - Smart optimization, not feature reduction
- Universal accessibility - From command-line to enterprise API
- Adaptive protection - Security evolves with threats and usage patterns
- Self-sovereign control - No external dependencies, complete user ownership
See examples/ directory for practical demonstrations:
password_manager/- Secure credential storage with intelligent profilesconfig_encryption/- Configuration file encryption with auto-detectionentropy_health/- Entropy monitoring and quality threshold examplesvalidation/- Security profile validation and testing examples
Also see comprehensive user manual at docs/user_manual/ with step-by-step guides for:
- Security Profiles - Auto-detection and smart recommendations
- Command-Line Usage - Simple encryption without programming
- Intelligent Profiles - AI-powered content analysis
- Real-World Scenarios - Complete examples for common use cases
Run examples:
cd examples/password_manager
python password_manager.py
cd examples/config_encryption
python config_example.py
cd examples/entropy_health
python entropy_monitoring.pyRun the full test suite:
# Run all tests
python -m pytest tests/ -v
# Run specific test modules
python -m pytest tests/test_cel.py -v
python -m pytest tests/test_phe.py -v
python -m pytest tests/test_integration_v031.py -v
python -m pytest tests/test_intelligent_security_system.py -vAll 100+ tests pass in v0.3.1 (including intelligent security system tests).
v0.3.1 - Production-ready with intelligent security and high-performance streaming
- β Intelligent Security Profiles - 19+ AI-powered profiles with content analysis
- β High-Performance Streaming - >100GB files, 50+ MB/s, 7MB constant memory
- β Command-Line Interface - Simple encryption for non-programmers
- β Adaptive Security - Automatic threat response and optimization
- β 100+ Tests - Comprehensive validation including intelligent features
- v0.3.2: Additional intelligent profiles, enhanced CLI features
- v0.4.0: Hardware acceleration (SIMD/GPU), formal verification
- v1.0.0: Security audit, quantum resistance, stable API
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Submit a pull request
See docs/ for architecture and API documentation.
ANTI-CAPITALIST SOFTWARE LICENSE (v 1.4) - See LICENSE file for details
If you use STC in research, please cite:
@software{seigr_toolset_crypto,
title = {Seigr Toolset Crypto: Intelligent Post-Classical Cryptographic Engine},
author = {Seigr-lab},
year = {2025},
version = {0.3.1},
url = {https://github.com/Seigr-lab/SeigrToolsetCrypto}
}