Skip to content

Commit

Permalink
Merge branch 'pr45': improve unicode support
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Jan 22, 2016
2 parents 9b6b84c + dda9e5b commit 04a383c
Show file tree
Hide file tree
Showing 2 changed files with 538 additions and 62 deletions.
6 changes: 4 additions & 2 deletions ecdsa/ellipticcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@

from __future__ import division

from .six import print_
from .six import print_, python_2_unicode_compatible
from . import numbertheory


@python_2_unicode_compatible
class CurveFp(object):
"""Elliptic Curve over the field of integers modulo a prime."""
def __init__(self, p, a, b):
Expand All @@ -59,6 +59,8 @@ def contains_point(self, x, y):
"""Is the point (x,y) on this curve?"""
return (y * y - (x * x * x + self.__a * x + self.__b)) % self.__p == 0

def __str__(self):
return "CurveFp(p=%d, a=%d, b=%d)" % (self.__p, self.__a, self.__b)

class Point(object):
"""A point on an elliptic curve. Altering x and y is forbidding,
Expand Down
Loading

0 comments on commit 04a383c

Please sign in to comment.