An educational cryptographic system exploring formula-based obfuscation through polynomial mappings and 3D point generation.
PointCrypt is a learning project that implements a novel encryption technique based on:
- Polynomial Formulas - Two independent polynomial functions for data transformation
- Block Shuffling - Deterministic randomization of data blocks using a seed
- Structure Mapping - Encoding block positions for recovery during decryption
- Symmetric Key Exchange - Same seed generates identical shuffling on both sides
SENDER SIDE:
Data → Split into blocks → Shuffle blocks (seed-based)
→ Create point-to-position mapping → Send blocks + encrypted structure
RECEIVER SIDE:
Receive shuffled blocks + encrypted structure → Regenerate same shuffle (same seed)
→ Use mapping to unscramble → Reassemble original data
The security comes from the formulas and the shared seed:
- Without the seed, receiver cannot regenerate the polynomial coefficients
- Without knowing the shuffle order, blocks are meaningless
- Same seed = deterministic, reproducible shuffling
- Different seeds = completely different shuffled patterns each time
✅ Two-Step Polynomial System
- Sequencing formula: Generates input numbers from seed + block_count + data_hash
- Main formula: Cubic polynomial for creating point mappings
✅ Deterministic Block Shuffling
- Seed-based random shuffling (same seed = same shuffle)
- Structure mapping for block recovery
- All operations reversible with correct seed
✅ Interactive Streamlit Dashboard
- Real-time encryption/decryption visualization
- Step-by-step process breakdown
- Side-by-side encryption and decryption views
- Full demo mode with statistics
✅ Modular Architecture
- Core utilities and formulas
- Separate sender and receiver classes
- Clean separation of concerns
- Easy to understand and extend
✅ Comprehensive Testing
- Inline tests in each module
- End-to-end encryption/decryption tests
- Multiple data size testing
- All roundtrip tests passing ✅
PointCrypt/
├── README.md # This file
├── .gitignore # Git ignore rules
├── Makefile # Build and development commands
│
├── core/ # Core cryptographic logic
│ ├── __init__.py
│ ├── utils.py # Hashing and utility functions
│ ├── formulas.py # Sequencing & main polynomial formulas
│ └── blocks.py # Block splitting & reassembly
│
├── sender/ # Sender-side operations
│ ├── __init__.py
│ └── encryptor.py # Encryption orchestration
│
├── receiver/ # Receiver-side operations
│ ├── __init__.py
│ └── decryptor.py # Decryption orchestration
│
├── app/ # Interactive dashboard
│ ├── __init__.py
│ └── streamlit_app.py # Streamlit visualization dashboard
│
└── tests/ # Test suite (expandable)
└── __init__.py
- Python 3.8 or higher
- pip (Python package manager)
# Clone the repository
git clone https://github.com/yourusername/PointCrypt.git
cd PointCrypt
# Create virtual environment (optional but recommended)
python -m venv venv
# Activate virtual environment
# On Linux/Mac:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
# Install dependencies
pip install pycryptodome streamlit plotly pytestThe easiest way to see everything in action:
streamlit run app/streamlit_app.pyOpens at http://localhost:8501 with three tabs:
- 📤 Encrypt - Visualize encryption step-by-step
- 📥 Decrypt - Visualize decryption step-by-step
- 🔄 Full Demo - Side-by-side encryption and decryption
# Test core module
python -m core.utils
python -m core.formulas
python -m core.blocks
# Test sender
python -m sender.encryptor
# Test receiver
python -m receiver.decryptorfrom sender.encryptor import PointCryptEncryptor
from receiver.decryptor import PointCryptDecryptor
# Sender side
encryptor = PointCryptEncryptor(seed="my_secret_key", block_size=4)
encrypted = encryptor.encrypt("HELLO WORLD")
print(f"Encrypted blocks: {encrypted['blocks']}")
# Receiver side (same seed!)
decryptor = PointCryptDecryptor(seed="my_secret_key", block_size=4)
decrypted = decryptor.decrypt(encrypted)
print(f"Decrypted: {decrypted}") # "HELLO WORLD"Data is split into fixed-size blocks (default 4 characters):
"HELLO WORLD" → ["HELL", "O WO", "RLD"]
Generates input numbers based on seed, block_count, and data_hash:
# Inputs: seed="secret", block_count=3, data_hash="..."
# Output: [263, 271, 278] # Deterministic sequenceGenerates unique block positions from the sequence:
# For each input, generates a position via polynomial
f(x) = ax³ + bx² + cx + d (mod 1000000007)
# Coefficients a, b, c, d derived from seedBlocks are shuffled deterministically:
# Original: ["HELL", "O WO", "RLD"]
# Shuffled: ["RLD", "HELL", "O WO"] # Based on seed
# Mapping: {point_0→2, point_1→0, point_2→1}Send:
- Blocks: Shuffled blocks (visible but meaningless without mapping)
- Structure: Point-to-position mapping (encrypted in real systems)
- Metadata: Block count, data hash for verification
Receiver with same seed:
- Regenerates same shuffled order
- Uses mapping to unscramble
- Reassembles blocks in original order
- Gets original data back
Generates a deterministic sequence based on three inputs:
Inputs:
seed- Secret key (e.g., "my_secret")block_count- Number of blocks (e.g., 7)data_hash- SHA3-256 hash of data (e.g., "f2df...")
Process:
- Combine all inputs:
"secret|7|f2df..." - Hash the combination
- Extract starting point and step size
- Generate ascending sequence with variable steps
Output: Array of numbers [263, 271, 278, ...]
Generates point mappings from the sequence:
Polynomial: f(x) = a·x³ + b·x² + c·x + d (mod 1000000007)
Coefficients:
a = (seed_value * 73) XOR block_countb = (seed_value * 97) XOR block_countc = (seed_value * 127) XOR block_countd = (seed_value * 137) XOR block_count
Output: 3D points (x, y, z) for visualization
All components have built-in tests. Run them:
# Run all module tests
python -m core.utils
python -m core.formulas
python -m core.blocks
python -m sender.encryptor
python -m receiver.decryptor
# Expected output: ✅ All tests passed!- ✅ Block splitting and reassembly
- ✅ Sequencing formula generation
- ✅ Polynomial evaluation
- ✅ Block shuffling and mapping
- ✅ Encryption/decryption roundtrips
- ✅ Multiple data sizes (1 char, 11 chars, 1000 chars, 43+ chars)
- ✅ Data integrity verification
This project teaches:
- How obfuscation differs from encryption
- The importance of key management
- Why simple formulas might have vulnerabilities
- Using polynomials for data transformation
- Modular arithmetic in cryptography
- Coordinate system conversions
- Sender-receiver architecture
- Deterministic pseudorandom generation
- State management and synchronization
- Modular code organization
- Clean class hierarchies
- Error handling and validation
- No formal security proof
- Not suitable for real-world encryption
- Designed for learning purposes
- May have theoretical vulnerabilities
Use established libraries like:
cryptography(industry standard)PyCryptodome(for low-level operations)- Post-quantum options (liboqs-python)
Core Logic (formulas, utilities)
↓
Sender (orchestration) ←→ Receiver (orchestration)
↓
Streamlit Dashboard (visualization)
- Core: Pure mathematical operations
- Sender: Encryption workflow only
- Receiver: Decryption workflow only
- App: Visualization and interaction
- Uses only deterministic formulas
- Seed-based shuffling for obfuscation
- Suitable for learning and demonstration
- Add 4D/5D point generation for larger datasets
- Explore different polynomial degrees
- Implement integrity checking (HMAC)
- Add performance benchmarks
- Create attack simulation module
- Support streaming/chunked encryption
- Add formal security analysis
from sender.encryptor import PointCryptEncryptor
encryptor = PointCryptEncryptor(seed="graduation_project", block_size=4)
result = encryptor.encrypt("POINTCRYPT")
print("Shuffled blocks:", result['blocks'])
print("Data hash:", result['data_hash'][:16] + "...")from sender.encryptor import PointCryptEncryptor
from receiver.decryptor import PointCryptDecryptor
seed = "secret_key"
original = "HELLO WORLD"
# Encrypt
encryptor = PointCryptEncryptor(seed=seed)
encrypted = encryptor.encrypt(original)
# Decrypt
decryptor = PointCryptDecryptor(seed=seed)
decrypted = decryptor.decrypt(encrypted)
assert decrypted == original # ✅ Success!# Run the Streamlit app
streamlit run app/streamlit_app.py
# Then interact with:
# - Encrypt tab: Input custom data, see step-by-step visualization
# - Decrypt tab: Decrypt the encrypted data
# - Demo tab: See full process with statistics# Install dependencies
pip install pycryptodome streamlit plotly pytest
# Run interactive dashboard
streamlit run app/streamlit_app.py
# Run core tests
python -m core.utils
python -m core.formulas
python -m core.blocks
# Run sender/receiver tests
python -m sender.encryptor
python -m receiver.decryptor
# Clean cache (Unix/Mac/WSL)
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type d -name .pytest_cache -exec rm -rf {} +- Polynomial cryptography concepts
- Coordinate system transformations
- Modular arithmetic in computer science
- Streamlit documentation: https://docs.streamlit.io/
- PyCryptodome docs: https://pycryptodome.readthedocs.io/
- Language: Python 3.8+
- Core Modules: 3 (utils, formulas, blocks)
- Encryption/Decryption Classes: 2 (Encryptor, Decryptor)
- Dashboard Tabs: 3 (Encrypt, Decrypt, Demo)
- Total Lines of Code: ~2500+
- Test Coverage: All modules included
- Documentation: Comprehensive inline comments
Arnav - Graduation Project
Exploring novel encryption techniques and cryptographic thinking through hands-on implementation.
MIT License - Feel free to use for learning purposes.
This is a learning project. Document your discoveries and improvements as you explore! 🚀
- ✅ Core polynomial formulas
- ✅ Block-based encryption/decryption
- ✅ Deterministic shuffling
- ✅ Interactive Streamlit dashboard
- ✅ All tests passing
- ✅ Comprehensive documentation
Happy learning! 🎓