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.
The standard CRC32
only takes data and its size as the second argument and then comes the Update CRC32
which is like this:
#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
So here it's clear how the byte b
is used to update the current CRC
value.