Package 

Class CRC16

    • Method Summary

      Modifier and Type Method Description
      static int CCITT_Kermit(@NonNull() Array<byte> data, int offset, int length) Calculates CRC CCITT (Kermit) over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0x0000 initial value.
      static int CCITT_FALSE(@NonNull() Array<byte> data, int offset, int length) Calculates CRC CCITT-FALSE over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0xFFFF initial value.
      static int MCRF4XX(@NonNull() Array<byte> data, int offset, int length) Calculates CRC MCRF4XX over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0xFFFF initial value.
      static int AUG_CCITT(@NonNull() Array<byte> data, int offset, int length) Calculates CRC AUG-CCITT over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0x1D0F initial value.
      static int ARC(@NonNull() Array<byte> data, int offset, int length) Calculates CRC-16 ARC over given range of bytes from the block of data.It is using the 0x8005 polynomial and 0x0000 initial value.
      static int MAXIM(@NonNull() Array<byte> data, int offset, int length) Calculates CRC-16 MAXIM over given range of bytes from the block of data.It is using the 0x8005 polynomial and 0x0000 initial value and XORs output with 0xFFFF.
      static int CRC(int poly, int init, @NonNull() Array<byte> data, int offset, int length, boolean refin, boolean refout, int xorout) 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • CCITT_Kermit

         static int CCITT_Kermit(@NonNull() Array<byte> data, int offset, int length)

        Calculates CRC CCITT (Kermit) over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0x0000 initial value.

        See: crc.cat.kermit

        Parameters:
        data - The input data block for computation.
        offset - Offset from where the range starts.
        length - Length of the range in bytes.
      • CCITT_FALSE

         static int CCITT_FALSE(@NonNull() Array<byte> data, int offset, int length)

        Calculates CRC CCITT-FALSE over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0xFFFF initial value.

        See: crc-16-ccitt-falseSee: crc16-ccitt

        Parameters:
        data - The input data block for computation.
        offset - Offset from where the range starts.
        length - Length of the range in bytes.
      • MCRF4XX

         static int MCRF4XX(@NonNull() Array<byte> data, int offset, int length)

        Calculates CRC MCRF4XX over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0xFFFF initial value.

        This method is used in Bluetooth LE CGMS service E2E-CRC calculation.

        See: crc.cat.crc-16-mcrf4xxSee: Bluetooth Specifications -> CGMS (1.0.1)

        Parameters:
        data - The input data block for computation.
        offset - Offset from where the range starts.
        length - Length of the range in bytes.
      • AUG_CCITT

         static int AUG_CCITT(@NonNull() Array<byte> data, int offset, int length)

        Calculates CRC AUG-CCITT over given range of bytes from the block of data.It is using the 0x1021 polynomial and 0x1D0F initial value.

        See: crc-16-aug-ccittSee: crc16-ccitt

        Parameters:
        data - The input data block for computation.
        offset - Offset from where the range starts.
        length - Length of the range in bytes.
      • ARC

         static int ARC(@NonNull() Array<byte> data, int offset, int length)

        Calculates CRC-16 ARC over given range of bytes from the block of data.It is using the 0x8005 polynomial and 0x0000 initial value.

        Input data and output CRC are reversed.

        See: crc-16-arc

        Parameters:
        data - The input data block for computation.
        offset - Offset from where the range starts.
        length - Length of the range in bytes.
      • MAXIM

         static int MAXIM(@NonNull() Array<byte> data, int offset, int length)

        Calculates CRC-16 MAXIM over given range of bytes from the block of data.It is using the 0x8005 polynomial and 0x0000 initial value and XORs output with 0xFFFF.

        Input data and output CRC are reversed.

        See: crc-16-maxim

        Parameters:
        data - The input data block for computation.
        offset - Offset from where the range starts.
        length - Length of the range in bytes.
      • CRC

         static int CRC(int poly, int init, @NonNull() Array<byte> data, int offset, int length, boolean refin, boolean refout, int xorout)

        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: CRC Calculator

        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.