I'm writing a program in python 3 which needs encryption functions (at least aes and rsa). I've found PyCrypto which seems to work only on 2.x versions.
Is there any good tool available for python 3 or should I rather start translating my program to be compatible with python 2 (or any other solution) ?
Thank you
Update as mentioned below, PyCrypto is now available on py3k
PyCrypto 2.4.1 and later now work on Python 3.x (see changelog diff).
Although Python 3 itself is ready for primetime, the lack of libraries that support it is a hindrance. The best you can do is of course to help port PyCrypto to Python 3, although as it has a lot of C-extension modules that is probably not entirely trivial, and will be a couple of days work, I would think. Maybe the current maintainer is interested in porting or already half-way there, you should contact him and ask.
There is an rsa module written in Python which looks to have fairly clean and easily portable code, but for aes it seems like PyCrypto is the module to use. So it is probably easier to make your software run under Python 2 instead.
Crytographic Libraries are mostly numeric calculations and I don't know why py3k versions are not available yet.
Please use them with caution as they just development programs implemented following the algorithm text. (That is, I am not sure of the rigor in the original python2 version). Also, all of them are pure python libraries, they would be slower than anything written using C-extensions ( and perhaps that is the reason, why py3k versions are getting delayed).
i have written a wrapper library simple-crypt that provides encryption and decryption in python 3, delegating the work to pycrypto.
advantages of using this over pycrypto directly include:
much simpler interface:
data = encrypt(password, text)
text = decrypt(password, data).decode('utf8')
key expansion to make the use of passphrases more secure
use of an hmac to check for modification of the data
a versioned header that should allow me to switch the implementation to google's keyczar once that moves to python 3 (since that should be better maintained - i only wrote this out of apparent necessity).
you can install the package using:
easy_install simple_crypt
more info available on the github page for the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With