From c97e6023c40b01aaf16d99de9996d7dbeb128fd9 Mon Sep 17 00:00:00 2001 From: habcawa <212562656+habcawa@users.noreply.github.com> Date: Tue, 20 May 2025 16:19:09 +0200 Subject: [PATCH] fix(AuthKey): key_id is a signed long, not unsigned --- telethon/crypto/authkey.py | 2 +- telethon/network/mtprotostate.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telethon/crypto/authkey.py b/telethon/crypto/authkey.py index 8475ec17..37f65017 100644 --- a/telethon/crypto/authkey.py +++ b/telethon/crypto/authkey.py @@ -39,7 +39,7 @@ class AuthKey: with BinaryReader(sha1(self._key).digest()) as reader: self.aux_hash = reader.read_long(signed=False) reader.read(4) - self.key_id = reader.read_long(signed=False) + self.key_id = reader.read_long(signed=True) # TODO This doesn't really fit here, it's only used in authentication def calc_new_nonce_hash(self, new_nonce, number): diff --git a/telethon/network/mtprotostate.py b/telethon/network/mtprotostate.py index 49fb7478..0ceaa513 100644 --- a/telethon/network/mtprotostate.py +++ b/telethon/network/mtprotostate.py @@ -144,7 +144,7 @@ class MTProtoState: msg_key = msg_key_large[8:24] aes_key, aes_iv = self._calc_key(self.auth_key.key, msg_key, True) - key_id = struct.pack('