Skip to content

Post-classical cryptographic engine with entropy-regenerative architecture

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.stc
Notifications You must be signed in to change notification settings

Seigr-lab/SeigrToolsetCrypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Seigr Toolset Crypto (STC)

Sponsor Seigr-lab Version License

Post-classical cryptographic engine with automated security profiles

Overview

STC v0.3.1 is a cryptographic system implementing post-classical techniques. It uses lattice-based entropy, multi-path hashing, and automated profile selection:

New in v0.3.1: Automated Security Profiles

  • 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

Core Cryptographic Components

  • 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

Architecture

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)

Performance & Features (v0.3.1)

Streaming Support

  • 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

Profile System

  • 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

Benchmark Results

  • 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

Version History

  • 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

Installation

From PyPI (Recommended)

pip install seigr-toolset-crypto==0.3.1

From GitHub Release

Download 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.gz

From Source (Development)

git clone https://github.com/Seigr-lab/SeigrToolsetCrypto.git
cd SeigrToolsetCrypto
pip install -e .

Requirements

  • Python 3.9+
  • NumPy 1.24.0+

Quick Start

Command Line Usage

# 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

Profile Analysis

# 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

Option 3: I'm a Developer

# 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)

Detailed Examples

Command Line Interface

# 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 set

Profile Detection System

from 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)

Content Analysis

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']}")

πŸ› οΈ Traditional Programming (Full Control)

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"

Usage Examples

# 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"

Advanced Usage

# 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 monitoring

Basic API (No Password)

from 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")

Quick API (One-liners)

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"
)

Usage

Advanced: Custom Parameters

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")

State Management

# Save context state
state = context.save_state()

# Load state (for resuming)
context.load_state(state)

# Get context status
status = context.get_status()
print(status)

Features

πŸ†• v0.3.1 "Intelligent Security & High-Performance Streaming"

🧠 Intelligent Security Profiles

  • βœ… 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

⚑ High-Performance Streaming

  • βœ… 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

πŸ–₯️ Command-Line Interface

  • βœ… Simple Commands - stc-cli encrypt --intelligent handles everything
  • βœ… Batch Operations - Encrypt/decrypt entire folders
  • βœ… Smart Recommendations - stc-cli analyze gives perfect suggestions
  • βœ… No Programming Required - Accessible to non-technical users

v0.3.0 "Adaptive Security & Transparency"

  • βœ… 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

Core Features (v0.2.0+)

  • βœ… 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

Current Performance (v0.3.1)

  • 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)

Production Readiness (v0.3.1)

  • βœ… 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.

Why Choose STC v0.3.1?

🧠 Intelligence Over Configuration

  • Zero Configuration: stc-cli encrypt --intelligent handles 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

⚑ Performance Without Compromise

  • 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

πŸ›‘οΈ Advanced Security Made Simple

  • 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

πŸ‘₯ For Everyone

  • 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

Core Principles

  1. Intelligence over complexity - STC chooses optimal settings automatically
  2. Security by default - Maximum protection without manual configuration
  3. Performance through intelligence - Smart optimization, not feature reduction
  4. Universal accessibility - From command-line to enterprise API
  5. Adaptive protection - Security evolves with threats and usage patterns
  6. Self-sovereign control - No external dependencies, complete user ownership

Examples

See examples/ directory for practical demonstrations:

  • password_manager/ - Secure credential storage with intelligent profiles
  • config_encryption/ - Configuration file encryption with auto-detection
  • entropy_health/ - Entropy monitoring and quality threshold examples
  • validation/ - 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.py

Testing

Run 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 -v

All 100+ tests pass in v0.3.1 (including intelligent security system tests).

Development Status

v0.3.1 - Production-ready with intelligent security and high-performance streaming

🎯 What's New in v0.3.1

  • βœ… 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

Roadmap

  • 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

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new features
  4. Submit a pull request

See docs/ for architecture and API documentation.

License

ANTI-CAPITALIST SOFTWARE LICENSE (v 1.4) - See LICENSE file for details


Citation

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}
}

Sponsor this project

 

Packages

No packages published

Languages