Speaking of pure python crypto, it looks like PyDES works perfectly too. This one will probably require bits of the Python 2.2.2 source in order to run though. Specifically it’s looking for
time. All in all it’s quite lightweight and seems more responsive in both
import time and encrypt/decrypt time as compared to
blowfish.py. It’s still very slow compared to a native implementation, but should be fast enough for inclusion in Python for Series 60 apps.
DES and 3DES are available from this module. I can’t seem to find a reference to what license it is released under, so you might want to track down the author before writing an application around it.
Here’s the code for the demo above (taken from an example that ships with PyDES):
import pyDes k = pyDes.des("DESCRYPT", pyDes.CBC, "") print "Encrypting/Decrypting DES" d = k.encrypt("Please encrypt my string") print "Decypted string: " + k.decrypt(d) k = pyDes.triple_des("MySecretTripleDesKeyData") print "Encrypting/Decrypting 3DES" d = k.encrypt("Encrypt this sensitive data", "*") print "Decypted string: " + k.decrypt(d, "*")