Skip to main content

Elliptic Curve Utils

Reason this release was yanked:

This version has been discontinued and is no longer supported. Please upgrade to a newer version.

Project description

Elliptic Curve Utils (ecutils)

Documentation Status Latest Version Downloads Downloads Downloads

Elliptic Curve Utils, or ecutils, is a Python package that provides utilities for working with elliptic curves, particularly in the context of cryptography. It includes functionality for operations like point addition and scalar multiplication on curves, as well as higher-level protocols like key exchange and digital signatures.

Features

  • Implements common elliptic curve operations such as point addition and multiplication.
  • Provides classes for encoding/decoding textual messages to and from elliptic curve points (e.g., Koblitz encoding).
  • Supports several standardized elliptic curves including secp192k1, secp256r1, and secp521r1.
  • Includes an implementation of the Elliptic Curve Digital Signature Algorithm (ECDSA) for signing messages and verifying signatures.
  • Features key exchange protocols like Diffie-Hellman and Massey-Omura over elliptic curves.

Installation

You can install the ecutils package using pip:

pip install ecutils

Usage

Encoding and Decoding Messages with Koblitz

from ecutils.algorithms import Koblitz

# Initialize Koblitz with a specific curve
koblitz = Koblitz(curve_name="secp256k1")

# Encode a message to a curve point
point, j = koblitz.encode("Hello, World!")

# Decode the curve point back to a message
decoded_message = Koblitz.decode(point, j)

Digital Signatures with ECDSA

from ecutils.algorithms import DigitalSignature

# Create a DigitalSignature instance with your private key
ds = DigitalSignature(private_key=123456)

# Hash of your message
message_hash = hash('your message')

# Generate signature
r, s = ds.generate_signature(message_hash)

# Verify signature (typically on the receiver's side)
is_valid = ds.verify_signature(ds.public_key, message_hash, r, s)

Diffie-Hellman Key Exchange

from ecutils.protocols import DiffieHellman

# Alice's side
alice = DiffieHellman(private_key=12345)

# Bob's side
bob = DiffieHellman(private_key=67890)

# Alice computes her shared secret with Bob's public key
alice_shared_secret = alice.compute_shared_secret(bob.public_key)

# Bob computes his shared secret with Alice's public key
bob_shared_secret = bob.compute_shared_secret(alice.public_key)

# alice_shared_secret should be equal to bob_shared_secret

Documentation

For more in-depth use and examples, check out the official documentation.

Support

For issues, questions, or contributions, please refer to the project's GitHub repository.

License

This project is licensed under the MIT License.

Don't forget to give this project a star if you find it useful! 🌟

Project details


Download files

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

Source Distribution

ecutils-0.0.1.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecutils-0.0.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file ecutils-0.0.1.tar.gz.

File metadata

  • Download URL: ecutils-0.0.1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for ecutils-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1f0982983cf49d77315b3e1baad229bb9af91b5d92a0f22257c9725b2687d733
MD5 4166b6ea2ef8f6ee0ddb0883e831939e
BLAKE2b-256 2ca3aea0e133fffca956e7d8f47dc3fc23ffab0bfe644789f36541bbe3c30e4a

See more details on using hashes here.

File details

Details for the file ecutils-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ecutils-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for ecutils-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27d45d49d147b784e94be47f9c3f1cc92faac5327cc12591304e3c2a5a2206c1
MD5 476154a00bb008a1afac559adeb5d4cf
BLAKE2b-256 11b84c7fe7c1c555dece72d2913e7ff3a580b94f3577b0fe3c5b2dc8f927a986

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page