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.

Metadata

Release files for moat-lib-diffiehellman 0.13.8

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.8
File Size Uploaded
moat_lib_diffiehellman-0.13.8.tar.gz 8.9 kB Details

Built distribution (wheel)

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

Total release size: 17.9 kB

Release files / moat_lib_diffiehellman-0.13.8.tar.gz

Download URL moat_lib_diffiehellman-0.13.8.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8305390c21c038b12bb78d042a10b414e7c97f8f18e09039cec7ac93c0d1f909
BLAKE2b-256 checksum
How to use checksums
0c3db19d02633027811499c282c2dcf6136f4587fe8328c7da2a560edbdbff67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

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

Download URL moat_lib_diffiehellman-0.13.8-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a71a1ac612dabed3111b56d488834c81530a9b60826015f0d8c82bc24c0b562
BLAKE2b-256 checksum
How to use checksums
92c6fed5941515fb69bc288e20f47dd64f12cbac2c2f7f4fbd317349d222d1a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.13.8 This release

2 release files

0.13.7

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