https://github.com/adridevelopsthings/diffie-hellman-golang
A diffie-hellman socket implementation in golang.
https://github.com/adridevelopsthings/diffie-hellman-golang
diffie-helman go
Last synced: about 1 year ago
JSON representation
A diffie-hellman socket implementation in golang.
- Host: GitHub
- URL: https://github.com/adridevelopsthings/diffie-hellman-golang
- Owner: AdriDevelopsThings
- License: gpl-3.0
- Created: 2022-01-30T14:21:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-22T17:47:11.000Z (over 3 years ago)
- Last Synced: 2025-02-10T21:53:10.303Z (over 1 year ago)
- Topics: diffie-helman, go
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# diffie-hellman-golang
I tried to implement the diffie hellman key exchange in golang with the use of sockets to understand how this protocol works and to learn golang. So its a development project: obviously don't use it in production.
## Installation
Run ``go get`` to download the needed dependencies.
## Run
Run this with ``go run .``
You need to set the following command arguments:
| Name | Help |
| --------------- | ------------------------------------------- |
| -m or --mode | mode of diffie hellman `server` or `client` |
| -a or --address | the listen address or address of the server |
## How it works
After the connection between the server and client is established the client will generate the public numbers p and g. p is a primnumber and g is lower than p. The client also generates/calculates his secret `s` and public key. The secret is smaller than p and the public key is g ^ s mod p. After the server received the public information he generates/calculates his secret and public key as well. He sends his public key to the client and the client sends his back. Both sides calculate the shared secret: The public key of the other partner ^ the own secret `s` mod p. The clients generated a shared secret asymmetricaly.