1996-02-10 - new zip cracking code

Header Data

From: Anonymous
To: cypherpunks@toad.com
Message Hash: aa54da127487f957036042445fb27fcbbcf9ece809e025c5379daa0043747595
Message ID: <3f81e57e9db66b581941ceff328cf1fb@NO-ID-FOUND.mhonarc.org>
Reply To: N/A
UTC Datetime: 1996-02-10 23:09:57 UTC
Raw Date: Sat, 10 Feb 1996 18:09:57 +1100 (EST)

Raw message

From: Anonymous
Date: Sat, 10 Feb 1996 18:09:57 +1100 (EST)
To: cypherpunks@toad.com
Subject: new zip cracking code
Message-ID: <3f81e57e9db66b581941ceff328cf1fb@NO-ID-FOUND.mhonarc.org>
MIME-Version: 1.0
Content-Type: text


Does anyone have any pointers to cryptanalysis papers on the Zip
encryption scheme (presented below)? I've seen a few MSDOS executeables
which used some sort of brute force attack, which didn't seem
particularly intelligent or effective for long passwords. If anyone has
some pointers, or source I'd be glad to hear of it. From what I can see
of Schlafly's algorithm a bute force attack could be speed up a great
deal by pre-compution and expansaion of elements of the first 3 or so
rounds at the very least.

Ideas anyone?


Decryption
----------

The encryption used in PKZIP was generously supplied by Roger
Schlafly.  PKWARE is grateful to Mr. Schlafly for his expert
help and advice in the field of data encryption.

PKZIP encrypts the compressed data stream.  Encrypted files must
be decrypted before they can be extracted.

Each encrypted file has an extra 12 bytes stored at the start of
the data area defining the encryption header for that file.  The
encryption header is originally set to random values, and then
itself encrypted, using 3, 32-bit keys.  The key values are 
initialized using the supplied encryption password.  After each byte
is encrypted, the keys are then updated using psuedo-random number
generation techniques in combination with the same CRC-32 algorithm 
used in PKZIP and described elsewhere in this document.

The following is the basic steps required to decrypt a file:

1) Initialize the three 32-bit keys with the password.
2) Read and decrypt the 12-byte encryption header, further
   initializing the encryption keys.
3) Read and decrypt the compressed data stream using the
   encryption keys.


Step 1 - Initializing the encryption keys
-----------------------------------------

Key(0) <- 305419896
Key(1) <- 591751049
Key(2) <- 878082192

loop for i <- 0 to length(password)-1
    update_keys(password(i))
end loop


Where update_keys() is defined as:


update_keys(char):
  Key(0) <- crc32(key(0),char)
  Key(1) <- Key(1) + (Key(0) & 000000ffH)
  Key(1) <- Key(1) * 134775813 + 1
  Key(2) <- crc32(key(2),key(1) >> 24)
end update_keys


Where crc32(old_crc,char) is a routine that given a CRC value and a 
character, returns an updated CRC value after applying the CRC-32 
algorithm described elsewhere in this document.


Step 2 - Decrypting the encryption header
-----------------------------------------

The purpose of this step is to further initialize the encryption
keys, based on random data, to render a plaintext attack on the
data ineffective.


Read the 12-byte encryption header into Buffer, in locations
Buffer(0) thru Buffer(11).

loop for i <- 0 to 11
    C <- buffer(i) ^ decrypt_byte()
    update_keys(C)
    buffer(i) <- C
end loop


Where decrypt_byte() is defined as:


unsigned char decrypt_byte()
    local unsigned short temp
    temp <- Key(2) | 2
    decrypt_byte <- (temp * (temp ^ 1)) >> 8
end decrypt_byte


After the header is decrypted, the last two bytes in Buffer
should be the high-order word of the CRC for the file being
decrypted, stored in Intel low-byte/high-byte order.  This can
be used to test if the password supplied is correct or not.


Step 3 - Decrypting the compressed data stream
----------------------------------------------

The compressed data stream can be decrypted as follows:


loop until done
    read a charcter into C
    Temp <- C ^ decrypt_byte()
    update_keys(temp)
    output Temp
end loop



-- 
+----------------------------------+-----------------------------------------+
|Julian Assange                    | "if you think the United  States has    |
|FAX: +61-3-9819-9066              |  stood still, who built the largest     |
|EMAIL: proff@suburbia.net         |  shopping centre in the world?" - Nixon |
+----------------------------------+-----------------------------------------+





Thread