license_api/
hwid.rs

1
2use machineid_rs::{Encryption, HWIDComponent, IdBuilder};
3
4pub async fn get_hwid(use_disk_serial: bool) -> String {
5    let mut builder = IdBuilder::new(Encryption::SHA256);
6
7    // Change components for your purposes
8    builder
9        .add_component(HWIDComponent::SystemID)
10        .add_component(HWIDComponent::CPUCores)
11        .add_component(HWIDComponent::MacAddress)
12        .add_component(HWIDComponent::SystemID);
13
14    // Conditionally add disc serial based on a parameter
15    // Using disk serial may provide you more protection, but it maybe can't be used on some systems
16    if use_disk_serial {
17        builder.add_component(HWIDComponent::DriveSerial);
18    }
19
20    let hwid = builder.build("miracet").unwrap();
21
22    hwid
23}