From c13164f5cfe878057e8ceb77d5abfda495d2b8d2 Mon Sep 17 00:00:00 2001 From: Hasan Date: Sun, 18 Jun 2017 17:38:14 -0400 Subject: [PATCH] Use the correct amount of random bytes in DH request The official documentation says a 2048 *bit* number. `os.urandom` takes an argument that represents the number of *bytes*. 2048 bits is 256 bytes --- telethon/network/authenticator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/network/authenticator.py b/telethon/network/authenticator.py index d13dfc9a..52971ffb 100644 --- a/telethon/network/authenticator.py +++ b/telethon/network/authenticator.py @@ -148,7 +148,7 @@ def do_authentication(transport): server_time = dh_inner_data_reader.read_int() time_offset = server_time - int(time.time()) - b = get_int(os.urandom(2048), signed=False) + b = get_int(os.urandom(256), signed=False) gb = pow(g, b, dh_prime) gab = pow(ga, b, dh_prime)