'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().'

def _GenerateCRCTable():

    poly = 3988292384
    table = ([0] * 256)
    for i in range(256):
        crc = i
        for j in range(8):
            if (crc & 1):
                crc = (((crc >> 1) & 2147483647) ^ poly)
            else:
                crc = ((crc >> 1) & 2147483647)
        table[i] = crc
    return table
