Move alltlobjects.py and fix imports

This commit is contained in:
Lonami Exo
2021-09-12 16:58:06 +02:00
parent 5fd2a017b2
commit 499fc9f603
32 changed files with 145 additions and 158 deletions

View File

@@ -11,7 +11,7 @@ except ImportError:
rsa = None
raise ImportError('Missing module "rsa", please install via pip.')
from .. import _tl
from .._misc import tlobject
# {fingerprint: (Crypto.PublicKey.RSA._RSAobj, old)} dictionary
@@ -41,8 +41,8 @@ def _compute_fingerprint(key):
:param key: the Crypto.RSA key.
:return: its 8-bytes-long fingerprint.
"""
n = _tl.TLObject.serialize_bytes(get_byte_array(key.n))
e = _tl.TLObject.serialize_bytes(get_byte_array(key.e))
n = tlobject.TLObject.serialize_bytes(get_byte_array(key.n))
e = tlobject.TLObject.serialize_bytes(get_byte_array(key.e))
# Telegram uses the last 8 bytes as the fingerprint
return struct.unpack('<q', sha1(n + e).digest()[-8:])[0]