This Rust package is inspired by DeviceId, a .Net package to build a unique Machine ID.
First add this to your Cargo.toml file
toml
[dependencies]
machineid-rs = "1.1.2"
Then, you need to define the builder variable with the encryption type you want.
For example, SHA256 ```rust use machineid_rs::{Encryption, IdBuilder};
let mut builder = IdBuilder::new(Encryption::SHA256); ```
After that, you just need to add the components you want the id to have.
The available components are:
System UUID: Unique identifier of your machine
CPU Cores: Number of physical cores from your computer
OS Name: Operative System name, i.e., linux/windows
Username: The username currently being used
Machine Name: The name of the machine
CPU ID: The serial number of the processor
Drive Serial : The serial number of the disk storing the OS.
For example, i will add the System UUID and CPU Cores
rust
builder.add_system_id().add_cpu_cores();
Once you are ready, you just need to build the id with your key
rust
let unique_id = builder.build("your key");
Feel free to report any bug you find! ;)