【问题标题】:error in Crypto.Cipher.IDEA module in pythonpython 中 Crypto.Cipher.IDEA 模块中的错误
【发布时间】:2019-09-02 21:54:02
【问题描述】:

你好,

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服务器.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 将一些消息传递给客户端的代码,但似乎代码有错误。 请任何人解决此问题。

【问题讨论】:

  • 我看到了这个,并安装了相同的,但出现同样的错误 As importerror: No module named IDEA
  • 您到底为什么要使用IDEA,一种已经过时十多年的算法?这与 RSA 有什么关系?这与 IP 发现有什么关系?如果您想通过网络安全地进行通信,请使用 TLS 而不是滚动您自己的破密码。
  • 你好 gilles,我想使用安全性,因为我只需要与我的 pi 板中注册的 ip 进行通信,如果它们没有在我的 pi 板上注册,那么他们就无法与之通信。跨度>

标签: python cryptography rsa


【解决方案1】:

使用pip install pycrypto 安装的标准加密密码现在是 2.6.1 版,由于许可证限制,它不包括 IDEA (Crypto.Cipher.IDEA) 如果您想安装 Crypto.Cipher.IDEA,您必须找到最后用于嵌入此加密密码的 pycrypto-2.0.1(可免费下载),请参阅上面的 pts 评论。然后按照标准程序安装包pycrypto

python setup.py install

如果要为 pyton3 安装 IDEA,会出现问题。

【讨论】:

    【解决方案2】:

    如果您真的需要 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 为free to use for the public

    【讨论】:

      【解决方案3】:

      Crypto.Cipher 没有任何名为:IDEA 的属性。

      import Crypto.Cipher.IDEA #won't work -_-
      

      也许您正在寻找的是 CryptoPlus:

      import CryptoPlus.Cipher.IDEA 
      

      【讨论】:

      • 是的,你是对的,但是当我运行程序时,它显示了这个错误。请查看我上面给出的链接,它的定义类似于 CryptoPlus.Cipher import IDEA
      猜你喜欢
      • 2015-03-12
      • 1970-01-01
      • 1970-01-01
      • 2015-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多