In order to decrease the distribution of serial keys over ‘bad’ hacking sites, I would like to present a feature that probably will be released in SKGL 2.1.1.0 – Machine code locking. This means that each serial key will have support for machine code storage, so that the serial key is bounded to a single computer. As you know, the project is open source, and you can join it whenever you want to (http://skgl.codeplex.com/). If you think I should change something, please write to me or comment this post. Good Luck!
static string getMachineCode() { /* * Copyright (C) 2012 Artem Los, All rights reserved. * * This code will generate a 5 digits long key, finger print, of the system * where this method is being executed. However, that might be changed in the * hash function "GetStableHash", by changing the amount of zeroes in * MUST_BE_LESS_OR_EQUAL_TO to the one you want to have. Ex 1000 will return * 3 digits long hash. * * Please note, that you might also adjust the order of these, but remember to * keep them there because as it is stated at * (http://www.codeproject.com/Articles/17973/How-To-Get-Hardware-Information-CPU-ID-MainBoard-I) * the processorID might be the same at some machines, which will generate same * hashes for several machines. * * The function will probably be implemented into SKGL Project at http://skgl.codeplex.com/ * and Software Protector at http://softwareprotector.codeplex.com/, so I * release this code under the same terms and conditions as stated here: * http://skgl.codeplex.com/license * * Any questions, please contact me at * * artem@artemlos.net */ ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Processor"); string collectedInfo = ""; // here we will put the informa foreach (ManagementObject share in searcher.Get()) { // first of all, the processorid collectedInfo += share.GetPropertyValue("ProcessorId").ToString (); } searcher.Query = new ObjectQuery("select * from Win32_BIOS"); foreach (ManagementObject share in searcher.Get()) { //then, the serial number of BIOS collectedInfo +=share.GetPropertyValue("SerialNumber").ToString (); } searcher.Query = new ObjectQuery("select * from Win32_BaseBoard"); foreach (ManagementObject share in searcher.Get()) { //finally, the serial number of motherboard collectedInfo+= share.GetPropertyValue("SerialNumber").ToString(); } return GetStableHash(collectedInfo ).ToString (); } static public int GetStableHash(string s) { /* * modification of code from: * http://stackoverflow.com/questions/548158/fixed-length-numeric-hash-code-from-variable-length-string-in-c-sharp * * modified by Artem Los * */ const int MUST_BE_LESS_OR_EQUAL_TO = 100000; uint hash = 0; foreach (byte b in System.Text.Encoding.Unicode.GetBytes(s)) { hash += b; hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); int result = (int)(hash % MUST_BE_LESS_OR_EQUAL_TO); int check = MUST_BE_LESS_OR_EQUAL_TO / result; if (check > 1) { result *= check; } return result; }