More Python for Series 60 Crypto: Rijndael

Rijndael on Series 60

During my search for pure python Nirvana I came across Bram Cohen’s rijndael.py. It can work with strings of length 16, 24, or 32. Here’s the sample code that ran successfully (albeit slowly) on my Taco:

# Make sure rijndael.py is in your libs dir
from rijndael import rijndael
# key must be 16, 24, 32 characters long
key = 'sixteencharacter'
r = rijndael(key, 16)
# must encode/decode in the chosen blocksize
print 'Encoding/Decodingnusing Rijndael...'
plaintext = 'themonkeygoeswoo'
ciphertext = r.encrypt(plaintext)
print r.decrypt(ciphertext)

It took its sweet time to run, but isn’t much more painful than waiting for import urllib, so it’s not the end of the world. It requires copy and string, which I’m not sure are in the Nokia distribution, but it works just fine if you dump the Python 2.2.2 source libraries in to your libs directory.

Add this one to your mobile cryptography toolbelt.

WordPress database error: [Table './wordpress/wp_comments' is marked as crashed and last (automatic?) repair failed]
SELECT * FROM wp_comments WHERE comment_post_ID = '3620' AND comment_approved = '1' ORDER BY comment_date

4 Responses to “More Python for Series 60 Crypto: Rijndael”


Leave a Reply