commit facb7bbc0e70420c3a894da255c5ac91628ca070
parent 25089aa9c2076db26b6d48822d59b4a703ef46b8
Author: SomberNight <somber.night@protonmail.com>
Date: Sun, 27 May 2018 03:55:10 +0200
ecc: (minor) use ECPubkey.from_point
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ecc.py b/lib/ecc.py
@@ -179,7 +179,7 @@ class ECPubkey(object):
raise ValueError('recid is {}, but should be 0 <= recid <= 3'.format(recid))
ecdsa_verifying_key = _MyVerifyingKey.from_signature(sig_string, recid, msg_hash, curve=SECP256k1)
ecdsa_point = ecdsa_verifying_key.pubkey.point
- return ECPubkey(point_to_ser(ecdsa_point))
+ return ECPubkey.from_point(ecdsa_point)
@classmethod
def from_signature65(cls, sig: bytes, msg_hash: bytes):
@@ -396,7 +396,7 @@ class ECPrivkey(ECPubkey):
raise Exception('invalid ciphertext: invalid ephemeral pubkey') from e
if not ecdsa.ecdsa.point_is_valid(generator_secp256k1, ecdsa_point.x(), ecdsa_point.y()):
raise Exception('invalid ciphertext: invalid ephemeral pubkey')
- ephemeral_pubkey = ECPubkey(point_to_ser(ecdsa_point))
+ ephemeral_pubkey = ECPubkey.from_point(ecdsa_point)
ecdh_key = (ephemeral_pubkey * self.secret_scalar).get_public_key_bytes(compressed=True)
key = hashlib.sha512(ecdh_key).digest()
iv, key_e, key_m = key[0:16], key[16:32], key[32:]