-2

Hello there,

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 )

i tried it on raspberry pi and install all the essential modules which i wrote above, and run it using the command line as follows: python3 server.py but it gives me some module related errors.

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'

i tried it using the pip install PyCrypto and using the same with pip3. and then run the same code but same error occurred.

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.

i just need or code that passes some message to client using RSA but it seems the code have error. Anyone please fix this issue.

  • Take a look at this: https://stackoverflow.com/questions/51824628/modulenotfounderror-no-module-named-crypto-error/51824838#51824838 – NoorJafri Apr 12 '19 at 08:02
  • i seen this , and install the same , but the same error occurs As importerror: No module named IDEA – Gaurav Sharma Apr 12 '19 at 09:09
  • Why on earth do you want to use IDEA, an algorithm that's been obsolete for over a decade? What does this have to do with RSA? What does this have to do with IP discovery? If you want to communicate securely over a network, use TLS instead of rolling your own broken cryptography. – Gilles 'SO- stop being evil' Apr 14 '19 at 20:56
  • hello gilles, i want to use security because i need to communicate only with the registered ip's within my pi boards if they are not registerd in my pi boards then they can't communicate with it. – Gaurav Sharma Apr 15 '19 at 06:57

3 Answers3

0

Crypto.Cipher doesn't have any attribute named: IDEA.

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

Maybe what you are looking for is CryptoPlus:

import CryptoPlus.Cipher.IDEA 
NoorJafri
  • 1,787
  • 16
  • 27
  • yes you are right but when i run the program it shows me this error. please see the link which i given above in which it is defined like from CryptoPlus.Cipher import IDEA – Gaurav Sharma Apr 12 '19 at 09:38
0

If you really need an IDEA cipher in Python 2, and it's OK for you that it's slow (much slower than if it was implemented in C), there is one here: https://pastebin.com/hTn5K3Tx . Use it like this:

cb = IDEA('2bd6459f82c5b300952c49104881ff48'.decode('hex'))
plaintext, ciphertext = 'f129a6601ef62a47'.decode('hex'), 'ea024714ad5c4d84'.decode('hex')
assert cb.encrypt(plaintext) == ciphertext
assert cb.decrypt(ciphertext) == plaintext

Please note that the last patent on IDEA expired in 2012, and now IDEA is free to use for the public.

pts
  • 80,836
  • 20
  • 110
  • 183
0

Standard Crypto Ciphers installed with pip install pycrypto now is version 2.6.1 and because of license restrictions it doesn't include IDEA (Crypto.Cipher.IDEA) If you want to install Crypto.Cipher.IDEA you must find pycrypto-2.0.1 (freely available for download) which was last used to embedded this crypto cipher see pts comment above. Then follow the standard procedure to install the package pycrypto

python setup.py install

Problem appear if want to install IDEA for pyton3.

tedy58
  • 71
  • 1
  • 5