Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How can I solve the issue of “modulenotfounderror:no module named ‘crypto’?

Asked by Debbie Jha Jun 7, 2024 3.2K views 1 answer
Share

About this question

I am currently working on a Python project that includes data encryption before storing it in a database. For encryption, I planned to use the “PyCrytodome” library which can provide me with a wide range of cryptographic functionalities. I have written the following coding for the encryption of the data:

From Crypto.Cipher import AES
From Crypto.Random import get_random_bytes
Def encrypt_data(data):
    Key = get_random_bytes(16)
    Cipher = AES.new(key, AES.MODE_EAX)
    Nonce = cipher.nonce
    Ciphertext, tag = cipher.encrypt_and_digest(data.encode(‘utf-8’))
    Return (nonce, ciphertext, tag)
Data = “Sensitive Information”
Encrypted_data = encrypt_data(data)
Print(encrypted_data)

However, when I am trying to run the above script, I am getting a particular issue message which is stating that “ modulenotfounderror:no module named ‘crypto’. How can I troubleshoot and resolve this specific issue? 

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.