Python for Series 60 Crypto: DES

Pure Python DES module

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 binascii and 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, "*")

6 Responses to “Python for Series 60 Crypto: DES”


  1. 1 liqgghahjgl Apr 10th, 2005 at 3:00 am
    beilrgj
    kbxaserehp

  2. 2 liqgghahjgl Apr 10th, 2005 at 3:00 am
    beilrgj
    kbxaserehp

  3. 3 Hadi Apr 11th, 2005 at 10:41 am

    Hi dear,
    i can’t download python please send it to my mailbox
    thanks

  4. 4 pill identification Jul 4th, 2005 at 10:18 am

    Thanks for a lovely site, I am very impressed :-)

  5. 5 low apr credit card Jul 11th, 2005 at 12:57 am

    Lovely to see such a wonderful site. Thank you

  6. 6 play texas holdem Jul 18th, 2005 at 7:35 pm

    I come to your site because it keeps me entertained and aware of new things.

Leave a Reply