Skip to main content

Pure Python Implementation of Diffie-Hellman Key Exchange

Project description

Python package


Pure Python Implementation of Diffie-Hellman Key Exchange. Py2, Py3, PyPy compatible.


To use as a library:

import pyDH
d1 = pyDH.DiffieHellman()
d2 = pyDH.DiffieHellman()
d1_pubkey = d1.gen_public_key()
d2_pubkey = d2.gen_public_key()
d1_sharedkey = d1.gen_shared_key(d2_pubkey)
d2_sharedkey = d2.gen_shared_key(d1_pubkey)
d1_sharedkey == d2_sharedkey

By default it uses the group 14 (2048 bit). To use another group (e.g., 15):

d1 = pyDH.DiffieHellman(15) #or pyDH.DiffieHellman(group=15)


To install pyDH, simply:

$ pip install pyDH

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyDH, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size pyDH-0.1.6-py3-none-any.whl (8.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyDH-0.1.6.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page