Skip to content

erihhh6/crypto-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypto Visualizer

CI Python License: MIT

An interactive Python GUI application that makes cryptographic concepts visible and tangible.

Demo


What this visualizes

  • AES Modes — ECB, CBC, CTR, GCM with per-block hex visualization, hover tooltips, and click-to-inspect
  • ECB Penguin Attack — load any BMP image and see why ECB mode is dangerous (structural patterns survive encryption)
  • Key Exchange — Diffie-Hellman (2048-bit, RFC 3526 Group 14) and ECDH (SECP256R1) with step-by-step animation
  • DH vs ECDH size comparison — equivalent security levels at dramatically different key sizes

Why it matters

AES mode selection is one of the most common cryptographic mistakes in real software — ECB mode leaks structure even when the key is strong. Key exchange protocols underpin every TLS connection, SSH session, and secure messaging app. Seeing these algorithms execute step by step, with real cryptographic values, builds the intuition needed to make correct security decisions.


Installation

pip install -r requirements.txt
python main.py

Requires Python 3.10+.


Concepts demonstrated

Concept What the app shows Reference
AES-ECB Identical plaintext blocks produce identical ciphertext blocks NIST FIPS 197 §6.1
AES-CBC Each block XOR'd with previous ciphertext — patterns disappear NIST SP 800-38A
AES-CTR Stream cipher mode; no padding needed; parallelisable NIST SP 800-38A
AES-GCM Authenticated encryption; includes 128-bit integrity tag NIST SP 800-38D
ECB Penguin Attack Encrypting a BMP pixel-by-pixel in ECB preserves visual structure Schneier, Applied Cryptography
Diffie-Hellman Public/private value exchange; shared secret via modular exponentiation RFC 3526
ECDH Same idea on an elliptic curve; much smaller keys for same security RFC 8422
Key size equivalence 256-bit ECDH ≈ 3072-bit DH ≈ 128-bit symmetric security NIST SP 800-57 Table 2

Project structure

crypto-visualizer/
├── main.py                    # Entry point
├── modules/
│   ├── aes_modes.py           # AES ECB/CBC/CTR/GCM + BlockInfo metadata
│   └── key_exchange.py        # DH + ECDH step-by-step + comparison
├── gui/
│   ├── main_window.py         # CustomTkinter window + tab view
│   ├── aes_tab.py             # Block canvas, ECB image demo, comparison panel
│   └── key_exchange_tab.py    # Step animator, matplotlib curve, comparison table
├── assets/
│   └── sample.bmp             # Test image for ECB attack demo
└── requirements.txt

References

About

Interactive Python GUI that visualizes AES modes, ECB attacks, and DH/ECDH key exchange

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages