Skip to content

Generate unique hardware id in C# (windows only), .net nativeAot friendly

Notifications You must be signed in to change notification settings

kingcomxu/KLib.DeviceId

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KLib.DeviceId

Generate unique hardware id in C# (windows only), .Net NativeAot friendly

Quick Start

KxDeviceIdBuilder builder = new KxDeviceIdBuilder();
builder
    .AddMachineName()              //from Environment
    .AddOSVersion()                //from Environment 
    .AddMacAddress()                //NetworkInterface 
    .AddMachineGuid()               //from registry LocalMachine SOFTWARE\Microsoft\Cryptography MachineGuid
    .AddWindowsProductId()          //from registry LocalMachine SOFTWARE\Microsoft\Windows NT\CurrentVersion ProductId
    .AddWindowsDeviceId()           //from registry LocalMachine SOFTWARE\Microsoft\SQMClient MachineId
    .AddWindowsRegistryToken()      //from registry CurrentUser SOFTWARE\KLib.DeviceIdToken valueName ?? Process.GetCurrentProcess().ProcessName 
    .AddProcessorInfo()             //WmiLight  SELECT * FROM Win32_Processor
    .AddSystemUuid()                //WmiLight  UUID FROM Win32_ComputerSystemProduct
    .AddMotherboardInfo()           //WmiLight  SELECT * FROM Win32_BaseBoard 
    .AddSystemDriveInfo()           //WmiLight  Win32_DiskPartition Win32_DiskDrive 
    ;

 
Console.WriteLine(builder.ToString()); 
Console.WriteLine(builder.ToHashString()); 

Links

About

Generate unique hardware id in C# (windows only), .net nativeAot friendly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages