MatthewKing / DeviceId

A simple library providing functionality to generate a 'device ID' that can be used to uniquely identify a computer.
MIT License
729 stars 118 forks source link

DeviceID returns different IDs? #34

Closed Rabkonen closed 2 years ago

Rabkonen commented 2 years ago

Hello,

there is a problem with the library - maybe you can find out why the DeviceID returns different ID strings.

  1. I used the library direct with NuGet package
  2. I used the same function from my own library in COM Inteorp with Excel VBA

The strange thing is i get two different IDs from the library - but how i said its the same function. Under this is my "Testcode" with the two different outputs.

In the end you can see i tried first the DeviceID library and after that i used directly the System.Management. With the System.Management i get two times the same ID.

        string one = new DeviceIdBuilder().AddMachineName().ToString();
        string two = new DeviceIdBuilder().OnWindows(windows => windows.AddProcessorId()).ToString();
        string three = new DeviceIdBuilder().OnWindows(windows => windows.AddMotherboardSerialNumber()).ToString();
        string four = new DeviceIdBuilder().OnWindows(windows => windows.AddSystemSerialDriveNumber()).ToString();

        string uniqueID = new DeviceIdBuilder()
            .AddMachineName()
            .OnWindows(windows => windows
                .AddProcessorId()
                .AddMotherboardSerialNumber()
                .AddSystemSerialDriveNumber())
            //.OnLinux(linux => linux
            //    .AddMotherboardSerialNumber()
            //    .AddSystemDriveSerialNumber())
            //.OnMac(mac => mac
            //    .AddSystemDriveSerialNumber()
            //    .AddPlatformSerialNumber())
            .ToString();

        var mbs = new ManagementObjectSearcher("Select ProcessorId From Win32_processor");
        ManagementObjectCollection mbsList = mbs.Get();
        string id = "";
        foreach (ManagementObject mo in mbsList)
        {
            id = mo["ProcessorId"].ToString();
            break;
        }`

DeviceIDBuilder_COMInterop_Excel DeviceIDBuilder_VS_Winform DeviceID_vs_SystemManagement

Pinguu-dev commented 2 years ago

It's already encrypted what the device id builder you send.

Rabkonen commented 2 years ago

Yes i know that its already encrypted.

But you see in the first picture i have another ID like in the second picture. Its the same computer but another use of the library. So normally the ID should be the same.

MatthewKing commented 2 years ago

Hello. I don't understand the question. Can you upload a small repo that reproduces this issue? Thanks.