Enum Class CrcStandard

java.lang.Object
java.lang.Enum<CrcStandard>
org.refcodes.numerical.CrcStandard
All Implemented Interfaces:
Serializable, Comparable<CrcStandard>, Constable, org.refcodes.mixin.NameAccessor, CrcAlgorithm, CrcWidthAccessor

public enum CrcStandard extends Enum<CrcStandard> implements CrcAlgorithm
Enumeration with CRC implementations hacked together from sources out there.
  • Enum Constant Details

    • CRC_8

      public static final CrcStandard CRC_8
    • CRC_8_ARDUINO

      public static final CrcStandard CRC_8_ARDUINO
    • CRC_8_CCITT

      public static final CrcStandard CRC_8_CCITT
    • CRC_8_CDMA2000

      public static final CrcStandard CRC_8_CDMA2000
    • CRC_8_DARC

      public static final CrcStandard CRC_8_DARC
    • CRC_8_DVBS2

      public static final CrcStandard CRC_8_DVBS2
    • CRC_8_SAE_J1850

      public static final CrcStandard CRC_8_SAE_J1850
    • CRC_8_EBU

      public static final CrcStandard CRC_8_EBU
    • CRC_8_ICODE

      public static final CrcStandard CRC_8_ICODE
    • CRC_8_ITU

      public static final CrcStandard CRC_8_ITU
    • CRC_8_MAXIM

      public static final CrcStandard CRC_8_MAXIM
    • CRC_8_ROHC

      public static final CrcStandard CRC_8_ROHC
    • CRC_8_WCDMA

      public static final CrcStandard CRC_8_WCDMA
    • CRC_16_CCITT_FALSE

      public static final CrcStandard CRC_16_CCITT_FALSE
    • CRC_16_ARC

      public static final CrcStandard CRC_16_ARC
    • CRC_16_AUG_CCITT

      public static final CrcStandard CRC_16_AUG_CCITT
    • CRC_16_BUYPASS

      public static final CrcStandard CRC_16_BUYPASS
    • CRC_16_CDMA2000

      public static final CrcStandard CRC_16_CDMA2000
    • CRC_16_DDS_110

      public static final CrcStandard CRC_16_DDS_110
    • CRC_16_DECT_R

      public static final CrcStandard CRC_16_DECT_R
    • CRC_16_DECT_X

      public static final CrcStandard CRC_16_DECT_X
    • CRC_16_DNP

      public static final CrcStandard CRC_16_DNP
    • CRC_16_EN_13757

      public static final CrcStandard CRC_16_EN_13757
    • CRC_16_GENIBUS

      public static final CrcStandard CRC_16_GENIBUS
    • CRC_16_MAXIM

      public static final CrcStandard CRC_16_MAXIM
    • CRC_16_MCRF4XX

      public static final CrcStandard CRC_16_MCRF4XX
    • CRC_16_RIELLO

      public static final CrcStandard CRC_16_RIELLO
    • CRC_16_T10_DIF

      public static final CrcStandard CRC_16_T10_DIF
    • CRC_16_TELEDISK

      public static final CrcStandard CRC_16_TELEDISK
    • CRC_16_TMS37157

      public static final CrcStandard CRC_16_TMS37157
    • CRC_16_USB

      public static final CrcStandard CRC_16_USB
    • CRC_16_A

      public static final CrcStandard CRC_16_A
    • CRC_16_KERMIT

      public static final CrcStandard CRC_16_KERMIT
    • CRC_16_MODBUS

      public static final CrcStandard CRC_16_MODBUS
    • CRC_16_X25

      public static final CrcStandard CRC_16_X25
    • CRC_16_XMODEM

      public static final CrcStandard CRC_16_XMODEM
    • CRC_32

      public static final CrcStandard CRC_32
    • CRC_32_BZIP2

      public static final CrcStandard CRC_32_BZIP2
    • CRC_32_C

      public static final CrcStandard CRC_32_C
    • CRC_32_D

      public static final CrcStandard CRC_32_D
    • CRC_32_JAMCRC

      public static final CrcStandard CRC_32_JAMCRC
    • CRC_32_MPEG2

      public static final CrcStandard CRC_32_MPEG2
    • CRC_32_POSIX

      public static final CrcStandard CRC_32_POSIX
    • CRC_32_Q

      public static final CrcStandard CRC_32_Q
    • CRC_32_XFER

      public static final CrcStandard CRC_32_XFER
    • CRC_64

      public static final CrcStandard CRC_64
    • CRC_64_WE

      public static final CrcStandard CRC_64_WE
    • CRC_64_XZ

      public static final CrcStandard CRC_64_XZ
  • Method Details

    • values

      public static CrcStandard[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CrcStandard valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • toCrcChecksum

      public long toCrcChecksum(byte aData)
      Calculates the according checksum from the supplied data.
      Specified by:
      toCrcChecksum in interface CrcAlgorithm
      Parameters:
      aData - The data for which to calculate the checksum.
      Returns:
      The according checksum.
    • getName

      public String getName()
      Specified by:
      getName in interface org.refcodes.mixin.NameAccessor
    • getCrcWidth

      public int getCrcWidth()
      Retrieves the value from the CRC byte width (number of bytes used to store a CRC checksum) property.
      Specified by:
      getCrcWidth in interface CrcWidthAccessor
      Returns:
      The name stored by the CRC byte width (number of bytes used to store a CRC checksum) property.
    • toCrcChecksum

      public long toCrcChecksum(long aCrc, byte aData)
      Updates the according checksum with he supplied data.
      Specified by:
      toCrcChecksum in interface CrcAlgorithm
      Parameters:
      aCrc - The CRC checksum to be updated.
      aData - The data for which to calculate the checksum.
      Returns:
      The accordingly updated checksum.
    • toCrcChecksum

      public long toCrcChecksum(byte[] aData)
      Calculates the according checksum from the supplied data.
      Specified by:
      toCrcChecksum in interface CrcAlgorithm
      Parameters:
      aData - The data for which to calculate the checksum.
      Returns:
      The according checksum.
    • toCrcChecksum

      public long toCrcChecksum(long aCrc, byte[] aData)
      Updates the according checksum with he supplied data.
      Specified by:
      toCrcChecksum in interface CrcAlgorithm
      Parameters:
      aCrc - The CRC checksum to be updated.
      aData - The data for which to calculate the checksum.
      Returns:
      The accordingly updated checksum.
    • toCrcChecksum

      public long toCrcChecksum(byte[] aData, int aOffset, int aLength)
      Calculates the according checksum from the supplied data.
      Specified by:
      toCrcChecksum in interface CrcAlgorithm
      Parameters:
      aData - The data for which to calculate the checksum.
      aOffset - The offset from where to start.
      aLength - The number of bytes to cover.
      Returns:
      The according checksum.
    • toCrcChecksum

      public long toCrcChecksum(long aCrc, byte[] aData, int aOffset, int aLength)
      Updates the according checksum with he supplied data.
      Specified by:
      toCrcChecksum in interface CrcAlgorithm
      Parameters:
      aCrc - The CRC checksum to be updated.
      aData - The data for which to calculate the checksum.
      aOffset - The offset from where to start.
      aLength - The number of bytes to cover.
      Returns:
      The accordingly updated checksum.
    • toCrcBytes

      public byte[] toCrcBytes(byte aData, Endianess aEndianess)
      Calculates the according checksum from the supplied data and returns the according byte array of the CRC checksum.
      Specified by:
      toCrcBytes in interface CrcAlgorithm
      Parameters:
      aData - The data for which to calculate the checksum.
      aEndianess - The Endianess (big endian or little endian) of the resulting bytes representing the CRC checksum.
      Returns:
      The according checksum.
    • toCrcBytes

      public byte[] toCrcBytes(long aCrc, byte aData, Endianess aEndianess)
      Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.
      Specified by:
      toCrcBytes in interface CrcAlgorithm
      Parameters:
      aCrc - The CRC checksum to be updated.
      aData - The data for which to calculate the checksum.
      aEndianess - The Endianess (big endian or little endian) of the resulting bytes representing the CRC checksum.
      Returns:
      The accordingly updated checksum.
    • toCrcBytes

      public byte[] toCrcBytes(byte[] aData, Endianess aEndianess)
      Calculates the according checksum from the supplied data data and returns the according byte array of the CRC checksum.
      Specified by:
      toCrcBytes in interface CrcAlgorithm
      Parameters:
      aData - The data for which to calculate the checksum.
      aEndianess - The Endianess (big endian or little endian) of the resulting bytes representing the CRC checksum.
      Returns:
      The according checksum.
    • toCrcBytes

      public byte[] toCrcBytes(long aCrc, byte[] aData, Endianess aEndianess)
      Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.
      Specified by:
      toCrcBytes in interface CrcAlgorithm
      Parameters:
      aCrc - The CRC checksum to be updated.
      aData - The data for which to calculate the checksum.
      aEndianess - The Endianess (big endian or little endian) of the resulting bytes representing the CRC checksum.
      Returns:
      The accordingly updated checksum.
    • toCrcBytes

      public byte[] toCrcBytes(byte[] aData, int aOffset, int aLength, Endianess aEndianess)
      Calculates the according checksum from the supplied data data and returns the according byte array of the CRC checksum.
      Specified by:
      toCrcBytes in interface CrcAlgorithm
      Parameters:
      aData - The data for which to calculate the checksum.
      aOffset - The offset from where to start.
      aLength - The number of bytes to cover.
      aEndianess - The Endianess (big endian or little endian) of the resulting bytes representing the CRC checksum.
      Returns:
      The according checksum.
    • toCrcBytes

      public byte[] toCrcBytes(long aCrc, byte[] aData, int aOffset, int aLength, Endianess aEndianess)
      Updates the according checksum with he supplied data data and returns the according byte array of the CRC checksum.
      Specified by:
      toCrcBytes in interface CrcAlgorithm
      Parameters:
      aCrc - The CRC checksum to be updated.
      aData - The data for which to calculate the checksum.
      aOffset - The offset from where to start.
      aLength - The number of bytes to cover.
      aEndianess - The Endianess (big endian or little endian) of the resulting bytes representing the CRC checksum.
      Returns:
      The accordingly updated checksum.
    • getCrcSize

      public CrcSize getCrcSize()
      Gets the CrcSize class to which this CrcAlgorithm belongs.
      Specified by:
      getCrcSize in interface CrcAlgorithm
      Returns:
      The CrcSize enumeration providing various width related methods.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<CrcStandard>