Skip to content

Commit 39b66b5

Browse files
committed
Remove salt assertion
1 parent d1d789b commit 39b66b5

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

pyrogram/crypto/mtproto.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ def pack(message: Message, salt: int, session_id: bytes, auth_key: bytes, auth_k
4040
return auth_key_id + msg_key + AES.ige256_encrypt(data + padding, aes_key, aes_iv)
4141

4242
@staticmethod
43-
def unpack(b: BytesIO, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message:
43+
def unpack(b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message:
4444
assert b.read(8) == auth_key_id, b.getvalue()
4545

4646
msg_key = b.read(16)
4747
aes_key, aes_iv = KDF(auth_key, msg_key, False)
4848
data = BytesIO(AES.ige256_decrypt(b.read(), aes_key, aes_iv))
49-
50-
assert data.read(8) == Long(salt) or Long(salt) == Long(MTProto.INITIAL_SALT)
49+
data.read(8)
5150

5251
# https://core.telegram.org/mtproto/security_guidelines#checking-session-id
5352
assert data.read(8) == session_id

pyrogram/session/session.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ async def net_worker(self):
219219
try:
220220
data = MTProto.unpack(
221221
BytesIO(packet),
222-
self.current_salt.salt,
223222
self.session_id,
224223
self.auth_key,
225224
self.auth_key_id

0 commit comments

Comments
 (0)