Class CRC64

java.lang.Object
it.unimi.dsi.law.util.CRC64

public class CRC64
extends Object
Provides static methods to compute 64-bit CRCs of strings and byte arrays. It uses the primitive polynomial x64+x4+x3+x+1.
  • Method Summary

    Modifier and Type Method Description
    static long compute​(byte[] x)
    Computes the 64 bit CRC of a byte array.
    static long compute​(char[] x, int off, int len)
    Computes the 64 bit CRC of a character array fragment.
    static long compute​(MutableString s)
    Computes the 64 bit CRC of a mutable string, using the ISO8859-1 representation of its Unicode characters.
    static long compute​(String s)
    Computes the 64 bit CRC of a string, using the ISO8859-1 representation of its Unicode characters.

    Methods inherited from class java.lang.Object

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

    • compute

      public static long compute​(byte[] x)
      Computes the 64 bit CRC of a byte array.
      Parameters:
      x - the byte array to CRC.
      Returns:
      the CRC.
    • compute

      public static long compute​(char[] x, int off, int len)
      Computes the 64 bit CRC of a character array fragment.
      Parameters:
      x - the array to CRC.
      off - the offset inside x.
      len - the number of characters to CRC.
      Returns:
      the CRC.
    • compute

      public static long compute​(String s)
      Computes the 64 bit CRC of a string, using the ISO8859-1 representation of its Unicode characters.
      Parameters:
      s - the byte array to CRC.
      Returns:
      the CRC.
    • compute

      public static long compute​(MutableString s)
      Computes the 64 bit CRC of a mutable string, using the ISO8859-1 representation of its Unicode characters.
      Parameters:
      s - the mutable string to CRC.
      Returns:
      the CRC.