| Crates.io | yamid |
| lib.rs | yamid |
| version | 0.1.1 |
| created_at | 2024-09-24 18:00:51.941226+00 |
| updated_at | 2024-09-24 22:34:29.647953+00 |
| description | Yet Another Machine ID |
| homepage | |
| repository | https://github.com/vsrs/yamid |
| max_upload_size | |
| id | 1385509 |
| size | 9,780 |
A lightweight crate for retrieving the unique machine ID without needing root/admin privileges. Uses OS APIs only and does not spawn new processes!
MachineGuid value from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography (Identifying Unique Windows Installation)/etc/machine-id with a fallback to /var/lib/dbus/machine-id (man page)IOPlatformUUIDCTL_KERN : KERN_HOSTUUID sysctl(3) with a fallback to /etc/hostidA machine ID uniquely identifies the host and should be treated as confidential, avoiding exposure in untrusted environments. If your application requires a stable unique identifier, avoid using the machine as it is. Instead, hash the machine ID securely with a fixed, application-specific salt.
[!WARNING]
Hashing IDs is not only a best practice today, if you store the ID somewhere (like your remote server), you actually must do it by law according to GDPR (see identifiers) and similar regulations.
[!TIP]
Virtual machines deployed from the same template often share the same machine ID. To differentiate them, include the MAC address when hashing.