var Key = Registry.CurrentUser.OpenSubKey(@"Software\Program");
var textKey = Key.GetValue("Key")?.ToString();
Key.Close();
string keydata = CryptoKey.DecryptStringFromBytes_Aes(textKey, keyForDes, CryptoKey.keybyte);
var keyDataSplit = keydata.Split('_');
//0697KG5H0AB73R6R8XV46GYMYRFV2EFMEA9SWAJGXP84YAVXZXW0
string machineAnswer = keyDataSplit[0];
//0697KG5H0AB73R6R8XV46GYMYRFV2EFMEA9SWAJGXP84YAVXZXW0
string machineName = new DeviceIdBuilder()
.AddMachineName()
.AddMacAddress()
.ToString();
//false
bool machine = machineAnswer.Trim().ToLower() == machineName.Trim().ToLower();
(int, char, char) FindFirstDifference(string a, string b)
{
var length = Math.Min(a.Length, b.Length);
for (int i = 0; i < length; i++)
{
if (a[i] != b[i])
return (i, a[i], b[i]);
}
if (a.Length == b.Length)
return (-1, '\0', '\0');
return (length, a.Length == length ? '\0' : a[length], b.Length == length ? '\0' : b[length]);
}