CRC32
A Kotlin common implementation of CRC32.
The algorithm uses a precomputed table (with polynomial 0xEDB88320) and:
Initializes crc to 0xFFFFFFFF (i.e. -1)
For each byte, updates: crc = table(crc xor byte) & 0xFF xor (crc ushr 8)
When getValue() is called, returns (crc xor 0xFFFFFFFF) masked to 32 bits.
Functions
Link copied to clipboard
Updates the CRC32 checksum with the specified byte. Only the low 8 bits of b are used.
Updates the CRC32 checksum with the specified array of bytes.
Updates the current checksum with the specified array of bytes.
Updates the current checksum with the bytes from the specified buffer.