Skip to main content

Diffie-Hellman key exchange

% start synopsis % start main

This is a Python-only version of the Diffie-Hellman key exchange library.

% end synopsis

Features

  • Implements Diffie-Hellman key exchange
  • Pretty fast
  • Adjustable key size
  • Includes primes for groups 5 and 14-18
  • Currently works only with Python 3 (requires ssl). An OpenSSL compatible version is in the works.

% end main

Usage

from moat.lib.diffiehellman import DiffieHellman

alice = DiffieHellman()
bob = DiffieHellman()

alice.generate_public_key()    # automatically generates private key
bob.generate_public_key()

alice.generate_shared_secret(bob.public_key, echo_return_key=True)
bob.generate_shared_secret(alice.public_key, echo_return_key=True)

Code of Misconduct

By using this package, you pledge to use it for good, not for evil. In particular, you pledge never to use this code to limit the human mind or its natural rights, in particular freedom of expression.

Release files for moat-lib-diffiehellman 0.13.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moat-lib-diffiehellman 0.13.7
File Size Uploaded
moat_lib_diffiehellman-0.13.7.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moat-lib-diffiehellman 0.13.7
File Interpreter ABI Platform
moat_lib_diffiehellman-0.13.7-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / moat_lib_diffiehellman-0.13.7.tar.gz

Download URL moat_lib_diffiehellman-0.13.7.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
35f4bf3ec86d54aea5b4feac18c4d776630d904276a9c36032050d67ee0f347f
BLAKE2b-256 checksum
How to use checksums
821243ed269df3e4d4f87d0fb8a52bb5c8a4b994189db146297494b150725047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / moat_lib_diffiehellman-0.13.7-py3-none-any.whl

Download URL moat_lib_diffiehellman-0.13.7-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22ef2bbe697bb9b6429f3da5477177ea72338dc4288b18e706697295c63539c6
BLAKE2b-256 checksum
How to use checksums
2c4f5e7106af5527731b76b9061408d0bb6ed7904219198b74ac9da3e6a2e8bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.13.7 This release

2 release files

0.13.6

2 release files

0.13.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page