-1

I am having an error in my Python code, basically I need to import the package Crypto and I have tried to download it, it says that the package crypto has been installed then keeps showing the same error. I have tried to rename the package from crypto to Crypto but it shows again the same error. Can you please help me how to solve this error or is there any alternative package. Thank you

I tried to import DES and RSA from the cryto library but I can not properly download the package Crypto.

edit: I tried to install from the terminal: pip install Crypto also directly proposed by intelliJ, the code that i'm trying is

from Crypto.Cipher import DES
from Crypto.PublicKey import  RSA
jps
  • 20,041
  • 15
  • 75
  • 79

1 Answers1

1

The package you shall install is called pycryptodome, so try installing

pip install pycryptodome

It is somehow dependent on system libraries so it might evantually get broken. To fix this was created pycryptodomex library that has everything bundled in, which you install using

pip install pycryptodomex

But then instead of your original code you need to use

from Cryptodome.Cipher import DES
from Cryptodome.PublicKey import  RSA
VojtaK
  • 483
  • 4
  • 13
  • Depending on the system you may have to use `pip3` for `python3`, `pip` is a softlink [which *should* point to the correct version](https://stackoverflow.com/q/40832533/589259). – Maarten Bodewes May 10 '23 at 14:36