This is a Python Implementation of Elliptical Curve Cryptography created as my Final Project for CSC471: Cryptography.
Defines an EllipticCurve object with the following properties and functions:
self.PTATINF: Point at Infinity
__init__(self, a, b, p): Initialize an Elliptic Curve of the form
add_points(self, p1, p2): Returns
scalar_product(self, t, p): Returns
neg(self, point): Returns
get_y_from_x(self, x, pos=False): Returns pos is True, it returns the negative value of
random_point(self): Returns a securely random point along the Elliptic Curve
decompress_public_key(self, pk): "Decompresses" a point using the algorithm found here BitCoin Stack Exchange
is_point(self, p): Returns True if the point is on the curve, False otherwise
assert_point(self, p): assert self.ispoint(p)
Defines an ECDH object that has the following functions:
__init__(self, p, curve): Defines an object capable of participating in Diffie-Helmann key exchanges based on Elliptic Curves.
rand_private(self, bytes=124): Produces a random private key of length bytes
get_shared(self, public): Returns shared key from others public key. Performs scalar multiplication
get_public(self): Returns
Defines a class ECActor to encrypt and decrypt points along an Elliptic Curve
__init__(self, p, ord_p, curve): Creates an actor that uses point curve. Also defines an object self.ecdh=ECDH(p, curve)
get_public(self): Gets the public key of the embedded Elliptic Curve Diffie Helman object
encrypt(self, point, receiver_pub): Encrypts a point using the other actor's public key
decrypt(self, encrypted_output): Decrypts a pair of points containing other actor's public key and their encrypted result
