Skip to content

Latest commit

ย 

History

History
68 lines (52 loc) ยท 1.71 KB

File metadata and controls

68 lines (52 loc) ยท 1.71 KB

Encrypted Peer-to-Peer Chat

A simple end-to-end encrypted chat application built in Python using sockets and the cryptography library. This tool allows two users to chat securely over a network using symmetric encryption (Fernet).

๐Ÿ” Features

  • Peer-to-peer encrypted messaging
  • End-to-end symmetric encryption with Fernet
  • Chat history displayed in real time
  • Host or connect modes
  • Simple and minimal codebase (~100 lines)

๐Ÿ› ๏ธ Requirements

  • Python 3.x
  • cryptography library

Install dependencies with:

pip install cryptography

๐Ÿš€ Usage

  1. Clone the repository:
git clone https://github.com/your-username/encrypted-chat.git
cd encrypted-chat
  1. Run the script:
python chat.py
  1. Choose one machine to host the connection (listen), and the other to connect:

On the host:

Hva heter du: Alice
(l)isten eller (c)onnect (l er host, c er kobling mot motpart)? l

On the client:

Hva heter du: Bob
(l)isten eller (c)onnect (l er host, c er kobling mot motpart)? c
Skriv inn IPen til motparten: 192.168.x.x

Once connected, you can begin chatting securely.

๐Ÿ”‘ Encryption Key

Note: This project uses a hardcoded symmetric key:

key = "ab-YPb_Hzm0_eypRz0bG8bLeReGB1guJvQnYiuCxJoE="

In production use, you should:

  • Generate a new key using Fernet.generate_key()
  • Securely exchange or store the key
  • Avoid hardcoding secrets

โš ๏ธ Disclaimer

This is a minimal proof-of-concept chat system meant for educational or personal testing. Do not use this in production or expose it to untrusted networks without further security enhancements.

๐Ÿ“„ License

This project is open-source and available under the MIT License.

Made with โค๏ธ in Python