Skip to content

Instantly share code, notes, and snippets.

@marcos-inja
Created February 25, 2023 07:28
Show Gist options
  • Save marcos-inja/67b3b4fd48a3e109990f265c27434f3b to your computer and use it in GitHub Desktop.
Save marcos-inja/67b3b4fd48a3e109990f265c27434f3b to your computer and use it in GitHub Desktop.
Basic implementation of Diffie-Hellman key exchange algorithm using python
a = 1
b = 3
n = 97
g = 5
x = (g**a) % n
y = (g**b) % n
k1 = (y**a) % n
k2 = (x**b) % n
print(k1)
print(k2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment