For all practical purposes, PyCrypto, the Python Cryptography Toolkit, is dead. The package has several issues (many of them with security implications) that will almost certainly never get fixed because the project hasn’t been updated in multiple years. Despite that, I still see PyCrypto recommendations around every now and then — I just got it removed from the Awesome Cryptography list.

This unfixed, exploitable crashing bug should be good reason to stop using PyCrypto. But that’s not the only security flaw by any means — just browse the issues list to find more. And that’s still not all the problems. Last year I looked at the code and found a small cryptographic flaw that I patched in PyCryptodome (the fork that’s continuing the project). The flaw still exists in PyCrypto, and I didn’t bother filing an issue there. There are probably many more flaws that have been discovered, publicly or privately, but aren’t listed.

This package had its day, but it’s beyond time to stop using it.

What are the Alternatives?

The new Python Cryptography package is quite nice. It has an API that’s designed to be easy to use securely.

If using a totally new API isn’t an option, there’s the PyCryptodome fork. Be aware, though, that the PyCrypto API is the exact opposite of “easy to use securely”. The example and all the defaults on the AES documentation page are bad security practices. That’s several nasty footguns on just one page of documentation, which is kind of scary. Thankfully, the PyCryptodome project has been fixing many of these problems, but I still recommend and use Python Cryptography.