how can get device hardware info and generate a unique value with combining them ? for example i want a generate a unique code with (CPU serial number + ram serial number + ethernet mac address or etc) so how can i get CPU or Ram serial number in UWP ?
I find HardwareIdentification class in Windows.System.Profile namespace for generate UniqueID.
var token = HardwareIdentification.GetPackageSpecificToken(null);
using (DataReader reader = DataReader.FromBuffer(token.Id))
{
byte[] bytes = new byte[token.Id.Length];
reader.ReadBytes(bytes);
string uniqueCode = Encoding.ASCII.GetString(bytes);
}
For more information you can see Microsoft Document
To do that make sure you enable TPM on your target device, for enabling TPM you must installed it from TPM Configuration Tab in Windows device portal.
Tips : Raspberry pi doesn`t have any internal TPM so you must select Software TPM Emulator (NoSecurity) then install it, for Intel minnow board max and qualcomm dragonboard you can choose other options. after set and install TPM the device reboot, when it boot again the generated code which you can see on top always be unique.