fix: resolve flagged issues in review by Lonami

This commit is contained in:
habcawa 2025-05-21 19:23:09 +02:00
parent 9876cd6e77
commit 003b6aebb8
3 changed files with 5 additions and 3 deletions

View File

@ -776,7 +776,7 @@ class TelegramBaseClient(abc.ABC):
def _tmp_auth_key_callback(self: 'TelegramClient', tmp_auth_key):
"""
Callback from the sender whenever it needed to generate a
new authorization key. This means we are not authorized.
new temporary authorization key. This means we are not authorized.
"""
self.session.tmp_auth_key = tmp_auth_key
self.session.save()

View File

@ -171,7 +171,9 @@ class MTProtoState:
bind = bytes(bind)
assert len(bind) == 40
payload = os.urandom(int(128/8)) + struct.pack('<qii', msg_id, seq_no, len(bind)) + bind
# 128 bit random + msg_id + seq_no + len(bind) + bind
payload = os.urandom(128//8) + struct.pack('<qii', msg_id, seq_no, len(bind)) + bind
# 16-byte alignment
padding = os.urandom(len(payload) % 16)
msg_key = sha1(payload).digest()[4:20]