What's so funny? WAS Re: rotor replacement

James Stroud jstroud at mbi.ucla.edu
Mon Jan 24 19:31:13 EST 2005


Martin v. Löwi said
> Hmm. Most applications don't have any crypto needs.

Any program where one stores data would have crypto needs.

Here are some examples: Database, wordprocessor, spreadsheet, address
book, mail program, (should I go on?). What would be the alternative to
encryption to satisfy the functionality encryption
provides...memorization? But I believe this may be a case of things
being so obvious people forget their importance (e.g. breathing).

I have written a class that goes something like this (highly simplified)

class encryptFilter:
   def __init__(acipher):
     self.mycipher = acipher
   def open(self, filename):
     self.myfile = open(filename,"w")
   def write(data):
     encrypted_data = self.encrypt(data)
     self.myfile.write(encrypted_data)
   etc...

Now what if acipher and this class could be made from part of the core
distro? Any application could have the option of encryption with only a
few lines of code:

import std_crypt

# other code here

if get_user_pref("do_encryption"):
  password = my_get_password()
  acipher = std_crypt.AES(password)
  outfile = std_crypt.encryptFilter(acipher)
  outfile.open(filename)
else:
  outfile = open(filename,"w")

# all other code doesn't change...
outfile.write(buncha_data)


This could be even more simpler, but that's the general idea. The
usefulness would be tremendous.




More information about the Python-list mailing list