Class Fingerprint

java.lang.Object
org.bouncycastle.util.Fingerprint

public class Fingerprint extends 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).
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    calculateFingerprint(byte[] input)
    Return a byte array containing a calculated fingerprint for the passed in input data.
    static byte[]
    calculateFingerprint(byte[] input, int bitLength)
    Return a byte array containing a calculated fingerprint for the passed in input data.
    static byte[]
    Deprecated.
    use the SHAKE based version.
    boolean
     
    byte[]
     
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 Details

    • getFingerprint

      public byte[] getFingerprint()
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class 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.