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

AttributeError: module 'tgcrypto' has no attribute 'ige_encrypt' #2

Closed matiniamirhossein closed 5 years ago

matiniamirhossein commented 5 years ago

Hello, Using the same code as in README, we are getting this error: AttributeError: module 'tgcrypto' has no attribute 'ige_encrypt' This also stands for other methods: AttributeError: module 'tgcrypto' has no attribute 'ige_decrypt'

Issue happens on the latest version: 1.1.1 Solved via these commands:

pip3 uninstall pyrogram
pip3 install 'tgcrypto<1.1.1'

Code:

import os
import tgcrypto

data = os.urandom(10 * 1024 * 1024)  # 10 MB of random data
key = os.urandom(32)  # Random Key
iv = os.urandom(32)  # Random IV

ige_encrypted = tgcrypto.ige_encrypt(data, key, iv)
ige_decrypted = tgcrypto.ige_decrypt(ige_encrypted, key, iv)

assert data == ige_decrypted
delivrance commented 5 years ago

@matiniamirhossein Hi! I've updated tgcrypto literally minutes ago, but the readme is currently in a misleading state. The correct method names are now ige256_encrypt/decrypt and ctr256_encrypt/decrypt.

I'll update the readme asap.

matiniamirhossein commented 5 years ago

@delivrance Thanks. But I think they should be deprecated for a while then removed. A lot of source codes does not work now when installing.

delivrance commented 5 years ago

@matiniamirhossein You are right about the deprecation thing, but I planned to update Pyrogram too (which I did already) and you are supposed to use the latest version! I think you just stumbled on this while I was busy upgrading, which took longer than usual.