Skip to main content

Ralsina.Me — Roberto Alsina's website

Opening and Saving Files made easier.

I im­ple­ment­ed a (hope­ful­ly) rea­son­able open/save log­ic, sup­port­ing en­cryp­tion, com­pres­sion, ( and en­crypt­ed com­pres­sion ;-) atom­ic saves.

Since al­most ev­ery app can use this, why not make it a mod­ule?

Bob Ippolito / 2006-04-03 06:13:

Using rotor is kind of a cruel joke :) I believe they're getting rid of all encryption algorithms from the Python 2.4 core anyways, just to avoid legal hassle. I would just rip that out and support optional crypto by other means (PyCrypto, for example).

Why the choice of ".comp" instead of the standard .gz?

Roberto Alsina / 2006-04-03 06:14:

Well, I can rip it off and just stick rijndael instead, since there is a pure-python public domain version.

The .comp is because gunzip can't uncompress it :-)

It was uncompressible if I used the gzipfile stuff, but that meant compression was always done at the end, and for encrypted stuff it made *larger* files :-)

Roberto Alsina / 2006-04-03 06:15:

Erm... when I said "it was uncompressible" I meant "gzip could uncompress it". The concept per word density just got out of hand there :-)

Bob Ippolito / 2006-04-03 06:16:

Yes, of course, gzip can't uncompress a raw zlib encoded file. The gzipfile module probably just sucks, then. I've done streaming implementations of gzip that work just fine.

Roberto Alsina / 2006-04-03 06:17:

It's not that gzipfile sucks, it's just what it does: it's a transparent file object, but stores gzipped. So by definition gzipping is the last thing before storage.

Do you have those streaming gzip imps available somewhere?

Bob Ippolito / 2006-04-03 06:18: is an implementation geared towards usage in a Twisted protocol, but the actual gzip part of it doesn't have much to do with Twisted.

Contents © 2000-2020 Roberto Alsina