Skip to main content

get_hardware_uuid

Function get_hardware_uuid 

Source
pub fn get_hardware_uuid() -> Uuid
Expand description

Get a permanent hardware-based UUID for this machine. This UUID is the actual hardware identifier and will remain consistent across reboots and application restarts.

Platform-specific implementations:

  • macOS: Uses IOPlatformUUID from IOKit (already a UUID)
  • Linux: Uses /etc/machine-id or /var/lib/dbus/machine-id (converted to UUID)
  • Windows: Uses MachineGuid from registry (already a UUID)

Returns a hybrid UUID (00000000-0000-0000-xxxx-xxxxxxxxxxxx) if detection fails, where the left part is all zeros and the right part is random for uniqueness.