This project demonstrates a Multi-Prime Diffie-Hellman key exchange protocol, where multiple primes are used instead of a single prime, allowing faster computation and secure key generation. The final shared key can be used for symmetric encryption, such as AES.
- Generate cryptographically secure primes.
- Compute private and public keys for Alice and Bob.
- Compute shared secret keys using multiple primes.
- Compare performance: Multi-Prime vs Single-Prime DH.
- Simulate network key exchange.
- Encrypt and decrypt messages using AES.
- Visual flowchart of the protocol.
- Interactive demo in Colab for experimenting with different number of primes and messages.
- Python 3.x
- Libraries:
sympy,secrets,hashlib,matplotlib,pycryptodome,graphviz,ipywidgets - (All dependencies are installed in the notebook via
!pip install)
- Open the notebook in Google Colab using the badge above.
- Run each cell step by step.
- Explore:
- Prime generation
- Key generation for Alice & Bob
- Shared key computation
- AES message encryption/decryption
- Performance comparison
- Interactive demo (TBA)
- Use the slider to select number of primes (2–15).
- Enter a message to encrypt.
- The notebook will display:
- Final shared key
- Encrypted message (hex)
- Decrypted message
- Whether keys match
- Benchmarks execution time for multi-prime vs single-prime DH.
- Visualized as a bar chart for easier analysis.
This project is open-source. Feel free to use, modify, and share for educational purposes.