Use autogen code on the authenticator instead hardcoding requests

This commit is contained in:
Lonami Exo
2017-09-28 11:36:51 +02:00
parent 4bedbfe945
commit fe30f63d5d
4 changed files with 125 additions and 156 deletions

View File

@@ -1,4 +1,5 @@
import os
import struct
from hashlib import sha1
try:
import rsa
@@ -37,7 +38,7 @@ def _compute_fingerprint(key):
n = TLObject.serialize_bytes(get_byte_array(key.n))
e = TLObject.serialize_bytes(get_byte_array(key.e))
# Telegram uses the last 8 bytes as the fingerprint
return sha1(n + e).digest()[-8:]
return struct.unpack('<q', sha1(n + e).digest()[-8:])[0]
def add_key(pub):