Skip to content

Commit

Permalink
support for repr(VerifyingKey)
Browse files Browse the repository at this point in the history
for hypothesis, falsifying examples are easier to check and reproduce
when the key can be printed in form that can be put into code
  • Loading branch information
tomato42 committed Oct 26, 2019
1 parent d970ed1 commit 80e4240
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ecdsa/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def __init__(self, _error__please_use_generate=None):
self.default_hashfunc = None
self.pubkey = None

def __repr__(self):
pub_key = self.to_string("compressed")
return "VerifyingKey.from_string({0!r}, {1!r}, {2})".format(
pub_key, self.curve, self.default_hashfunc().name)

@classmethod
def from_public_point(cls, point, curve=NIST192p, hashfunc=sha1):
"""
Expand Down

0 comments on commit 80e4240

Please sign in to comment.