Comment out MTProto 1.0 implementation · Problem-2/pyrogram@87b2c4b · GitHub
Skip to content

Commit 87b2c4b

Browse files
committed
Comment out MTProto 1.0 implementation
1 parent a3e5ba8 commit 87b2c4b

3 files changed

Lines changed: 47 additions & 47 deletions

File tree

pyrogram/crypto/__init__.py

Lines changed: 1 addition & 1 deletion

pyrogram/crypto/kdf.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from hashlib import sha1, sha256
19+
from hashlib import sha256
2020

2121

22-
class KDF:
23-
def __new__(cls, auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple:
24-
# https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector
25-
x = 0 if outgoing else 8
26-
27-
sha1_a = sha1(msg_key + auth_key[x:x + 32]).digest()
28-
sha1_b = sha1(auth_key[x + 32:x + 48] + msg_key + auth_key[x + 48:x + 64]).digest()
29-
sha1_c = sha1(auth_key[x + 64:x + 96] + msg_key).digest()
30-
sha1_d = sha1(msg_key + auth_key[x + 96:x + 128]).digest()
31-
32-
aes_key = sha1_a[:8] + sha1_b[8:20] + sha1_c[4:16]
33-
aes_iv = sha1_a[8:20] + sha1_b[:8] + sha1_c[16:20] + sha1_d[:8]
34-
35-
return aes_key, aes_iv
22+
# class KDF:
23+
# def __new__(cls, auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple:
24+
# # https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector
25+
# x = 0 if outgoing else 8
26+
#
27+
# sha1_a = sha1(msg_key + auth_key[x:x + 32]).digest()
28+
# sha1_b = sha1(auth_key[x + 32:x + 48] + msg_key + auth_key[x + 48:x + 64]).digest()
29+
# sha1_c = sha1(auth_key[x + 64:x + 96] + msg_key).digest()
30+
# sha1_d = sha1(msg_key + auth_key[x + 96:x + 128]).digest()
31+
#
32+
# aes_key = sha1_a[:8] + sha1_b[8:20] + sha1_c[4:16]
33+
# aes_iv = sha1_a[8:20] + sha1_b[:8] + sha1_c[16:20] + sha1_d[:8]
34+
#
35+
# return aes_key, aes_iv
3636

3737

3838
class KDF2:

pyrogram/session/session.py

Lines changed: 31 additions & 31 deletions

0 commit comments

Comments
 (0)