CRC

fun CRC(poly: Int, init: Int, data: ByteArray, offset: Int, length: Int, refin: Boolean, refout: Boolean, xorout: Int): Int

Calculates the CRC over given range of bytes from the block of data with given polynomial and initial value. This method may also reverse input bytes and reverse output CRC.

See: http://www.zorc.breitbandkatze.de/crc.html

Return

CRC calculated with given parameters.

Parameters

poly

Polynomial used to calculate the CRC16.

init

Initial value to feed the buffer.

data

The input data block for computation.

offset

Offset from where the range starts.

length

Length of the range in bytes.

refin

True if the input data should be reversed.

refout

True if the output data should be reversed.