你好,
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 )
我在raspberry pi上尝试了它,并安装了我上面编写的所有基本模块,并使用命令行如下运行它: 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将某些消息传递给客户端的代码或代码,但是代码似乎有错误。 任何人都可以解决此问题。
答案 0 :(得分:0)
Crypto.Cipher没有名为 IDEA 的任何属性。
import Crypto.Cipher.IDEA #won't work -_-
也许您正在寻找的是CryptoPlus:
import CryptoPlus.Cipher.IDEA
答案 1 :(得分:0)
如果您确实需要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。