How to Solve NameError: name 'long_to_bytes' is not defined -- Crypto

Solution: Import the 'long_to_bytes' module

To Solve the error, add the following line to the top of your code.

from Crypto.Util.number import long_to_bytes

 

For more information:
Python Crypto long_to_bytes