Class Fingerprint


  • public class Fingerprint
    extends java.lang.Object
    Basic 20 byte finger print class.
    • Constructor Summary

      Constructors 
      Constructor Description
      Fingerprint​(byte[] source)
      Base constructor - use SHAKE-256 (160 bits).
      Fingerprint​(byte[] source, boolean useSHA512t)
      Deprecated.
      use the SHAKE only version.
      Fingerprint​(byte[] source, int bitLength)
      Constructor with length - use SHAKE-256 (bitLength bits).
    • Constructor Detail

      • Fingerprint

        public Fingerprint​(byte[] source)
        Base constructor - use SHAKE-256 (160 bits). This is the recommended one as it is also produced by the FIPS API.
        Parameters:
        source - original data to calculate the fingerprint from.
      • Fingerprint

        public Fingerprint​(byte[] source,
                           int bitLength)
        Constructor with length - use SHAKE-256 (bitLength bits). This is the recommended one as it is also produced by the FIPS API.
        Parameters:
        source - original data to calculate the fingerprint from.
      • Fingerprint

        public Fingerprint​(byte[] source,
                           boolean useSHA512t)
        Deprecated.
        use the SHAKE only version.
        Base constructor - for backwards compatibility.
        Parameters:
        source - original data to calculate the fingerprint from.
        useSHA512t - use the old SHA512/160 calculation.
    • Method Detail

      • getFingerprint

        public byte[] getFingerprint()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • calculateFingerprint

        public static byte[] calculateFingerprint​(byte[] input)
        Return a byte array containing a calculated fingerprint for the passed in input data. This calculation is compatible with the BC FIPS API.
        Parameters:
        input - data to base the fingerprint on.
        Returns:
        a byte array containing a 160 bit fingerprint.
      • calculateFingerprint

        public static byte[] calculateFingerprint​(byte[] input,
                                                  int bitLength)
        Return a byte array containing a calculated fingerprint for the passed in input data. This calculation is compatible with the BC FIPS API.
        Parameters:
        input - data to base the fingerprint on.
        bitLength - bit length of finger print to be produced.
        Returns:
        a byte array containing a 20 byte fingerprint.
      • calculateFingerprintSHA512_160

        public static byte[] calculateFingerprintSHA512_160​(byte[] input)
        Deprecated.
        use the SHAKE based version.
        Return a byte array containing a calculated fingerprint for the passed in input data. The fingerprint is based on SHA512/160.
        Parameters:
        input - data to base the fingerprint on.
        Returns:
        a byte array containing a 20 byte fingerprint.