what is the purpose of second argument in PKZIP CRC32()?

39 Views Asked by At

I am trying to find a way of improving the attack PKZIP encryption but some things aren't clear and for today its this one:

key0 = crc32 ( key0, pt );

This is the CRC32 i know as standard it takes one argument:

#define CRC32_POLYNOMIAL 0xEDB88320L

uint32_t crc32(const uint8_t *data, size_t length) {
    uint32_t crc = 0xFFFFFFFF;

    for (size_t i = 0; i < length; ++i) {
        crc ^= data[i];
        for (int j = 0; j < 8; ++j) {
            if (crc & 1) {
                crc = (crc >> 1) ^ CRC32_POLYNOMIAL;
            } else {
                crc >>= 1;
            }
        }
    }

    return ~crc;
}

It's not just me but zipcrack also found Appnote misleading.

What is the purpose of pt in the expression, all the sources i have seen they either have data and its length as the 2 arguments, Or does it mean crc32(key0+pt);. My problem is not with definitions but understanding the use an extra argument as you can see from the above code we already have 2 inputs to crc32() regardless of size, why would it be crc32(data,len,chr), if i were to add that to the above code what would be the use of char in the function, That is my problem and i hope this is clear enough.

1

There are 1 best solutions below

9
Mark Adler On

From the appnote you got that from:

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.