Ever wondered how encrypted messaging actually works?
SafeChat is a secure terminal-based chat application that puts cryptographic theory into practical use, built as part of my Applied Cryptography Lab project.
SafeChat is a Python-based messaging system that lets users exchange encrypted messages using AES-256. It also includes secure user authentication using PBKDF2 with HMAC-SHA256 and a JSON-based user store.
This project was developed by Kavish Gulati under the guidance of Dr. Gururaj H L, for partial fulfillment of the Applied Cryptography Lab.
-
End-to-End AES-256 Encryption
- Messages are encrypted with a user-defined key before being sent.
- Uses CBC mode with PKCS7 padding for secure message blocks.
-
Secure User Authentication
- Passwords are never stored in plaintext.
- Implements PBKDF2 hashing with per-user salts.
-
Encrypted Logging
- Messages are logged in both plaintext and encrypted formats for educational use.
- The logs are securely deleted when the app is restarted or closed.
-
Modular Design
- All cryptographic operations are abstracted into a utility module for easy understanding and reuse.
- Language: Python 3
- Encryption: AES-256 (CBC)
- Hashing: PBKDF2-HMAC-SHA256
- Data Storage: JSON
- UI: Command-Line Interface (CLI)
pip install -r requirements.txtUsers register with a username and password. Passwords are hashed and salted using PBKDF2 and stored securely.
Launch the server:
python server.pyRun the client app and log in:
python client.pyEach message typed is encrypted on the sender's side and decrypted on the receiver's endβusing the same key derived from the login session.
βββ client.py # Handles user input and message sending/receiving
βββ server.py # Manages multiple client connections
βββ crypto_utils.py # Encryption, decryption, and hashing functions
βββ message_logger.py # Handles encrypted logging and deletion
βββ users.json # Stores user credentials securely (hashed + salted)
- Add a Tkinter or PyQt GUI
- Integrate secure key exchange (e.g., Diffie-Hellman)
- QR code-based login/authentication
- TLS/SSL-based encrypted socket connections
Built with lots of late-night debugging and coffee by Kavish Gulati,
under the supervision of Dr. Gururaj H L.
This project is open-source for learning purposes. Contributions and suggestions are welcome!
Feel free to connect with me on LinkedIn or contribute to the repo!