Busy making things: tinycast, github, links, photos, @mc.

Blowfish in Your Pocket

Posted: March 28th, 2005 | Author: | Filed under: Mobile, Projects, Python | 3 Comments »

Blowfish on Python for Series 60

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:

import blowfish
key = 'hey, look over there!'
print 'generating the fish'
fish = blowfish.Blowfish(key)
print 'Plaintext:'
text = 'testtest'
print text
print 'Encrypting...'
crypted = fish.encrypt(text)
print 'Encrypted.'
# Printing encrypted chars causes barf
print 'Decrypting...'
decrypted = fish.decrypt(crypted)
print 'Decrypted:'
print decrypted

3 Comments on “Blowfish in Your Pocket”

  1. 1 Michael Gilfix said at 5:18 pm on January 14th, 2007:

    Is it desirable that I make this code available on my website? It seems to have shown up on various sites as an example of such a module and is now only available in the google cache. Please let me know.

  2. 2 buy propecia said at 4:05 am on January 25th, 2011:

    Should you tell it — error.

  3. 3 Maurice Dasgupta said at 11:19 am on February 16th, 2011:

    This domain appears to recieve a great deal of visitors. How do you promote it? It offers a nice individual twist on things. I guess having something authentic or substantial to talk about is the most important factor.