A beautiful, mathematically rigorous implementation of the cascade electromechanical cipher machine ๐โจ
Violet is a sophisticated Python implementation of a cascade electromechanical cipher machineโthe kind of machine that would've made cryptographers in the 20th century absolutely giddy with mathematical joy. It combines rotor-based encryption with stepping-switch mechanisms, all wrapped in a sleek, interactive GUI.
Whether you're interested in cryptography, historical cipher machines, or just want to play with some delightfully purple encryptionโViolet has got you covered! ๐จ
- ๐ Advanced Encryption: Dual-stage cascade mechanism with rotor evolution and independent stepping-switch logic
- ๐ฎ Interactive Studio: Beautiful Tkinter GUI for encrypting/decrypting messages in real-time
- ๐ Statistical Analysis: Deep dive into cipher characteristics and patterns
- ๐งช Rigorous Testing: Comprehensive theorem validation and cryptographic testing
- ๐จ Gorgeous UI: Dark theme with lavender accents that don't hurt your eyes
# Clone the repository
git clone https://github.com/tasmaikeni13/violet.git
cd violet
# Install dependencies
python run.pyThis will automatically check dependencies and install them if needed!
Interactive GUI mode (Violet Studio):
python violet_studio/app.pyRun cryptographic tests:
python violet_core/test_theorems.pyStatistical analysis:
python violet_core/statistical_analysis.pyAuto-launch everything:
python run.pyviolet/
โโโ violet_core/ # ๐ง The heart of the machine
โ โโโ violet_engine.py # Core cipher engine & rotor mechanics
โ โโโ statistical_analysis.py # Cryptographic property analysis
โ โโโ test_theorems.py # Validation & theorem testing
โ โโโ plots/ # Generated analysis visualizations
โโโ violet_studio/ # ๐จ Interactive GUI
โ โโโ app.py # Tkinter-based cipher interface
โโโ docs/ # ๐ Documentation
โ โโโ VIOLET.pdf # Research paper (foundational theory)
โ โโโ how_it_works.html # Detailed technical explanation
โ โโโ screenshots/ # UI screenshots
โโโ requirements.txt # Dependencies (numpy, scipy, matplotlib)
โโโ run.py # Unified launcher script
- numpy - Lightning-fast numerical operations on permutations
- scipy - Statistical computation and analysis
- matplotlib - Beautiful visualization of cipher characteristics
All installed automatically via python run.py ๐
Violet implements the cascade model:
Where:
- ฯ_t = Rotor stage (evolves over Zโโ^r)
- ฯ_t = Stepping-switch stage (evolves over Zโโ ^k)
- Composed through elegant permutation mathematics
Each component works independently yet harmoniously to create a robust cipher. See VIOLET.pdf or how_it_works.html for the full technical deep-dive! ๐
python violet_studio/app.pyThen enjoy the purple paradise of encrypted messages! ๐
Run the comprehensive test suite:
python violet_core/test_theorems.pyThis validates:
- โ Permutation correctness
- โ Rotor stepping mechanics
- โ Switching functions
- โ Cipher composition properties
Generate cryptographic property analysis:
python violet_core/statistical_analysis.pyIncludes:
- Distribution analysis of ciphertext
- Rotor state transitions
- Plugboard configuration validation
- Visualizations saved to
violet_core/plots/
The Violet Studio provides:
- Real-time encryption/decryption with live character-by-character processing
- Configurable machine settings: rotor selection, plugboard swapping, switch positions
- Statistical overlay: view frequency distributions and rotor states
- Export functionality: save encrypted messages and configurations
- Dark theme optimized for extended cryptography sessions
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
You're free to use, modify, and distribute this code in your projects! ๐
Found a bug? Have an idea? Contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-cipher) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-cipher) - Open a Pull Request
- ๐ Research Paper: VIOLET.pdf โ The foundational research paper on which this implementation is based. Start here for the mathematical theory!
- Technical Documentation: how_it_works.html
- Cryptographic Theory: Classic works on electromechanical ciphers
- Source Code: Well-documented and cleanโdive in and explore!
If you find Violet useful or just enjoy parsing permutations, please leave a star! It helps others discover this beautiful cipher machine. ๐
Made with ๐ and a passion for cryptography
"The enemy is listening. Make sure Violet is talking." ๐โจ









