Are there any codecs that can take parameters at initialization time? If not, how about supporting them? Here's a motivating example:
import codecs f = codecs.open('output', 'wb', encoding='DES', # arguments to open() key = '...', mode = DES.ECB) f.write('This will be encrypted\n') f.close()
RC4, maybe. But I think you're asking for trouble in trying to pretend a block-mode cipher is a stream.