pythonencryptioncryptographypycrypto

What is the difference between pycrypto and crypto packages in python?


I am new to encryption and hashing in python. I need this for authentication in one of my flask project. So my friend told me to use crypto package but when i searched it up i got crypto and pycrypto packages in the result. The thing is I know both of them are for encryption utility but I am confused as to which one to use. Is one of them better than the other or is one of them just a wrapper of the other?

Or

is there another better encryption package for python that I should use instead of the two mentioned above? I hope someone who have used these packages could help me. Thanks.


Solution

  • These two packages serve very different goals: crypto is a command line utility, which is intended to encrypt files, while pycrypto is a Python library which can be used from within Python to perform a number of different cryptographic operations (hashing, encryption/decryption, etc). pycrypto would be the more appropriate choice for implementing authentication within Python.

    I will note that Python also includes some cryptographic primitives in the standard library, which may be more suitable for your use case.

    Edit: As has been noted in the comments, pycrypto is no longer maintained, and a library such as cryptography or pycryptodome should be used instead.