private static string GetInfoToHash(string guid) { var cpuSerial = GetCpuID(); var macUUID = WindowsMacUtils.GetMAC_UUID(); var extraRigSeed = GetExtraRigSeed(); var infoToHash = $"NHM/[{cpuSerial}]-[{macUUID}]-[{guid}]-[{extraRigSeed}]"; return(infoToHash); }
public static string GetDeviceB64UUID(bool showInfoToHash = false) { var cpuSerial = GetCpuID(); var macUUID = WindowsMacUtils.GetMAC_UUID(); var guid = GetMachineGuidOrFallback(); var extraRigSeed = GetExtraRigSeed(); var infoToHash = $"NHM/[{cpuSerial}]-[{macUUID}]-[{guid}]-[{extraRigSeed}]"; if (showInfoToHash) { Console.WriteLine("NHM/[{cpuSerial}]-[{macUUID}]-[{guid}]-[{extraRigSeed}]"); Console.WriteLine(infoToHash); } Logger.Info("NHM.UUID", $"infoToHash='{infoToHash}'"); var hexUuid = GetHexUUID(infoToHash); return($"{0}-{GetB64UUID(hexUuid)}"); }
public static string GetDeviceB64UUID(bool showInfoToHash = false) { if (_deviceB64UUID != null) { return(_deviceB64UUID); } var(gotCachedHexUuid, cachedHexUuid) = GetCachedHexUUID(); if (gotCachedHexUuid) { _deviceB64UUID = $"{0}-{GetB64UUID(cachedHexUuid)}"; return(_deviceB64UUID); } var(macHexOK, macHex) = WindowsMacUtils.GetAndCacheMACHex(); var(systemGuidOK, systemGuid) = GetMachineGuidOrFallback(); var ok = macHexOK && systemGuidOK; if (!ok) { Logger.Error("NHM.UUID", $"Unable to read MAC or GUID read macHexOK='{macHexOK}' systemGuidOK='{systemGuidOK}'"); } var infoToHash = ok ? GetInfoToHash(macHex, systemGuid) : System.Guid.NewGuid().ToString(); if (showInfoToHash && ok) { Console.WriteLine("NHM/[{cpuSerial}]-[{macHex}]-[{guid}]-[{extraRigSeed}]"); Console.WriteLine(infoToHash); } else if (showInfoToHash) { Console.WriteLine("Fallback GUID"); Console.WriteLine(infoToHash); } Logger.Info("NHM.UUID", $"infoToHash='{infoToHash}'"); var hexUuid = GetHexUUID(infoToHash); CacheHexUUIDToFile(hexUuid); _deviceB64UUID = $"{0}-{GetB64UUID(hexUuid)}"; return(_deviceB64UUID); }