mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 11:06:39 +00:00
Fix MD5_CHECKSUM_INVALID for small files with custom key/iv (#3024)
Closes #3023.
This commit is contained in:
parent
4b16183d2b
commit
a376faa3a8
@ -606,16 +606,16 @@ class UploadMethods:
|
|||||||
|
|
||||||
pos += len(part)
|
pos += len(part)
|
||||||
|
|
||||||
|
# Encryption part if needed
|
||||||
|
if key and iv:
|
||||||
|
part = AES.encrypt_ige(part, key, iv)
|
||||||
|
|
||||||
if not is_big:
|
if not is_big:
|
||||||
# Bit odd that MD5 is only needed for small files and not
|
# Bit odd that MD5 is only needed for small files and not
|
||||||
# big ones with more chance for corruption, but that's
|
# big ones with more chance for corruption, but that's
|
||||||
# what Telegram wants.
|
# what Telegram wants.
|
||||||
hash_md5.update(part)
|
hash_md5.update(part)
|
||||||
|
|
||||||
# Encryption part if needed
|
|
||||||
if key and iv:
|
|
||||||
part = AES.encrypt_ige(part, key, iv)
|
|
||||||
|
|
||||||
# The SavePartRequest is different depending on whether
|
# The SavePartRequest is different depending on whether
|
||||||
# the file is too large or not (over or less than 10MB)
|
# the file is too large or not (over or less than 10MB)
|
||||||
if is_big:
|
if is_big:
|
||||||
|
Loading…
Reference in New Issue
Block a user