pyrogram / tgcrypto

Fast and Portable Cryptography Extension Library for Pyrogram
https://pyrogram.org
GNU Lesser General Public License v3.0
175 stars 41 forks source link

ctr128_encrypt support? #30

Closed titov-vv closed 1 year ago

titov-vv commented 1 year ago

Would it be possible to add support of CRYPTO_ctr128_encrypt() that is used in Telegram storage encryption?

titov-vv commented 1 year ago

Ok, it works with simple code below so no need to make something more.

from Crypto.Cipher import AES

cipher = AES.new(key, AES.MODE_CTR, initial_value=iiv, nonce=b'')
decrypted_data = cipher.encrypt(data)