Package com.github.f4b6a3.uuid.util
Class Fingerprint
- java.lang.Object
-
- com.github.f4b6a3.uuid.util.Fingerprint
-
public final class Fingerprint extends Object
Utility class to generate host fingerprint.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longgetFingerprint()Returns long value representing a host fingerprint.protected static StringgetJavaVirtualMachine()Returns a string of the JVM details.protected static StringgetLocalization()Return a string with locale, charset, encoding and timezone.protected static StringgetNetwork()Returns a string of the network details.protected static StringgetOperatingSystem()Returns a string of the OS details.protected static StringgetResources()Returns a string of CPU cores and maximum memory available.static StringgetSystemDataHash()Returns a SHA-256 hash string generated from all the system data: OS + JVM + network details + system resources + locale + timezone.
-
-
-
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. Read: https://en.wikipedia.org/wiki/Device_fingerprint- Returns:
- a fingerprint as long value
-
getSystemDataHash
public static String getSystemDataHash()
Returns a SHA-256 hash string generated from all the system data: OS + JVM + network details + system resources + locale + timezone.- 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
-
-