mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-03-22 02:44:14 +03:00
Avoid defining Python's AES class if libssl's is available
This commit is contained in:
parent
c296459d0a
commit
274e16ac66
|
@ -2,6 +2,12 @@ import os
|
||||||
import pyaes
|
import pyaes
|
||||||
from . import libssl
|
from . import libssl
|
||||||
|
|
||||||
|
|
||||||
|
if libssl.libssl:
|
||||||
|
# Use libssl if available, since it will be faster
|
||||||
|
AES = libssl.AES
|
||||||
|
else:
|
||||||
|
# Fallback to a pure Python implementation
|
||||||
class AES:
|
class AES:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def decrypt_ige(cipher_text, key, iv):
|
def decrypt_ige(cipher_text, key, iv):
|
||||||
|
@ -71,7 +77,3 @@ class AES:
|
||||||
cipher_text.extend(cipher_text_block)
|
cipher_text.extend(cipher_text_block)
|
||||||
|
|
||||||
return bytes(cipher_text)
|
return bytes(cipher_text)
|
||||||
|
|
||||||
# use libssl if available
|
|
||||||
if libssl.libssl:
|
|
||||||
AES = libssl.AES
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user