Click here to Skip to main content
13,736,966 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
How to generate and give serial number and validate it in windows application during deployment Visual Studio 2005 :(
Posted 20-Sep-10 21:20pm
Updated 21-Sep-10 0:09am
v4
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
thalir 21-Sep-10 8:40am
   
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
stylez500 17-Feb-12 19:14pm
   
Could you send that project plz
stylez500 17-Feb-12 19:14pm
   
I have 1 but mind is more complicated your look really simple
rashi543 23-Feb-12 8:39am
   
but how and where to use it
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Google "C# serial number in my application".
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 21 Sep 2010
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100