Getting unique key
-
hii I am generating key based on cpu id using following code public static string GetProcessorID() { string sProcessorID = ""; string sQuery = "SELECT ProcessorId FROM Win32_Processor"; ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery ); ManagementObjectCollection oCollection = oManagementObjectSearcher.Get(); foreach(ManagementObject oManagementObject in oCollection ) { sProcessorID = (string)oManagementObject["ProcessorId"]; } return (sProcessorID); } But i find that the generated id is not unique. is there any other way to generate unique id based on cpu? as i want to secure my software from piracy thanks in advance
-
hii I am generating key based on cpu id using following code public static string GetProcessorID() { string sProcessorID = ""; string sQuery = "SELECT ProcessorId FROM Win32_Processor"; ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery ); ManagementObjectCollection oCollection = oManagementObjectSearcher.Get(); foreach(ManagementObject oManagementObject in oCollection ) { sProcessorID = (string)oManagementObject["ProcessorId"]; } return (sProcessorID); } But i find that the generated id is not unique. is there any other way to generate unique id based on cpu? as i want to secure my software from piracy thanks in advance
Have you had a look at GUID's..? They are unique (some even use them as database primary keys :) ) To generate one :
Guid guid = new Guid(); guid = Guid.NewGuid(); string unique = guid.ToString();
A dogged, arrogant belief in self and the childlike idealism that comes with not knowing my limits. This is my greatest blessing, my priceless attribute.
-
Have you had a look at GUID's..? They are unique (some even use them as database primary keys :) ) To generate one :
Guid guid = new Guid(); guid = Guid.NewGuid(); string unique = guid.ToString();
A dogged, arrogant belief in self and the childlike idealism that comes with not knowing my limits. This is my greatest blessing, my priceless attribute.
If you need a unique number that is always the same when regenerated, you can always ask a hashcode on a unique string, as long as you manage to create the same string. Here is a modified version of the previous answer to illustrate the idea: Guid guid = new Guid(); guid = Guid.NewGuid(); string unique = guid.ToString(); int uniqueInt = unique.GetHashCode();
Jean-Christophe Grégoire
-
Have you had a look at GUID's..? They are unique (some even use them as database primary keys :) ) To generate one :
Guid guid = new Guid(); guid = Guid.NewGuid(); string unique = guid.ToString();
A dogged, arrogant belief in self and the childlike idealism that comes with not knowing my limits. This is my greatest blessing, my priceless attribute.
-
I want to generate unique id for a particular purpose ie Generating Unique Key for a Computer for Licensing Purpose
sumit7034 wrote:
Unique Key for a Computer for Licensing Purpose
GUID represents a globally unique identifier. So do not worry.
Tan Li I Love KongFu~
-
sumit7034 wrote:
Unique Key for a Computer for Licensing Purpose
GUID represents a globally unique identifier. So do not worry.
Tan Li I Love KongFu~
-
hii I am generating key based on cpu id using following code public static string GetProcessorID() { string sProcessorID = ""; string sQuery = "SELECT ProcessorId FROM Win32_Processor"; ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery ); ManagementObjectCollection oCollection = oManagementObjectSearcher.Get(); foreach(ManagementObject oManagementObject in oCollection ) { sProcessorID = (string)oManagementObject["ProcessorId"]; } return (sProcessorID); } But i find that the generated id is not unique. is there any other way to generate unique id based on cpu? as i want to secure my software from piracy thanks in advance
-
Every time it generate a new id. i don't want this i want a unique id for a particular pc so that it don't match with the id of other computer
I see, in this case, you can use the MAC address as the unique ID for PC. Of cource, you can also generate the license file through MD5. Everytime the app runs, check the license file firstly.
Tan Li I Love KongFu~