Package obitools :: Module zipfile :: Class _ZipDecrypter
[hide private]
[frames] | no frames]

Class _ZipDecrypter

source code

Class to handle decryption of files stored within a ZIP archive.

ZIP supports a password-based form of encryption. Even though known plaintext attacks have been found against it, it is still useful to be able to get data out of such a file.

Usage :

   zd = _ZipDecrypter(mypwd)
   plain_char = zd(cypher_char)
   plain_text = map(zd, cypher_text)
Instance Methods [hide private]
 
_GenerateCRCTable()
Generate a CRC-32 table.
source code
 
_crc32(self, ch, crc)
Compute the CRC32 primitive on one byte.
source code
 
__init__(self, pwd) source code
 
_UpdateKeys(self, c) source code
 
__call__(self, c)
Decrypt a single character.
source code
Class Variables [hide private]
  crctable = [0, 1996959894, 3993919788, 2567524794, 124634137, ...
Method Details [hide private]

_GenerateCRCTable()

source code 

Generate a CRC-32 table.

ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32().


Class Variable Details [hide private]

crctable

Value:
[0,
 1996959894,
 3993919788,
 2567524794,
 124634137,
 1886057615,
 3915621685,
 2657392035,
...