https://github.com/cpscript/qrcryptography
Experimental post-quantum cryptographic framework implementing hybrid lattice-based encryption with hash based signatures. Combining Ring-LWE, standard LWE, and Merkle trees for defense against classical and quantum attacks.
https://github.com/cpscript/qrcryptography
cryptographic-research cryptography experimental hash-based-signatures python quantum-resistant ring-lwe
Last synced: about 1 month ago
JSON representation
Experimental post-quantum cryptographic framework implementing hybrid lattice-based encryption with hash based signatures. Combining Ring-LWE, standard LWE, and Merkle trees for defense against classical and quantum attacks.
- Host: GitHub
- URL: https://github.com/cpscript/qrcryptography
- Owner: CPScript
- Created: 2025-06-22T07:09:20.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-07-04T02:34:42.000Z (3 months ago)
- Last Synced: 2025-08-30T05:57:44.361Z (about 1 month ago)
- Topics: cryptographic-research, cryptography, experimental, hash-based-signatures, python, quantum-resistant, ring-lwe
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> QRCs is an experimental post-quantum cryptographic framework implementing hybrid lattice-based encryption with hash-based digital signatures. The system combines Ring Learning With Errors, standard Learning With Errors, and Merkle signature schemes to provide defense against both classical and quantum cryptanalytic attacks.
## Architecture
The system implements a multi-layer cryptographic approach using:
Ring-LWE encryption for structured lattice problems
Standard LWE encryption for unstructured lattice security
Hash-based signatures using Merkle trees and Winternitz one-time signatures
Advanced Reed-Solomon error correction with Berlekamp-Massey decoding
Constant-time operations for side-channel resistance
Military-grade entropy collection from multiple hardware sources
Key switching and bootstrapping for homomorphic operations
Authenticated encryption with HMAC-SHA3-512## Security Levels
CLASSICAL_128 - 128-bit classical security equivalent
CLASSICAL_192 - 192-bit classical security equivalent
CLASSICAL_256 - 256-bit classical security equivalent
QUANTUM_128 - 128-bit post-quantum security
QUANTUM_192 - 192-bit post-quantum security
QUANTUM_256 - 256-bit post-quantum security
FORTRESS - Maximum security configuration## Installation
Python 3.8 or higher required with numpy dependency.
```
pip install numpy
```No additional dependencies required. System uses only Python standard library and numpy.
## Basic Usage
```python
from QRCs import QRCs, SecurityLevel# Initialize system
system = QRCs(SecurityLevel.QUANTUM_256)# Generate keypair
public_key, private_key = system.generate_keypair()# Encrypt data
plaintext = b"confidential message"
associated_data = b"authentication context"
ciphertext = system.encrypt(plaintext, public_key, associated_data)# Decrypt data
decrypted = system.decrypt(ciphertext, private_key, associated_data)# Digital signatures
signature = system.sign(plaintext, private_key)
is_valid = system.verify(plaintext, signature, public_key)
```## Technical Specifications
Ring dimension: 1024 to 4096 coefficients depending on security level
Lattice dimension: 512 to 2048 vectors
Coefficient modulus: Multiple prime moduli up to 30 bits
Gaussian parameter: 3.2 to 6.0 standard deviation
Error correction: Reed-Solomon with 16 to 64 error correction capacity
Hash function: SHA3-512 for all cryptographic hashing
Signature tree height: 16 to 32 levels supporting 65536 to 4 billion signatures## Performance Characteristics
Key generation: 50-500ms depending on security level
Encryption: 5-50ms per kilobyte
Decryption: 3-30ms per kilobyte
Signature generation: 10-100ms
Signature verification: 5-50ms
Memory usage: 1-16MB depending on security parametersPerformance scales with security level. FORTRESS configuration provides maximum security at cost of reduced performance.
## Implementation Details
All arithmetic operations use constant-time implementations to prevent timing attacks. Random number generation combines multiple entropy sources including hardware performance counters, system entropy pools, and cryptographic random generators.
Error correction uses advanced Reed-Solomon codes with polynomial-time Berlekamp-Massey algorithm for optimal error locator computation. The system can correct up to t errors per codeword where t is configurable.
Key switching enables homomorphic operations while maintaining security properties. Bootstrapping allows noise reduction in ciphertext without exposing secret information.
## Cryptographic Primitives
Ring-LWE problem hardness based on shortest vector problem in ideal lattices
Standard LWE problem hardness based on shortest vector problem in general lattices
Hash-based signatures provide information-theoretic security
Number theoretic transforms enable efficient polynomial arithmetic
Discrete Gaussian sampling for lattice noise generation
Modular arithmetic with precomputed primitive roots## Research Applications
This implementation is suitable for:
Post-quantum cryptography research
Lattice-based cryptanalysis studies
Hybrid cryptographic system analysis
Performance benchmarking of post-quantum algorithms
Educational purposes in advanced cryptography## Limitations
The system has not undergone formal security analysis or peer review. Parameter selection is based on current research but may require adjustment as cryptanalytic techniques advance.
Signature keys support limited number of signatures before requiring regeneration. Performance decreases significantly at maximum security levels.
Implementation focuses on correctness and research utility rather than production optimization. Side-channel protections may be incomplete against sophisticated physical attacks.
## Compliance
This software implements cryptographic algorithms that may be subject to export restrictions in some jurisdictions. Users are responsible for compliance with applicable laws and regulations.
## Disclaimer
This software is provided for research only. No warranties are made regarding security, correctness, or fitness for any particular purpose. The implementation has not been audited or certified for production use.
Users assume all risks associated with the use of this cryptographic software. The authors disclaim all liability for any damages resulting from use of this system.
This is experimental research software and should not be used to protect sensitive or critical information without extensive additional testing and validation.
## References
Implementation based on current research in post-quantum cryptography including but not limited to lattice-based encryption schemes, hash-based signature systems, and error correction algorithms as published in peer-reviewed cryptographic literature.