[Python-Dev] Fast Implementation for ZIP decryption

Gregory P. Smith greg at krypto.org
Mon Aug 31 08:38:32 CEST 2009


On Sun, Aug 30, 2009 at 10:40 PM, Jeroen Ruigrok van der Werven <
asmodai at in-nomine.org> wrote:

> -On [20090831 06:29], Collin Winter (collinw at gmail.com) wrote:
> >Are there any applications/frameworks which have zip files on their
> >critical path, where this kind of (admittedly impressive) speedup
> >would be beneficial? What was the motivation for writing the C
> >version?
>
> Would zipped eggs count? For example, SQLAlchemy runs in the 5 MB range.
>

Unless someone's also pushing for being able to import and execute code from
scrambled zip files, no that doesn't matter.

The C code for this should be trivially tiny.  See the zipfile._ZipDecryptor
class, its got ~25 lines of actual code in it.  It is not worth arguing
about.  I'll commit this if you post it as a patch in a tracker issue.
 Please make sure your patch includes the following:

* A unittest that compares the C version of the descrambler to the python
version of the descrambler using a variety of inputs and outputs that
exercise any boundary condition.

* Conditional import code in the zipfile module itself so that the module
works even if the C module isn't available.

-Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090830/b22c6d9e/attachment.htm>


More information about the Python-Dev mailing list