Git Product home page Git Product logo

tgcrypto's Introduction

TgCrypto

Fast and Portable Cryptography Extension Library for Pyrogram

TgCrypto is a Cryptography Library written in C as a Python extension. It is designed to be portable, fast, easy to install and use. TgCrypto is intended for Pyrogram and implements the cryptographic algorithms Telegram requires, namely:

Requirements

  • Python 3.7 or higher.

Installation

$ pip3 install -U tgcrypto

API

TgCrypto API consists of these six methods:

def ige256_encrypt(data: bytes, key: bytes, iv: bytes) -> bytes: ...
def ige256_decrypt(data: bytes, key: bytes, iv: bytes) -> bytes: ...

def ctr256_encrypt(data: bytes, key: bytes, iv: bytes, state: bytes) -> bytes: ...
def ctr256_decrypt(data: bytes, key: bytes, iv: bytes, state: bytes) -> bytes: ...

def cbc256_encrypt(data: bytes, key: bytes, iv: bytes) -> bytes: ...
def cbc256_decrypt(data: bytes, key: bytes, iv: bytes) -> bytes: ...

Usage

IGE Mode

Note: Data must be padded to match a multiple of the block size (16 bytes).

import os

import tgcrypto

data = os.urandom(10 * 1024 * 1024 + 7)  # 10 MB of random data + 7 bytes to show padding
key = os.urandom(32)  # Random Key
iv = os.urandom(32)  # Random IV

# Pad with zeroes: -7 % 16 = 9
data += bytes(-len(data) % 16)

ige_encrypted = tgcrypto.ige256_encrypt(data, key, iv)
ige_decrypted = tgcrypto.ige256_decrypt(ige_encrypted, key, iv)

print(data == ige_decrypted)  # True

CTR Mode (single chunk)

import os

import tgcrypto

data = os.urandom(10 * 1024 * 1024)  # 10 MB of random data

key = os.urandom(32)  # Random Key

enc_iv = bytearray(os.urandom(16))  # Random IV
dec_iv = enc_iv.copy()  # Keep a copy for decryption

ctr_encrypted = tgcrypto.ctr256_encrypt(data, key, enc_iv, bytes(1))
ctr_decrypted = tgcrypto.ctr256_decrypt(ctr_encrypted, key, dec_iv, bytes(1))

print(data == ctr_decrypted)  # True

CTR Mode (stream)

import os
from io import BytesIO

import tgcrypto

data = BytesIO(os.urandom(10 * 1024 * 1024))  # 10 MB of random data

key = os.urandom(32)  # Random Key

enc_iv = bytearray(os.urandom(16))  # Random IV
dec_iv = enc_iv.copy()  # Keep a copy for decryption

enc_state = bytes(1)  # Encryption state, starts from 0
dec_state = bytes(1)  # Decryption state, starts from 0

encrypted_data = BytesIO()  # Encrypted data buffer
decrypted_data = BytesIO()  # Decrypted data buffer

while True:
    chunk = data.read(1024)

    if not chunk:
        break

    # Write 1K encrypted bytes into the encrypted data buffer
    encrypted_data.write(tgcrypto.ctr256_encrypt(chunk, key, enc_iv, enc_state))

# Reset position. We need to read it now
encrypted_data.seek(0)

while True:
    chunk = encrypted_data.read(1024)

    if not chunk:
        break

    # Write 1K decrypted bytes into the decrypted data buffer
    decrypted_data.write(tgcrypto.ctr256_decrypt(chunk, key, dec_iv, dec_state))

print(data.getvalue() == decrypted_data.getvalue())  # True

CBC Mode

Note: Data must be padded to match a multiple of the block size (16 bytes).

import os

import tgcrypto

data = os.urandom(10 * 1024 * 1024 + 7)  # 10 MB of random data + 7 bytes to show padding
key = os.urandom(32)  # Random Key

enc_iv = bytearray(os.urandom(16))  # Random IV
dec_iv = enc_iv.copy()  # Keep a copy for decryption

# Pad with zeroes: -7 % 16 = 9
data += bytes(-len(data) % 16)

cbc_encrypted = tgcrypto.cbc256_encrypt(data, key, enc_iv)
cbc_decrypted = tgcrypto.cbc256_decrypt(cbc_encrypted, key, dec_iv)

print(data == cbc_decrypted)  # True

Testing

  1. Clone this repository: git clone https://github.com/pyrogram/tgcrypto.
  2. Enter the directory: cd tgcrypto.
  3. Install tox: pip3 install tox
  4. Run tests: tox.

License

LGPLv3+ © 2017-present Dan

tgcrypto's People

Contributors

delivrance avatar mendelmaleh avatar wirtos avatar yoilyl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tgcrypto's Issues

Whl file incompatible with armv6l

I get an "Illegal instruction" error with v1.2.3 on a RPi 1 b (armv6l). This error goes away if I install from source and get pip to compile for me (with --no-binary).

Edit: It only seems to be an issue with Python 3.7 and 3.9. The others are ok:

Y - 3.10.1
Y - 3.6.8
N - 3.7.9
Y - 3.8.9
N - 3.9.9

error: Microsoft Visual C++ 14.0 is required

when i want to install TgCrypto on windows 10...i see this error and it can't be install...
details of error:

Collecting TgCrypto==1.2.0
Using cached https://files.pythonhosted.org/packages/30/e6/65b15e0e6013c232f6236b70bf968c2bbc74c26fbb31ad3378d67cba3498/TgCrypto-1.2.0.tar.gz
Installing collected packages: TgCrypto
Running setup.py install for TgCrypto: started
Running setup.py install for TgCrypto: finished with status 'error'
Complete output from command D:\Projects\Python\SNPgram\venv\Scripts\python.exe -u -c "import setuptools, tokenize;file='C:\Users\saied\AppData\Local\Temp\pycharm-packaging\TgCrypto\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-record-qakbdd9q\install-record.txt --single-version-externally-managed --compile --install-headers D:\Projects\Python\SNPgram\venv\include\site\python3.8\TgCrypto:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\tests
copying tests_init_.py -> build\lib.win-amd64-3.8\tests
creating build\lib.win-amd64-3.8\tests\cbc
copying tests\cbc\test_cbc.py -> build\lib.win-amd64-3.8\tests\cbc
copying tests\cbc_init_.py -> build\lib.win-amd64-3.8\tests\cbc
creating build\lib.win-amd64-3.8\tests\ctr
copying tests\ctr\test_ctr.py -> build\lib.win-amd64-3.8\tests\ctr
copying tests\ctr_init_.py -> build\lib.win-amd64-3.8\tests\ctr
creating build\lib.win-amd64-3.8\tests\ige
copying tests\ige\test_ige.py -> build\lib.win-amd64-3.8\tests\ige
copying tests\ige_init_.py -> build\lib.win-amd64-3.8\tests\ige
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building 'tgcrypto' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

and when i install visual c++ 14.0 ... This error still exists...

bug filter

i want to filter one channel from many channels in my account and i found i can do this with custom filters... .
my custom filter look like this:

func(client, message):
if message.chat.id == -xxxxxxxxxxxx:
return True
f = Filters.create(func)

but my filter working for all messages of this channel, no "new incoming messages"
i want Filter "just new incoming post"
now how i can fix it ?

ctr128_encrypt support?

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

There is no input validation whatsoever

Just a few of the segfaults that are trivially achieved:

$ python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt()'
[1]    69091 segmentation fault  python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt()'
$ python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt("", "", "")'
[1]    69121 segmentation fault  python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt("", "", "")'
$ python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt("x"*32, "x"*32, "x"*32)'
[1]    69153 segmentation fault  python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt("x"*32, "x"*32, "x"*32)'
$ python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt("x"*64, "x"*32, "x"*32)'
[1]    69184 segmentation fault  python3 -c 'import tgcrypto; tgcrypto.ige256_encrypt("x"*64, "x"*32, "x"*32)'
$ python3 -c 'import os, tgcrypto; tgcrypto.ige256_encrypt(os.urandom(32), os.urandom(32), os.urandom(32))'
$ python3 -c 'import os, tgcrypto; tgcrypto.ige256_encrypt(os.urandom(32), os.urandom(32), os.urandom(32), "")'
[1]    69231 segmentation fault  python3 -c
$ python3 -c 'import os, tgcrypto; tgcrypto.ige256_encrypt(os.urandom(32), os.urandom(32))'
[1]    69262 segmentation fault  python3 -c

I don't even understand how it's possible to segfault with 'x'*32 for every input. There's clearly some major issues here.

cryptography is the standard choice for cryptography in python. If you must use your own hand-written AES implementation (please, please don't) then at least take a page from cryptography's book and use cffi for calling from python into not-python.

Version 1.2.1 doesn't work with docker alpine image

Using python:3.6-alpine image and getting the following behavior when attempting to install latest TgCrypto

pip install TgCrypto==1.2.1
ERROR: Could not find a version that satisfies the requirement TgCrypto==1.2.1 (from versions: 0.0.1b1, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.1, 1.2.0)
ERROR: No matching distribution found for TgCrypto==1.2.1

So I can only use TgCrypto 1.2.0 instead.

ctr256_encrypt and ctr256_decrypt usage examples

Sample code to create core dump in 'example.py'

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

ctr_encrypted = tgcrypto.ctr256_encrypt(data, key, iv)
ctr_decrypted = tgcrypto.ctr256_decrypt(ctr_encrypted, key, iv)

print(data == ctr_decrypted)

Running the code:

$ python3 example.py
Segmentation fault (core dumped)

Change the "ctr" to "ige" and all works as expected.

How can i hook encryption methods?

I need to hook encryption/decryption methods to get some keys. How can i do that? i found out that i need modify some .c and .h files, but even if i do that i don't know how to build it myself. I've installed build tools, but i still have this error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
What should i do?

Arm support inconsistent

Hi,

I'm using a Raspberry Pi 3 Model B with pyenv to manage my Python versions. I can install your package with Python 3.5.4 and get this file installed:

~/.pyenv/versions/3.5.4/lib/python3.5/site-packages/tgcrypto.cpython-35m-arm-linux-gnueabihf.so

However, when I change to using Python 3.6.6 I get this:

~/.pyenv/versions/3.6.6/lib/python3.6/site-packages/tgcrypto.cpython-36m.so

Obviously as the filename is different I can't load the module in Python.

aarch64 musl wheel

Could you please add a pre-built wheel for aarch64 musl?

I'm running some scripts on a Raspberry Pi in an alpine container, so I end up having to

apk add --no-cache gcc musl-dev
pip install --no-cache-dir tgcrypto
apk del gcc musl-dev

every time, which is kinda slow.

I tried figuring out how to do it myself so that I can open a PR, but didn't manage to. Hence, the issue.

Thanks in advance!

Wheels for Python 3.10

Python 3.10.0 was released on 2021-10-04, it's the current stable release of Python.

When I was installing tgcrypto on Windows, I got the error, and then realized that it's because there is no wheel for Python 3.10 yet. and installing the dependencies requires Visual Studio Installer which is too heavy for me. For now I've workaround it by switching to Python 3.9.7

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads

Release/Tag missing for TgCrypto 1.2.1

Would it be possible to create the release/tag for 1.2.1? I am trying to build tgcrypto for conda-forge and that process requires a download of either the sdist from pypi or the source archive from github.

Please upload wheels for Python 3.12

Python 3.12 has released recently.

On systems without an C complier installed,
installing TgCrypto will raise an error:

(test) root@docker:/# pip install TgCrypto
Collecting TgCrypto
  Downloading TgCrypto-1.2.5.tar.gz (37 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: TgCrypto
  Building wheel for TgCrypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for TgCrypto (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/tests
      copying tests/__init__.py -> build/lib.linux-x86_64-cpython-312/tests
      creating build/lib.linux-x86_64-cpython-312/tests/cbc
      copying tests/cbc/__init__.py -> build/lib.linux-x86_64-cpython-312/tests/cbc
      copying tests/cbc/test_cbc.py -> build/lib.linux-x86_64-cpython-312/tests/cbc
      creating build/lib.linux-x86_64-cpython-312/tests/ige
      copying tests/ige/test_ige.py -> build/lib.linux-x86_64-cpython-312/tests/ige
      copying tests/ige/__init__.py -> build/lib.linux-x86_64-cpython-312/tests/ige
      creating build/lib.linux-x86_64-cpython-312/tests/ctr
      copying tests/ctr/__init__.py -> build/lib.linux-x86_64-cpython-312/tests/ctr
      copying tests/ctr/test_ctr.py -> build/lib.linux-x86_64-cpython-312/tests/ctr
      running build_ext
      building 'tgcrypto' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/tgcrypto
      gcc -pthread -B /opt/conda/envs/test/compiler_compat -fno-strict-overflow -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /opt/conda/envs/test/include -fPIC -O2 -isystem /opt/conda/envs/test/include -fPIC -I/opt/conda/envs/test/include/python3.12 -c tgcrypto/aes256.c -o build/temp.linux-x86_64-cpython-312/tgcrypto/aes256.o
      error: command 'gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for TgCrypto
Failed to build TgCrypto
ERROR: Could not build wheels for TgCrypto, which is required to install pyproject.toml-based projects
(test) root@docker:/#

I have built some wheels with a development environment, but it would be better to install them directly from PyPI. Thanks.

Wheel building fails on Python 3.12 stable

Unable to install on Python 3.12, missing pre-built wheel for this version, Visual Studio 2022 and vcredist are installed on the PC so the problem is on TgCrypto

Collecting TgCrypto
  Using cached TgCrypto-1.2.5.tar.gz (37 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: TgCrypto
  Building wheel for TgCrypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for TgCrypto (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\tests
      copying tests\__init__.py -> build\lib.win-amd64-cpython-312\tests
      creating build\lib.win-amd64-cpython-312\tests\cbc
      copying tests\cbc\test_cbc.py -> build\lib.win-amd64-cpython-312\tests\cbc
      copying tests\cbc\__init__.py -> build\lib.win-amd64-cpython-312\tests\cbc
      creating build\lib.win-amd64-cpython-312\tests\ctr
      copying tests\ctr\test_ctr.py -> build\lib.win-amd64-cpython-312\tests\ctr
      copying tests\ctr\__init__.py -> build\lib.win-amd64-cpython-312\tests\ctr
      creating build\lib.win-amd64-cpython-312\tests\ige
      copying tests\ige\test_ige.py -> build\lib.win-amd64-cpython-312\tests\ige
      copying tests\ige\__init__.py -> build\lib.win-amd64-cpython-312\tests\ige
      running build_ext
      building 'tgcrypto' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for TgCrypto
Failed to build TgCrypto
ERROR: Could not build wheels for TgCrypto, which is required to install pyproject.toml-based projects

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

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

Add wheels for Python 3.9

Hello!

Python 3.9 released on October 5th.

It would be cool if we could install TgCrypto from wheels. :-)
Especially, this is useful for Windows users, as it is pretty common not to have a compiler installed, as it is quite bulky. 😿

At the moment. TgCrypto has wheels for Python versions from 3.5 to 3.8.

Please, let me know if I can help you with this somehow!

my session file not update when i join to new channel or create a own channel

963-ERROR-[400 PEER_ID_INVALID]: The id/access_hash combination is invalid
Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1688, in resolve_peer
return self.storage.get_peer_by_id(peer_id)
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/storage/sqlite_storage.py", line 108, in get_peer_by_id
raise KeyError("ID not found: {}".format(peer_id))
KeyError: 'ID not found: -1001334270831'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1711, in resolve_peer
return self.storage.get_peer_by_phone_number(peer_id)
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/storage/sqlite_storage.py", line 133, in get_peer_by_phone_number
raise KeyError("Phone number not found: {}".format(phone_number))
KeyError: 'Phone number not found: -1001334270831'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/ext/dispatcher.py", line 205, in update_worker
handler.callback(self.client, *args)
File "/mnt/f/venv_u/Pars_projects/copy_boy/Cli_copy_bot/on_server2/cli_copy_bot.py", line 1251, in bbcpersian
parse_mode="markdown"
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/methods/messages/send_photo.py", line 158, in send_photo
peer=self.resolve_peer(chat_id),
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1713, in resolve_peer
raise PeerIdInvalid
pyrogram.errors.exceptions.bad_request_400.PeerIdInvalid: [400 PEER_ID_INVALID]: The id/access_hash combination is invalid
963-ERROR-[400 MESSAGE_TOO_LONG]: The message text is over 4096 characters (caused by "messages.SendMessage")
Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/ext/dispatcher.py", line 205, in update_worker
handler.callback(self.client, *args)
File "/mnt/f/venv_u/Pars_projects/copy_boy/Cli_copy_bot/on_server2/cli_copy_bot.py", line 1074, in Tasnimnews
app.send_message(chat_id=main_user,text=str(message))
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/methods/messages/send_message.py", line 131, in send_message
entities=entities
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1410, in send
r = self.session.send(data, retries, timeout)
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/session/session.py", line 439, in send
return self._send(data, timeout=timeout)
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/session/session.py", line 426, in _send
RPCError.raise_it(result, type(data))
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/errors/rpc_error.py", line 84, in raise_it
is_unknown=False)
pyrogram.errors.exceptions.bad_request_400.MessageTooLong: [400 MESSAGE_TOO_LONG]: The message text is over 4096 characters (caused by "messages.SendMessage")
963-ERROR-[400 PEER_ID_INVALID]: The id/access_hash combination is invalid
Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1688, in resolve_peer
return self.storage.get_peer_by_id(peer_id)
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/storage/sqlite_storage.py", line 108, in get_peer_by_id
raise KeyError("ID not found: {}".format(peer_id))
KeyError: 'ID not found: -1001461237221'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1711, in resolve_peer
return self.storage.get_peer_by_phone_number(peer_id)
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/storage/sqlite_storage.py", line 133, in get_peer_by_phone_number
raise KeyError("Phone number not found: {}".format(phone_number))
KeyError: 'Phone number not found: -1001461237221'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/ext/dispatcher.py", line 205, in update_worker
handler.callback(self.client, *args)
File "/mnt/f/venv_u/Pars_projects/copy_boy/Cli_copy_bot/on_server2/cli_copy_bot.py", line 729, in visamondial
file_ref=File_ref
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/methods/messages/send_photo.py", line 158, in send_photo
peer=self.resolve_peer(chat_id),
File "/home/u/.local/lib/python3.6/site-packages/pyrogram/client/client.py", line 1713, in resolve_peer
raise PeerIdInvalid
pyrogram.errors.exceptions.bad_request_400.PeerIdInvalid: [400 PEER_ID_INVALID]: The id/access_hash combination is invalid

what is best way to handle this problem...?
Please, I really need the answer to this question.

Documentation needs updating for v1.1.1

I've noticed that things have changed in v1.1.1 compared to v1.0.4.

  • ctr_encrypt -> ctr256_encrypt
  • ctr_decrypt -> ctr256_decrypt
  • ige_encrypt -> ige256_encrypt
  • ige_decrypt -> ige256_decrypt

The documentation needs updating to reflect the recent changes.
Also, the image url's used on the README are wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.