Package org.bouncycastle.util
Class Fingerprint
java.lang.Object
org.bouncycastle.util.Fingerprint
Basic 20 byte finger print class.
-
Constructor Summary
ConstructorDescriptionFingerprint
(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 TypeMethodDescriptionstatic 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[]
calculateFingerprintSHA512_160
(byte[] input) Deprecated.use the SHAKE based version.boolean
byte[]
int
hashCode()
toString()
-
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
-
equals
-
hashCode
public int hashCode() -
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.
-