Here is a simple Encrypt and Decrypt. Very basic.
What you do is display the HDD or CPU serial code.
Then if encrypt it and send it back to your client, he/she then adds the encrypted code in and then your app decrypts the code and matches against the HDD or CPU code and if Matches they user can login.
public class Security
{
private const string Key = "31428571428571428571428571428571";
public static string SimpleEncrypt(string toEncrypt)
{
int len = toEncrypt.Length;
const int keyMin = 0;
int keyMax = Key.Length;
int count = 0;
List<char> encryptedCodes = new List<char>();
for (int i = 0; i < len; i++)
{
if (count == keyMax)
{
count = keyMin;
}
int asciiDec = ((int)(toEncrypt[i])) + Convert.ToInt32(Key[count]);
encryptedCodes.Add((char)asciiDec);
}
return new string(encryptedCodes.ToArray());
}
public static string SimpleDecrypt(string toDecrypt)
{
int len = toDecrypt.Length;
const int keyMin = 0;
int keyMax = Key.Length;
int count = 0;
List<char> encryptedCodes = new List<char>();
for (int i = 0; i < len; i++)
{
if (count == keyMax)
{
count = keyMin;
}
int asciiDec = ((int)(toDecrypt[i])) - Convert.ToInt32(Key[count]);
encryptedCodes.Add((char)asciiDec);
}
return new string(encryptedCodes.ToArray());
}
}
Please vote if this helps.