cher-nov / cryptg Goto Github PK
View Code? Open in Web Editor NEWOfficial Telethon extension to provide much faster cryptography for Telegram API requests.
Home Page: https://pypi.org/project/cryptg/
License: Creative Commons Zero v1.0 Universal
Official Telethon extension to provide much faster cryptography for Telegram API requests.
Home Page: https://pypi.org/project/cryptg/
License: Creative Commons Zero v1.0 Universal
I made a benchmark with the following results:
Doing 1 iteration(s) with 512.0 KB of data for ed_pyaes
Encrypt took 3.01s (avg 3.01s)
Decrypt took 3.08s (avg 3.08s)
Doing 100 iteration(s) with 512.0 KB of data for ed_cryptg
Encrypt took 1.89s (avg 0.02s)
Decrypt took 3.61s (avg 0.04s)
Doing 100 iteration(s) with 512.0 KB of data for ed_tgcrypto
Encrypt took 0.39s (avg 0.00s)
Decrypt took 0.39s (avg 0.00s)
Doing 20 iteration(s) with 512.0 KB of data for ed_ssl
Encrypt took 2.61s (avg 0.13s)
Decrypt took 2.63s (avg 0.13s)
And from faster to slower, we have:
So, a different implementation may be worth it. Perhaps we can pull-request AES-IGE to rustls
and use that.
See also the conversation that inspired this issue.
during the installation thtrough pip 21.3.1 it fails to build both within and out of a venv
OS: Fedora release 35 (Thirty Five) x8
Kernel: 5.14.20-300.fc35.x86_64
python=3.10.0
wheel in ./.venv/lib/python3.10/site-packages (0.36.2)
Shell: zsh 5.8
tried the isolate flag and testing in a new venv to no avail
the error during building is as follows:
Collecting cryptg
Using cached cryptg-0.2.post4.tar.gz (17 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: cffi>=1.0.0 in ./.venv/lib64/python3.10/site-packages (from cryptg) (1.15.0)
Requirement already satisfied: pycparser in ./.venv/lib/python3.10/site-packages (from cryptg) (2.21)
Building wheels for collected packages: cryptg
Building wheel for cryptg (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: /home/akah2/Apps/git-repos/stickerpicker/.venv/bin/python3 /home/akah2/Apps/git-repos/stickerpicker/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpypxee_wo
cwd: /tmp/pip-install-aeglu93w/cryptg_999d51cf9c094de2bbada40343eef68e
Complete output (23 lines):
Couldn't find 'stdint.h'
Couldn't find 'stddef.h'
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/cryptg
copying cryptg/__init__.py -> build/lib.linux-x86_64-3.10/cryptg
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.10/_tinyaes_with_ige.c'
creating build/temp.linux-x86_64-3.10
building '_tinyaes_with_ige' extension
creating build/temp.linux-x86_64-3.10/build
creating build/temp.linux-x86_64-3.10/build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/share
creating build/temp.linux-x86_64-3.10/share/tiny-AES-c
gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/akah2/Apps/git-repos/stickerpicker/.venv/include -I/usr/include/python3.10 -c build/temp.linux-x86_64-3.10/_tinyaes_with_ige.c -o build/temp.linux-x86_64-3.10/build/temp.linux-x86_64-3.10/_tinyaes_with_ige.o
build/temp.linux-x86_64-3.10/_tinyaes_with_ige.c:50:14: fatal error: pyconfig.h: No such file or directory
50 | # include <pyconfig.h>
| ^~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for cryptg
Failed to build cryptg
ERROR: Could not build wheels for cryptg, which is required to install pyproject.toml-based projects
steps to reproduce:
try to install via pip in linux?
hi,
is there any way to build it for android?
thanks
Hi, i'm trying to build docker image with installing cryptg.
I'm facing a problem that my build size is so huge. ~1.5 GB. This happens after installing cargo
apk add cargo
I'll want use «cryptg» for faster sending media files. Lib helps me very well.
After uninstalling cargo size of my image becomes less as ~1mb.
But after uninstalling «cryptg» doesn't working.
Have u any ideas how i can reduce my build's size without uninstalling cargo package?
Such as Factorizator
, which is also pretty slow. This could be written in C.
On aarch64, ‘pip install cryptg’ builds the wheels from source code and then installs it. It requires the user to have a development environment installed on his system. Also, it takes some time to build the wheels than downloading and extracting the wheels from pypi.
On aarch64, ‘pip install cryptg’ should download the wheels from pypi
@cher-nov, @Team Please let me know your interest in releasing aarch64 wheels. I can help in this.
Cloning https://github.com/cher-nov/cryptg to /tmp/pip-req-build-a9820f6n
Running command git clone --filter=blob:none -q https://github.com/cher-nov/cryptg /tmp/pip-req-build-a9820f6n
Resolved https://github.com/cher-nov/cryptg to commit c274f4abdad9332ee6bde4d89033c87f507e15d1
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /app/.heroku/python/bin/python /app/.heroku/python/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmp7p_1v0lw
cwd: /tmp/pip-req-build-a9820f6n
Complete output (44 lines):
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/app/.heroku/python/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/app/.heroku/python/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
return self._get_build_requires(
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 281, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 61, in <module>
main(sys.argv)
File "setup.py", line 20, in main
setup(
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 154, in setup
_install_setup_requires(attrs)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 143, in _install_setup_requires
dist = MinimalDistribution(attrs)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 135, in __init__
super().__init__(filtered)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 456, in __init__
for ep in metadata.entry_points(group='distutils.setup_keywords'):
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
ordered = sorted(eps, key=by_group)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 996, in <genexpr>
eps = itertools.chain.from_iterable(
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
k = key(element)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 931, in _normalized_name
return self._name_from_stem(stem) or super()._normalized_name
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 600, in _normalized_name
return Prepared.normalize(self.name)
File "/tmp/pip-build-env-4jw7otkj/overlay/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 855, in normalize
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
File "/app/.heroku/python/lib/python3.8/re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
----------------------------------------
WARNING: Discarding git+https://github.com/cher-nov/cryptg. Command errored out with exit status 1: /app/.heroku/python/bin/python /app/.heroku/python/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmp7p_1v0lw Check the logs for full command output.
ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python /app/.heroku/python/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmp7p_1v0lw Check the logs for full command output.
! Push rejected, failed to compile Python app.
! Push failed
Build finished
[Blogs](https://blog.heroku.com/)
[Careers](https://www.heroku.com/careers)
Hi!
cibuildwheel
is ready for Python 3.9 (pypa/cibuildwheel#440 ). Also, I have tested cryptg
on Python 3.9 where it builds well. It would be great if cryptg
can provide with prebuilt wheels for Python 3.9.
Thanks.
That's was really fun to debug. How about to add note about this in docstring?
from cryptg import encrypt_ige
key, iv, text = b'k'*32, b'iv'*16, b't'*16
print(text) # b'tttttttttttttttt'
encrypt_ige(text,key,iv)
print(text) # b'\x8a\xea7\x9d\xabM\xd1cLO\x98\xf4"\x0b\x05b'
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
Info: Linux 4.15.0-135-generic 139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Command: pip3 install cryptg
Traceback:
Collecting cryptg
Using cached https://files.pythonhosted.org/packages/48/0c/ebe7da964655cbae03c369b4da8375eaec8ae51d11212f946355180c15a1/cryptg-0.2.post2-cp36-cp36m-manylinux1_x86_64.whl
Collecting pycparser (from cryptg)
Using cached https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl
Collecting cffi>=1.0.0 (from cryptg)
Using cached https://files.pythonhosted.org/packages/1c/1a/90fa7e7ee05d91d0339ef264bd8c008f57292aba4a91ec512a0bbb379d1d/cffi-1.14.4-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: pycparser, cffi, cryptg
Successfully installed cffi-1.14.4 cryptg-0.2.post2 pycparser-2.20
Segmentation fault (core dumped)
Reported in https://t.me/TelethonChat/300519.
I'm not sure if there's something we can do about this, I'm not familiar with the installation process.
Full error output
pip3 install -U https://github.com/cher-nov/cryptg/archive/master.zip
Collecting https://github.com/cher-nov/cryptg/archive/master.zip
Using cached https://github.com/cher-nov/cryptg/archive/master.zip
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/[email protected]/bin/python3.10 /opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/4x/rsx335ks4gs8xfw9mr4f1ff80000gn/T/tmp3gr810sb
cwd: /private/var/folders/4x/rsx335ks4gs8xfw9mr4f1ff80000gn/T/pip-req-build-fosd0z42
Complete output (64 lines):
running egg_info
creating cryptg.egg-info
writing cryptg.egg-info/PKG-INFO
writing dependency_links to cryptg.egg-info/dependency_links.txt
writing top-level names to cryptg.egg-info/top_level.txt
writing manifest file 'cryptg.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
return self._get_build_requires(
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 61, in <module>
main(sys.argv)
File "setup.py", line 20, in main
setup(
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 299, in run
self.find_sources()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 306, in find_sources
mm.run()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 541, in run
self.add_defaults()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 581, in add_defaults
rcfiles = list(walk_revctrl())
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/sdist.py", line 18, in walk_revctrl
for item in ep.load()(dirname):
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools_scm/integration.py", line 69, in find_files
for ep in iter_entry_points("setuptools_scm.files_command"):
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools_scm/utils.py", line 147, in iter_entry_points
all_eps = entry_points()
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 971, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 429, in load
ordered = sorted(eps, key=by_group)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 968, in <genexpr>
eps = itertools.chain.from_iterable(
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen
k = key(element)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 903, in _normalized_name
return self._name_from_stem(stem) or super()._normalized_name
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 592, in _normalized_name
return Prepared.normalize(self.name)
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/metadata/__init__.py", line 833, in normalize
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
File "/opt/homebrew/Cellar/[email protected]/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/re.py", line 209, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
----------------------------------------
WARNING: Discarding https://github.com/cher-nov/cryptg/archive/master.zip. Command errored out with exit status 1: /opt/homebrew/opt/[email protected]/bin/python3.10 /opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/4x/rsx335ks4gs8xfw9mr4f1ff80000gn/T/tmp3gr810sb Check the logs for full command output.
ERROR: Command errored out with exit status 1: /opt/homebrew/opt/[email protected]/bin/python3.10 /opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/4x/rsx335ks4gs8xfw9mr4f1ff80000gn/T/tmp3gr810sb Check the logs for full command output.
We may want to change a little thing without having a full release (typo somewhere or fixing CI with no code changes) or just conveniently test the workflow without having to push. But I'm no GHA wizard so I don't know how/if this could be done cleanly or we'd need multiple workflows one without the push (even if the middle part is reused).
can you please add calculate_2fa function from grammers crypto?
https://github.com/Lonami/grammers/blob/master/lib/grammers-crypto/src/two_factor_auth.rs#L32
I tried to install this on windows 10 but i got this error:
ERROR: Command errored out with exit status 1:
command: 'c:\users\e\desktop\newfol~2\env\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\e\\AppData\\Local\\Temp\\pip-install-khpqbheh\\cryptg\\setup.py'"'"'; __file__='"'"'C:\\Users\\e\\AppData\\Local\\Temp\\pip-install-khpqbheh\\cryptg\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\e\AppData\Local\Temp\pip-install-khpqbheh\cryptg\pip-egg-info'
cwd: C:\Users\e\AppData\Local\Temp\pip-install-khpqbheh\cryptg\
Complete output (102 lines):
Traceback (most recent call last):
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "C:\Users\e\AppData\Local\Temp\easy_install-mzssp6r5\cffi-1.13.1\setup.py", line 127, in <module>
File "C:\Users\e\AppData\Local\Temp\easy_install-mzssp6r5\cffi-1.13.1\setup.py", line 105, in uses_msvc
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 1075, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 547, in __init__
vc_ver or self._find_latest_available_vs_ver())
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 561, in _find_latest_available_vs_ver
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\e\AppData\Local\Temp\pip-install-khpqbheh\cryptg\setup.py", line 63, in <module>
main(sys.argv)
File "C:\Users\e\AppData\Local\Temp\pip-install-khpqbheh\cryptg\setup.py", line 19, in main
setup(
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\dist.py", line 717, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
dist = best[req.key] = env.best_match(
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
return installer(requirement)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\dist.py", line 787, in fetch_build_egg
return cmd.easy_install(req)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
run_setup(setup_script, args)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
raise
File "c:\users\e\appdata\local\programs\python\python38\Lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "c:\users\e\appdata\local\programs\python\python38\Lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
saved_exc.resume()
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
yield saved
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
yield
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "C:\Users\e\AppData\Local\Temp\easy_install-mzssp6r5\cffi-1.13.1\setup.py", line 127, in <module>
File "C:\Users\e\AppData\Local\Temp\easy_install-mzssp6r5\cffi-1.13.1\setup.py", line 105, in uses_msvc
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\e\appdata\local\programs\python\python38\Lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 1075, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 547, in __init__
vc_ver or self._find_latest_available_vs_ver())
File "c:\users\e\desktop\newfol~2\env\lib\site-packages\setuptools\msvc.py", line 561, in _find_latest_available_vs_ver
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I had the Microsoft Visual C++ 2017 14.12 installed, and I could not install 2015 version because the installer wont allow it unless I uninstall the current version.
So i uninstalled the 2017 and installed the 2015 but I got the same error again!
Exactly what it says on the tin. Right now it's not really possible to build the repo reproducibly as the dependencies aren't locked, which is a pretty big no-no for distribution packaging.
Have been using tgcloud on my old computer (Linux Mint Tricia, x86) for a couple of months. For better experience, decided to install it both on my Xiaomi phone (Termux app) and Lenovo tablet (Linux Deploy app).
However, the normal installation of cryptg through pip install cryptg
failed both times, giving this error log:
Collecting cryptg
Using cached cryptg-0.2.post0.tar.gz (16 kB)
ERROR: Command errored out with exit status 1:
command: /data/data/com.termux/files/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-n729x67v
cwd: /data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/
Complete output (46 lines):
WARNING: The wheel package is not available.
ERROR: Command errored out with exit status 1:
command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-pejbf0zb/cffi/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-pejbf0zb/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /data/data/com.termux/files/usr/tmp/pip-wheel-a82fcu1r
cwd: /data/data/com.termux/files/usr/tmp/pip-wheel-pejbf0zb/cffi/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for cffi
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/installer.py", line 126, in fetch_build_egg
subprocess.check_call(cmd)
File "/data/data/com.termux/files/usr/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmpk0y57itt', '--quiet', 'cffi>=1.0.0']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py", line 63, in <module>
main(sys.argv)
File "/data/data/com.termux/files/usr/tmp/pip-install-q9103x19/cryptg/setup.py", line 19, in main
setup(
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/dist.py", line 673, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 764, in resolve
dist = best[req.key] = env.best_match(
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1061, in obtain
return installer(requirement)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/dist.py", line 732, in fetch_build_egg
return fetch_build_egg(self, req)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmpk0y57itt', '--quiet', 'cffi>=1.0.0']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The upgrading of setuptools (with pip install --upgrade setuptools
) didn't help.
Unfortunately, I'm new to Linux. Thank you very much!
hi,
i am trying to build a general perpose cryptg so it can be imported in any platform and be use anywere, i think i almost got it, but i am getting an error when importing and using it in python using CDLL , the import is fine but when i call the function "encrypt_ige" i get "OSError: exception: access violation reading 0xFFFFFFFFFFFFFFFF"
i could realy use your help.
here is the code:
/// Encrypts the input plain text with the 32 bytes key and IV.
#[no_mangle]
fn encrypt_ige(plain: &[u8], key: &[u8], iv: &[u8]) -> Vec<u8> {
let mut key_array = [0; 32];
key_array.copy_from_slice(key);
let mut iv_array = [0; 32];
iv_array.copy_from_slice(iv);
let cipher = grammers_crypto::encrypt_ige(plain, &key_array, &iv_array);
return cipher;
}
/// Decrypts the input cipher text with the 32 bytes key and IV.
#[no_mangle]
fn decrypt_ige(cipher: &[u8], key: &[u8], iv: &[u8]) -> Vec<u8> {
let mut key_array = [0; 32];
key_array.copy_from_slice(key);
let mut iv_array = [0; 32];
iv_array.copy_from_slice(iv);
let plain = grammers_crypto::decrypt_ige(cipher, &key_array, &iv_array);
return plain;
}
/// Factorizes the pair of primes ``pq`` into ``(p, q)``.
#[no_mangle]
fn factorize_pq_pair(pq: u64) -> (u64, u64) {
grammers_crypto::factorize::factorize(pq)
}
thank you very mush for your help.
Trying to install cryptg
on Azure VM seems to produce the following error when using Python 3.8 (pip
19.3.1):
The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.
This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
3.6 seems to work (pip
9.0.1).
Originally reported in https://t.me/TelethonChat/186930.
Can this be ported to a nodejs native module?
If yes please tell me the steps.
Thankyou.
hi
can't you use allow_threads in these Rust functions? to allow usage of Multiple threads using multiple cores when used by python?
❤️
(i'm using windows now i dont like to download 1 million GB of visual studio things to build wheels).
Add support for Python 3.12
https://docs.python.org/3.11/whatsnew/3.11.html
I've tested the existing GHA workflow. It is broken. I may help fix it.
Another problem is dropping Python 3.6 support or not, as PyO3 has dropped it in v0.16.0. If it can be dropped, we can bump PyO3 to its latest version so that adding Python 3.11 support won't be difficult. I may help with it too.
This is recommended by @Grimler91 in termux/termux-packages#6664 (comment), this would solve the issue of failing installation of cryptg in termux.
thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.