python - python 中 Crypto.Cipher.IDEA 模块中的错误
问题描述
你好呀,
i am writing a code for auto discovery of IP within the network and then
data transfer using the socket programming in python. I have read the RSA
and want to implement in the code. i go through to the link where i got
the code implementation and the whole code for server and client.
Here is the link where the code is:
<https://riptutorial.com/python/example/27170/client-side-implementation>
<https://riptutorial.com/python/example/27169/server-side-implementation>
There are two links and the setup for PyCrypto is.
*PyCrypto (Download Link: https://pypi.python.org/pypi/pycrypto )
*PyCryptoPlus (Download Link: https://github.com/doegox/python-cryptoplus )
我在树莓派上尝试了它并安装了我上面写的所有基本模块,并使用如下命令行运行它:python3 server.py,但它给了我一些与模块相关的错误。
Crypto.Cipher.IDEA isn't available. You're probably using the Debian
pycrypto version. Install the original pycrypto for IDEA.
Traceback (most recent call last):
File "serverRsa.py", line 10, in <module>
from CryptoPlus.Cipher import IDEA
File "/home/pi/.local/lib/python3.5/site-
packages/CryptoPlus/Cipher/IDEA.py", line 4, in <module>
import Crypto.Cipher.IDEA
ImportError: No module named 'Crypto.Cipher.IDEA'
我尝试使用 pip install PyCrypto 并使用 pip3 相同。然后运行相同的代码但发生相同的错误。
Actually problem statement is to auto discover of all the nearby ip's
using the python programming , where i run the code on Raspberry Pi and
make it as a hotspot and other Pi boards act as client. Now when the
server found the client or discover them then it register them using some
key or encryption method.
我只需要使用 RSA 将一些消息传递给客户端的代码,但似乎代码有错误。请任何人解决此问题。
解决方案
如果您真的需要 Python 2 中的 IDEA 密码,并且它很慢(比在 C 中实现的慢得多)对您来说是可以的,这里有一个:https ://pastebin.com/hTn5K3Tx 。像这样使用它:
cb = IDEA('2bd6459f82c5b300952c49104881ff48'.decode('hex'))
plaintext, ciphertext = 'f129a6601ef62a47'.decode('hex'), 'ea024714ad5c4d84'.decode('hex')
assert cb.encrypt(plaintext) == ciphertext
assert cb.decrypt(ciphertext) == plaintext
请注意,IDEA 的最后一项专利于 2012 年到期,现在 IDEA可供公众免费使用。
推荐阅读
- raspberry-pi3 - Adafruit LPD8806m LED灯条防水吗?
- database - 为什么 Liquibase generateChangeLog 会生成一个空的 changelog 文件?
- javascript - 如何将外部 js 文件添加到我的布局页面
- javascript - 使用 Cloudflare Workers 将图像发送到 Telegram
- java - 如何成功导入包含所有依赖项的 AndroidX 包?
- c# - 无法使用 WordPressPCL 和 wp-api-jwt-auth 对 Linux 中托管在 Azure 中的 WordPress 进行身份验证
- performance - 了解 WebPageTest 瀑布
- python - 具有三向决胜局的 Python 高效排序算法
- java - 如何使所有实现特定接口的类都具有相同的构造函数?
- ios - 碰撞处理在 iOS 13 中不起作用