An open API service indexing awesome lists of open source software.

https://github.com/abdo-essam/diffie-hellman-key-exchange

The code you provided appears to be an implementation of the Diffie-Hellman key exchange protocol between a client and a server. This protocol allows two parties to establish a shared secret key over an insecure channel.
https://github.com/abdo-essam/diffie-hellman-key-exchange

client client-server cryptography diffie-hellman diffie-hellman-algorithm diffie-hellman-key server

Last synced: 3 months ago
JSON representation

The code you provided appears to be an implementation of the Diffie-Hellman key exchange protocol between a client and a server. This protocol allows two parties to establish a shared secret key over an insecure channel.

Awesome Lists containing this project

README

        

# Diffie-Hellman-key-exchange
The code you provided appears to be an implementation of the Diffie-Hellman key exchange protocol between a client and a server. This protocol allows two parties to establish a shared secret key over an insecure channel.

### Client:
1. The client establishes a connection to the server.
2. It sends the values of p, generator, and A (calculated as pow(generator,a) % p) to the server.
3. It receives the server's public key (serverB) and calculates the shared secret key (kab).
4. The client prints the private key (a), the server's public key (serverB), and the shared secret key (kab).
5. The client closes the connection.

### Server:
1. The server listens for incoming connections on port 8088.
2. It accepts the client's connection.
3. The server receives the values of p, generator, and A from the client.
4. The server calculates its own public key (B) as pow(c_generator, server_private) % c_P and sends it back to the client.
5. The server calculates the shared secret key (Kab) using the client's public key (c_Public) and its private key (server_private).
6. The server prints its private key (server_private) and the shared secret key (Kab).
7. The server closes the connection.

#### Note: The code could be further improved by following coding conventions, such as using proper variable naming and separating the client and server code into separate files.