Class HardwareId

java.lang.Object
io.github.eggy03.ferrumx.windows.entity.compounded.HardwareId

@ShallowImmutable public class HardwareId extends Object
Immutable representation of a hardware identity (HWID) in a Windows system.

This entity represents a compound identifier derived from several hardware components of a Windows system. It corresponds to the deserialized output of the associated PowerShell script responsible for HWID generation.

Data sources

  • Win32_Processor.ProcessorID — Unique identifier(s) for the system’s physical processor(s).
  • Win32_BIOS — Includes the following properties:
    • SMBIOSBIOSVersion
    • SMBIOSMajorVersion
    • SMBIOSMinorVersion
    • SystemBiosMajorVersion
    • SystemBiosMinorVersion
  • Win32_BaseBoard — Includes the following properties:
    • Manufacturer
    • Model
    • OtherIdentifyingInfo
    • PartNumber
    • SerialNumber
    • SKU
    • Version
    • Product

ID generation

The associated PowerShell script performs the following operations:

  1. Retrieves the combined IDs from the aforementioned classes
  2. Trims whitespaces and filters out null or empty values.
  3. Sorts all identifiers.
  4. Joins them using a | delimiter to form rawHWID.
  5. Computes the SHA-256 hash of this concatenated string.
  6. Formats the hash into a 8-4-4-4-12-16-16 grouped representation stored in hashHWID.

While the generated HWID is designed to be unique per system, its uniqueness depends on the values provided by the hardware manufacturers. In cases where components report generic or missing information (e.g., baseboards using "Default String" as a serial number, null for model or SKU, or placeholder versions like "x.x"), multiple systems may end up sharing the same HWID. In such cases, the Win32_Processor.ProcessorID property becomes the source of uniqueness, provided this value can be detected during runtime.

Usage example

HardwareId hwid = HardwareId.builder()
    .rawHWID("UUID|DISK1|CPU1")
    .hashHWID("03560274-043C-05B7-4C06-C80700080009")
    .build();
Since:
3.0.0
  • Field Details

    • rawHWID

      @SerializedName("HWIDRaw") @Nullable @Nullable String rawHWID
      Collection of IDs for several components, grouped together by a de-limiter.

      Should be used for debug purposes only

      For production applications, use hashHWID

      Read the class level documentation to know more about how this information is collected

    • hashHWID

      @SerializedName("HWIDHash") @Nullable @Nullable String hashHWID
      SHA-256 hash of the rawHWID

      Read the class level documentation to know more about how this information is collected

  • Constructor Details

    • HardwareId

      public HardwareId()
  • Method Details

    • toString

      @NotNull public @NotNull String toString()
      Retrieves the entity in a JSON pretty-print formatted string
      Overrides:
      toString in class Object
      Returns:
      the String value of the object in JSON pretty-print format