Class CRC64


  • public final class CRC64
    extends java.lang.Object
    CRC64 checksum calculator based on the polynom specified in ISO 3309. The implementation is based on the following publications:
    • http://en.wikipedia.org/wiki/Cyclic_redundancy_check
    • http://www.geocities.com/SiliconValley/Pines/8659/crc.htm
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long[] LOOKUPTABLE  
      private static long POLY64REV  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CRC64()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long classId​(byte[] bytes)
      Calculates class identifier for the given class bytes.
      private static long update​(long sum, byte b)
      Updates given checksum by given byte.
      private static long update​(long sum, byte[] bytes, int fromIndexInclusive, int toIndexExclusive)
      Updates given checksum by bytes from given array.
      • Methods inherited from class java.lang.Object

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

      • LOOKUPTABLE

        private static final long[] LOOKUPTABLE
    • Constructor Detail

      • CRC64

        private CRC64()
    • Method Detail

      • update

        private static long update​(long sum,
                                   byte b)
        Updates given checksum by given byte.
        Parameters:
        sum - initial checksum value
        b - byte to update the checksum with
        Returns:
        updated checksum value
      • update

        private static long update​(long sum,
                                   byte[] bytes,
                                   int fromIndexInclusive,
                                   int toIndexExclusive)
        Updates given checksum by bytes from given array.
        Parameters:
        sum - initial checksum value
        bytes - byte array to update the checksum with
        fromIndexInclusive - start index in array, inclusive
        toIndexExclusive - end index in array, exclusive
        Returns:
        updated checksum value
      • classId

        public static long classId​(byte[] bytes)
        Calculates class identifier for the given class bytes.
        Parameters:
        bytes - class bytes
        Returns:
        class identifier