Class Fingerprint


  • public final class Fingerprint
    extends Object
    Utility class to generate host fingerprint.
    • Method Detail

      • getFingerprint

        public static long getFingerprint()
        Returns long value representing a host fingerprint. The fingerprint is calculated from a list of system properties: OS + JVM + network details + system resources + locale + timezone. It uses these information to generate the fingerprint: operating system (name, version, arch), java virtual machine (vendor, version, runtime, VM), network settings (IP, MAC, host name, domain name), system resources (CPU cores, memory), locale (language, charset) and timezone. These information are concatenated and passed to a SHA-256 message digest. It returns the last 8 bytes of the resulting hash as long value. This method uses the return of getHashBytes(). Read: https://en.wikipedia.org/wiki/Device_fingerprint
        Returns:
        a fingerprint as long value
      • getHashString

        public static String getHashString()
        Returns a hexadecimal representation of the SHA-256 hash string generated from all the system data: OS + JVM + network details + system resources + locale + timezone. This method uses the return of getHashBytes().
        Returns:
        a string
      • getHashBytes

        public static byte[] getHashBytes()
        Returns a SHA-256 hash byte array generated from all the system data: OS + JVM + network details + system resources + locale + timezone. This method uses the return of getSystemData().
        Returns:
        a byte array
      • getSystemData

        public static String getSystemData()
        Returns a string of all the system data: OS + JVM + network details + system resources + locale + timezone. The returning string is a list of system properties separated by spaces. It's return is used by getHashBytes() to calculate the SHA-256 hash.
        Returns:
        a string
      • getOperatingSystem

        protected static String getOperatingSystem()
        Returns a string of the OS details.
        Returns:
        a string
      • getJavaVirtualMachine

        protected static String getJavaVirtualMachine()
        Returns a string of the JVM details.
        Returns:
        a string
      • getLocalization

        protected static String getLocalization()
        Return a string with locale, charset, encoding and timezone.
        Returns:
        a string
      • getResources

        protected static String getResources()
        Returns a string of CPU cores and maximum memory available.
        Returns:
        a string
      • getNetwork

        protected static String getNetwork()
        Returns a string of the network details. It's done in three two steps: 1. it tries to find the network data associated with the host name; 2. otherwise, it iterates through all interfaces to return the first one that is up and running.
        Returns:
        a string