https://github.com/taptiive/machineid-rs
Create a unique MachineID/HWID/UUID with customizable options, like .Net DeviceId
https://github.com/taptiive/machineid-rs
auth authentication deviceid hardware-id hardwareid hostid hwid library login machineid rust uuid
Last synced: 3 months ago
JSON representation
Create a unique MachineID/HWID/UUID with customizable options, like .Net DeviceId
- Host: GitHub
- URL: https://github.com/taptiive/machineid-rs
- Owner: Taptiive
- Created: 2021-07-29T19:30:16.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-08T21:57:41.000Z (almost 2 years ago)
- Last Synced: 2025-12-14T03:13:21.709Z (6 months ago)
- Topics: auth, authentication, deviceid, hardware-id, hardwareid, hostid, hwid, library, login, machineid, rust, uuid
- Language: Rust
- Homepage:
- Size: 49.8 KB
- Stars: 81
- Watchers: 3
- Forks: 35
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/Taptiive/machineid-rs/actions/workflows/action.yml)
## MachineID for Rust - Like .Net DeviceId
This Rust package is inspired by [DeviceId](https://github.com/MatthewKing/DeviceId), a .Net package to build a unique Machine ID.
### Features
- 3 Different types of hash (*MD5*, *SHA1*, *SHA256*)
- Different components to make the ID
- Support for Windows, Linux and MacOS
- No Admin privileges are required
### How to use
First add this to your Cargo.toml file
```toml
[dependencies]
machineid-rs = "1.2.4"
```
Then, you need to define the builder variable with the encryption type you want.
For example, **SHA256**
```rust
use machineid_rs::{IdBuilder, Encryption};
// There are 3 different encryption types: MD5, SHA1 and SHA256.
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
use machineid_rs::HWIDComponent;
builder.add_component(HWIDComponent::SystemID).add_component(HWIDComponent::CPUCores);
```
Once you are ready, you just need to build the id with your key
```rust
let hwid = builder.build("mykey").unwrap();
```
### Todo
- Optimize the code
- Fix bugs and increase platform integration/stability
*Feel free to report any bug you find! ;)*