Эх сурвалжийг харах

fix key comparison in src.crypto.Signing

Malte Kraus 8 жил өмнө
parent
commit
37241163b3
1 өөрчлөгдсөн 5 нэмэгдсэн , 2 устгасан
  1. 5 2
      src/crypto.py

+ 5 - 2
src/crypto.py

@@ -51,5 +51,8 @@ class Signing:
             return self.rsa.publickey().exportKey()
 
     def __eq__(self, other: 'Signing'):
-        # TODO: it's possible that the same key has multiple different representations
-        return self.as_bytes() == other.as_bytes()
+        return self.rsa.e == other.rsa.e and self.rsa.n == other.rsa.n
+
+    def __hash__(self):
+        return hash((self.rsa.e, self.rsa.n))
+