A secure, encrypted chat application that enables private communication between two parties using military-grade AES encryption.
This project implements a secure chat application where two users can exchange encrypted messages over a network. All communications are protected using AES-256 encryption with message integrity verification, ensuring conversations remain private and tamper-proof even over untrusted networks.
- 🔒 AES-256 Encryption: Military-grade encryption protects all message content
- 🛡️ Message Integrity: SHA-256 hashes verify messages haven't been tampered with
- ⚡ Real-time Communication: Bidirectional messaging with simultaneous send/receive
- 🕐 Timestamped Messages: Each message includes transmission timestamp
- ✅ Integrity Verification: Visual indicators (☑/☒) show message authenticity
- 🔑 Pre-shared Key Security: Both parties must know the same encryption key
- Server Setup: One person runs the server and waits for connections
- Client Connection: Another person connects using the server's IP and port
- Key Exchange: Both parties enter the same pre-shared encryption key
- Secure Chat: Messages are automatically encrypted before sending and decrypted upon receipt
- Verification: Each message's integrity is verified using SHA-256 hashes
- Python 3.x
pyaesmodule for pure Python AES implementation
# Windows
python -m pip install pyaes
# Linux/macOS
pip install pyaesNote: We chose
pyaesfor its simple, pure Python implementation. Other options likepycrypto(vulnerable and unmaintained) orpycryptodome/pycryptodomexare available, but we prioritized simplicity and security.
git clone https://github.com/centauri1219/AES-chat.git
cd AES-chatpip install pyaespython server.py [optional_port]- Default port: 5555
- Server will wait for client connection
python client.py- Enter server IP address
- Enter server port
- Enter the same encryption key as the server
- Type messages and press Enter to send
- Type
quit()to exit the chat
- Encryption: AES block cipher with 16-byte blocks
- Key Derivation: SHA-256 hash of user-provided key
- Message Format: JSON with timestamp, message, and integrity hash
- Padding: Uses
~characters to pad messages to 16-byte boundaries - Threading: Multi-threaded for simultaneous send/receive operations
- Confidentiality: AES-256 encryption protects message content
- Integrity: SHA-256 hashes detect message tampering
- Authentication: Pre-shared key ensures only authorized parties can communicate
- Server must be started before client attempts connection
- Both parties must use the exact same encryption key
- This is for educational/demonstration purposes
- Consider additional security measures for production use
This project is open source. Feel free to use and modify as needed.

