https://github.com/sethuiyer/chaosencrypt
Deterministic chaos meets encryption. A prime-fueled, keystream-based cipher with stealth key exchange.
https://github.com/sethuiyer/chaosencrypt
Last synced: 2 months ago
JSON representation
Deterministic chaos meets encryption. A prime-fueled, keystream-based cipher with stealth key exchange.
- Host: GitHub
- URL: https://github.com/sethuiyer/chaosencrypt
- Owner: sethuiyer
- License: mit
- Created: 2025-03-29T15:57:32.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-29T16:19:40.000Z (2 months ago)
- Last Synced: 2025-03-29T17:20:34.402Z (2 months ago)
- Language: JavaScript
- Size: 1.78 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CHAOSENCRYPT (PCE-100x)
[](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-22r1a.pdf)
[](LICENSE)
[](https://github.com/sethuiyer/chaosencrypt/releases)
[](./PAPER.md)
[](https://sethuiyer.github.io/chaosencrypt/index.html)
[](https://en.wikipedia.org/wiki/Entropy_(information_theory))
[](https://en.wikipedia.org/wiki/Cycle_detection)
[](https://www.python.org/)
[](https://github.com/sethuiyer/chaosencrypt)> **Author**: Sethu Iyer
> **Last Updated**: 2025-03-29
**CHAOSENCRYPT** (PCE-100x) is an experimental, prime-fueled, keystream-based cipher that marries deterministic chaos with encryption, featuring a unique stealth key exchange mechanism and emergent semantic properties.
## ๐ Core Concepts
- **Prime-Based Chaotic Generator:** Employs the formula `xโโโ = (prime * xโ) mod 1` to generate statistically strong pseudo-random sequences.
- **Dynamic Step Count (`k`):** A variable iteration count that obfuscates the encryption process, adding a layer of security.
- **XOR Keystream:** Protects data integrity and prevents direct correlations between plaintext and ciphertext.
- **Orbit Break Key Exchange:** A novel, covert method for sharing the secret step count `k` without explicit transmission.
- **MAC-Based Integrity:** A simple yet effective Message Authentication Code for tamper detection.
- **Semantic Clustering:** An unexpected emergent property that preserves semantic relationships in ciphertext.## ๐ฏ Key Features
- **High-Quality Chaotic PRNG:** Achieves impressive statistical randomness, passing 14/15 NIST SP800-22 tests.
- **Long Cycles:** Exhibits cycle lengths exceeding 10 million steps, reducing repetition risk.
- **Statistical and Cryptographic Strength:** Combines the chaotic nature of the map with dynamic parameters and XOR to create a robust system.
- **Stealth Key Exchange:** Utilizes "Orbit Break" to securely share the step count `k`.
- **Semantic Preservation:** Retains some semantic relationships in ciphertext, enabling potential new applications.
- **Lightweight and Portable:** Implementable in minimal compute environments.## ๐งช Experimental Validation
Our research includes rigorous testing:
- **NIST Statistical Tests:** Achieved 14/15 pass rate (SP800-22).
- **Cycle Length Experiments:** 10M+ steps without repetition.
- **Prime-Digit Precision Hypothesis:** Uncovered "Chaotic Harmonics" phenomenon.
- **Entropy Rate Tracking:** Approaching 7.98 bits/byte.
- **MAC Collision Resistance Simulation:** Showed robustness of the MAC.
- **Semantic Clustering Phenomenon:** Documented the preservation of semantic relationships in ciphertext.## ๐งฉ Core Mechanisms
### ๐ Chaotic Map
> `xโโโ = (prime * xโ) mod 1`
- `prime`: Typically `9973`, or a sequence (e.g., `[9973, 9941, 9929]`) for deeper mixing.
- Cycle length: Can exceed millions of steps.### ๐ข Dynamic Step Count & KDF
- Iterates the map `k` times.
- `k` can be fixed, dynamic (derived), or communicated via Orbit Break.
- KDF: `k_derived = (baseK + secret + chunkIndex) mod 50 + 1`### ๐ XOR Keystream Mode
- `state_k % 256` as keystream bytes.
- `ciphertext = plaintext โ keystream`.### ๐ MAC Computation & Verification
- `MAC = (ฮฃ(ciphertextValues) + secret) mod MAC_PRIME`.
- `MAC_PRIME`: Large prime (e.g., `1e65 + 67`).### ๐ค Orbit Break Key Exchange
1. Both parties share an initial seed.
2. Bob iterates and sends results.
3. At `k+1`, Bob sends noise.
4. Alice detects the break and infers `k`.## ๐ ๏ธ Command-Line Interface (CLI)
A Python CLI is available for all core features:
```
bash
# Basic encryption
./chaosencrypt_cli.py encrypt --secret "your-secret" "Hello, World!"# Advanced encryption with all options
./chaosencrypt_cli.py encrypt \
--precision 12 \
--primes "9973,9941,9929" \
--chunk-size 16 \
--base-k 6 \
--dynamic-k \
--xor \
--mac \
--secret "your-secret" \
"Your message here"# Decryption
./chaosencrypt_cli.py decrypt \
--secret "your-secret" \
--mac-value "MAC_VALUE" \
"CIPHERTEXT_HEX"
```
### CLI Features- `--precision`: Calculation precision (default: 12).
- `--primes`: Comma-separated list for deeper mixing.
- `--chunk-size`: Chunk size for large messages.
- `--base-k`: Base iteration count.
- `--dynamic-k`: Enable/disable dynamic `k`.
- `--xor`: Toggle XOR mode.
- `--mac`: Enable/disable MAC.
- `--secret`: Shared secret.
- `--mac-value`: MAC value for decryption.### Example Usage
```
bash
# 1. Encrypt
$ ./chaosencrypt_cli.py encrypt --secret "test123" "Hello, CHAOSENCRYPT!"
Ciphertext (hex): 499015a15ec9096a0ea7b5c9b0
MAC: 804242536103942577353638559904425649505215714466728195510131525952# 2. Decrypt
$ ./chaosencrypt_cli.py decrypt --secret "test123" --mac-value "804242536103942577353638559904425649505215714466728195510131525952" "499015a15ec9096a0ea7b5c9b0"
Decrypted message: Hello, CHAOSENCRYPT!
```
## ๐ก Advantages- **Simplicity and Adaptability:** Easy to understand and modify.
- **Long Orbits:** Challenges attackers with long, non-repeating sequences.
- **Covert Key Signals:** Orbit Break provides stealthy key exchange.
- **Portability:** Runs on minimal hardware (JavaScript, Python).
- **Emergent Semantics**: Preserves some semantic relationships.## โ ๏ธ Limitations
- **Experimental:** Not NIST-approved.
- **Implementation Errors:** Sensitive to coding mistakes.
- **MAC is "Toy":** Use HMAC for production.
- **Seed/Key Management:** Critical for security.
- **CPA Attacks:** Potential weakness with simplistic `k` derivation.## ๐ Security Considerations
- **COA:** Challenging unless the attacker can exhaust an enormous parameter space.
- **KPA:** Difficult due to dynamic `k` and separate chunk processing.
- **CPA:** Design your KDF carefully to avoid patterns.
- **MAC Forgery:** Nearly impossible with a hidden secret.
- **Orbit Break Exploit:** Secure if the attacker does not share the prime seed.## ๐ Table of Contents
1. [Core Concepts](#-core-concepts)
2. [Key Features](#-key-features)
3. [Experimental Validation](#-experimental-validation)
4. [Core Mechanisms](#-core-mechanisms)
- [Chaotic Map](#-chaotic-map)
- [Dynamic Step Count & KDF](#-dynamic-step-count--kdf)
- [XOR Keystream Mode](#-xor-keystream-mode)
- [MAC Computation & Verification](#-mac-computation--verification)
- [Orbit Break Key Exchange](#-orbit-break-key-exchange)
5. [Command-Line Interface (CLI)](#-command-line-interface-cli)
- [CLI Features](#cli-features)
- [Example Usage](#example-usage)
6. [Advantages](#-advantages)
7. [Limitations](#-limitations)
8. [Security Considerations](#-security-considerations)
9. [Further Reading](#-further-reading)## ๐ Further Reading
- **[1]** Blum, L., Blum, M., & Shub, M., *A Simple Unpredictable Pseudo-Random Number Generator*, SIAM Journal on Computing, 1986.
- **[2]** Shanon, C. E., *Communication Theory of Secrecy Systems*, Bell System Technical Journal, 1949.
- **[3]** NIST SP 800-22, *A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications*.
- **[4]** Menezes, A. J., van Oorschot, P. C., & Vanstone, S. A., *Handbook of Applied Cryptography*, 5th ed.---
Explore the fascinating world of prime-driven chaos and discover the surprising properties of CHAOSENCRYPT!