RELEASED Python 2.3.1
Dave Brueck
dave at pythonapocrypha.com
Wed Sep 24 15:12:16 EDT 2003
On Thursday 25 September 2003 12:38 pm, Thomas Heller wrote:
> Dave Brueck <dave at pythonapocrypha.com> writes:
> > venster.pycb (82k)
> > main.pycb (15k)
> >
> > Under 100KB is not bad for a GUI app! :)
> >
> > The .pycb format is basically ZIP + AES encryption, and pycb uses the new
> > import hooks in 2.3 to handle it. The encryption is just to keep honest
> > people out; anybody with the right combination of smart and bored could
> > figure out how to circumvent it.
>
> I have also experimented with importing encrypted .pyo files, but my
> short experiments so far didn't give sufficient speed. Only the a simple
> string.translate() or the rotor module with one permutation didn't slow
> down the import by several orders of magnitude. What decryption rates do
> you get?
I haven't measured it yet, but probably because I haven't noticed any
significant slow down (to be honest, before your mention of it, import speed
hadn't crossed my mind other than wondering aloud if using .py instead of
.pyc would be noticable). I'm using the Rinjdael AES code from:
http://eevolved.com/cryptkit/index.php?page=5
Maybe the reason I haven't seen any problems is that I'm taking the simplistic
approach of creating pycb's like this:
1) zip up all the files
2) compress the zip
3) encrypt it
4) add magic tokens to identify the archive as a pycb file
which of course implies that on load I read the entire pycb into memory and
decrypt it right then before handing it off to the import hook. This approach
was the quickest route to a working prototype, but I stuck with it because
per-file encryption would likely wreck compression rates, and pycb's are all
quite small (even for a large application it would measure in the low
megabytes of memory used, if that).
-Dave
More information about the Python-list
mailing list