After finding out how well BeautifulSoup worked on my N-Gage, I decided to try to find more modules that “just worked” on Python for Series 60. First up is blowfish.py, a project by Michael Gilfix. The file itself is not available directly from the author within the US, but Google cache can help with that.
The module is pure python, with absolutely no module dependencies. I have only tested it on the MMC with the full Python distribution on it, but this one (in theory) should work on a stock .SIS install without any addition python modules in your libs directory. It’s definitely not fast by any stretch of the imagination, but it may be a good building block if you want to add some crypto to your mobile application.
Here is the code that is being executed in the screen shot above:
key = 'hey, look over there!'
print 'generating the fish'
fish = blowfish.Blowfish(key)
text = 'testtest'
crypted = fish.encrypt(text)
# Printing encrypted chars causes barf
decrypted = fish.decrypt(crypted)