From 49f2cbe04f1d41d8a62cc6d1981c28109080f574 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 29 Aug 2018 22:04:04 +0200 Subject: [PATCH] Move CURRENT_DH_PRIME into Prime namespace --- pyrogram/crypto/prime.py | 12 ++++++++++++ pyrogram/session/auth.py | 14 +------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pyrogram/crypto/prime.py b/pyrogram/crypto/prime.py index 9338c206..8e9426ca 100644 --- a/pyrogram/crypto/prime.py +++ b/pyrogram/crypto/prime.py @@ -20,6 +20,18 @@ from random import randint class Prime: + CURRENT_DH_PRIME = int( + "C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F" + "48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C37" + "20FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F64" + "2477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4" + "A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754" + "FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4" + "E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F" + "0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B", + 16 + ) + # Recursive variant # @classmethod # def gcd(cls, a: int, b: int) -> int: diff --git a/pyrogram/session/auth.py b/pyrogram/session/auth.py index 2142be59..a545a642 100644 --- a/pyrogram/session/auth.py +++ b/pyrogram/session/auth.py @@ -34,18 +34,6 @@ log = logging.getLogger(__name__) class Auth: MAX_RETRIES = 5 - CURRENT_DH_PRIME = int( - "C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F" - "48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C37" - "20FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F64" - "2477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4" - "A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754" - "FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4" - "E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F" - "0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B", - 16 - ) - def __init__(self, dc_id: int, test_mode: bool, ipv6: bool, proxy: dict): self.dc_id = dc_id self.test_mode = test_mode @@ -220,7 +208,7 @@ class Auth: # Security checks ####################### - assert dh_prime == self.CURRENT_DH_PRIME + assert dh_prime == Prime.CURRENT_DH_PRIME log.debug("DH parameters check: OK") # https://core.telegram.org/mtproto/security_guidelines#g-a-and-g-b-validation