1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

numbertheory.py: make the ModP class hashable.

That will let me keep them in sets.
This commit is contained in:
Simon Tatham 2020-02-28 20:13:46 +00:00
parent 3ee9b92935
commit 7be2e16023

View File

@ -177,3 +177,5 @@ class ModP(object):
return "0x{:x}".format(self.n)
def __repr__(self):
return "{}(0x{:x},0x{:x})".format(type(self).__name__, self.p, self.n)
def __hash__(self):
return hash((type(self).__name__, self.p, self.n))