Dual Physics Stream Cipher — elastic collision + FPU lattice keystream generators
Project description
Kinetic Cipher
Dual Physics Stream Cipher — Zero dependencies, pure Python.
A novel symmetric encryption scheme that uses two independent physics simulations as keystream generators:
- Skeleton layer: Elastic collision of 14 particles on a 1D ring (346-bit state)
- Armor layer: Fermi-Pasta-Ulam nonlinear lattice with 32 nodes (1024-bit state)
No prior art found for either physics-to-keystream mechanism.
⚠ Educational / Experimental — No formal mathematical security proof exists. For production systems, use AES-256-GCM.
Install
pip install kinetic-cipher
Zero dependencies. Uses only Python standard library (hashlib, hmac, os, struct).
Quick Start
Python API
from kinetic_cipher import encrypt, decrypt
# Encrypt
ciphertext = encrypt(b"Hello, Kinetic Cipher!", "my-secret-passphrase")
# Decrypt
plaintext = decrypt(ciphertext, "my-secret-passphrase")
print(plaintext) # b"Hello, Kinetic Cipher!"
File Encryption
from kinetic_cipher import encrypt_file, decrypt_file
# Encrypt a file (original filename is preserved)
encrypt_file("report.pdf", "report.pdf.kc", "my-passphrase")
# Decrypt (original filename is restored automatically)
decrypt_file("report.pdf.kc", "./output/", "my-passphrase")
# → ./output/report.pdf
Command Line
# Encrypt a file
kinetic-cipher enc secret.txt -o secret.txt.kc
# Decrypt a file
kinetic-cipher dec secret.txt.kc -o ./decrypted/
# Encrypt text directly
kinetic-cipher enc -t "Hello World"
# Run self-test
kinetic-cipher test
# Benchmark
kinetic-cipher bench
Wire Format
[version 1B][salt 16B][iv 8B][ciphertext NB][hmac-sha256 32B]
- Version:
0x05(Kinetic Cipher v1.0) - Salt: 16 random bytes for PBKDF2 key derivation
- IV: 8 random bytes, unique per message
- HMAC: Encrypt-then-MAC authentication
Security Properties
| Property | Value |
|---|---|
| Key derivation | PBKDF2-SHA256, 100,000 iterations |
| Authentication | HMAC-SHA256, Encrypt-then-MAC |
| Skeleton state space | 346 bits (post-Grover: 2¹⁷³) |
| Armor state space | 1024 bits (post-Grover: 2⁵¹²) |
| Byte distribution χ² | 271.9 (pass) |
| Key avalanche | 49.9% |
| IV avalanche | 49.9% |
| Known-plaintext prediction | 0% success |
| Autocorrelation | All lags |
| Compression ratio | 100.0% (= true random) |
Performance
Pure Python, single-threaded:
| Size | Time | Speed |
|---|---|---|
| 1 KB | ~0.2s | ~5 KB/s |
| 10 KB | ~1.5s | ~7 KB/s |
| 100 KB | ~14s | ~7 KB/s |
For higher performance, use the Rust/WASM implementation (~23 MB/s) or the JS implementation included in the repository.
How It Works
- Key Derivation: Passphrase → PBKDF2-SHA256 (100K iterations) → 104-byte key material
- Particle Init: First 56 bytes seed 14 particles with position, velocity, and mass on a ring of size 16,384
- Lattice Init: Remaining 48 bytes seed a 32-node FPU nonlinear lattice
- Warmup: 64 collision steps + 32 lattice steps to mix initial state
- Encryption: Per 64-byte block:
- CC generates 16 keystream bytes (particle state hash)
- LS generates 48 keystream bytes (3 × lattice state hash)
- XOR plaintext with 64-byte combined keystream
- Hash all cipher bytes back into CC state (feedback)
- Authentication: HMAC-SHA256 over version + salt + IV + ciphertext
Cross-Platform Compatibility
The algorithm uses only integer arithmetic (no floating point), so implementations in any language produce identical ciphertext for the same inputs. Test vectors are provided in tests/test_vectors.json.
Implementations:
- Python (this package) — reference implementation
- Rust/WASM — ~23 MB/s, 13.5 KB binary (in repository)
- JavaScript/React — browser app (in repository)
Limitations
- No security proof: Strength is empirically tested, not mathematically proven
- Speed: Pure Python is ~7 KB/s (use Rust/WASM for performance-critical applications)
- Novel algorithm: Has not been subjected to years of public cryptanalysis like AES
License
MIT
Citation
If you use Kinetic Cipher in academic work:
Kinetic Cipher: A Dual Physics Stream Cipher Using Elastic Collision
and Fermi-Pasta-Ulam Lattice Keystream Generators. 2026.
Designed with AI assistance (Claude, Anthropic; reviewed by Gemini, Google).
https://github.com/kinetic-cipher/kinetic-cipher
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kinetic_cipher-1.0.0.tar.gz.
File metadata
- Download URL: kinetic_cipher-1.0.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20f7d6ce800f1258199d2f58cba9a82f6647e299c0d7e757866a63ba32d18403
|
|
| MD5 |
6505788982c2c112f80e47f97a64b2ee
|
|
| BLAKE2b-256 |
d8ad14c900d8a4894d004dca3e37e482ac35891fd24f5821f1fa557f71b83e6a
|
File details
Details for the file kinetic_cipher-1.0.0-py3-none-any.whl.
File metadata
- Download URL: kinetic_cipher-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77840db2018b9c3bdc07eb591aee69e69243322ac31b9471de4d2b5823b6f5c0
|
|
| MD5 |
7153ecfe7a426ef443ae55a9bcc2e9a2
|
|
| BLAKE2b-256 |
1e84cda44a38a1930ba33bde477a68988796e026166c6a6bb7af9984d6df3ce1
|