mtproto v57.3.0-beta MTProto.Math
Summary
Functions
Just number & 1
BXOR for binaries, for making new server_salt in Crypto.make_server_salt/2
Just number bor 1
Checks generated message_id with the current one
Decomposes pq into prime factors such that p < q
Computes random 2048-bit number a (using a sufficient amount of entropy)
auth_key := pow(g_a, b) mod dh_prime;
Computes random 2048-bit number b (using a sufficient amount of entropy)
g_b := pow(g, b) mod dh_prime;
key := pow(g_b, a) mod dh_prime; for client A key := pow(g_a, b) mod dh_prime; for client B
Creates more complex message_id value, to use in TL protocol
Creates simple message_id value, to use in DH key exchange
Functions
Decomposes pq into prime factors such that p < q
https://core.telegram.org/mtproto/auth_key#proof-of-work (3)
Computes random 2048-bit number a (using a sufficient amount of entropy)
https://core.telegram.org/api/end-to-end#sending-a-request
auth_key := pow(g_a, b) mod dh_prime;
https://core.telegram.org/mtproto/auth_key#presenting-proof-of-work-server-authentication (7)
Computes random 2048-bit number b (using a sufficient amount of entropy)
https://core.telegram.org/mtproto/auth_key#presenting-proof-of-work-server-authentication (6)
g_b := pow(g, b) mod dh_prime;
https://core.telegram.org/mtproto/auth_key#presenting-proof-of-work-server-authentication (6)
key := pow(g_b, a) mod dh_prime; for client A key := pow(g_a, b) mod dh_prime; for client B
https://core.telegram.org/api/end-to-end#accepting-a-request