0

I have written a software, in which i will read the CPU-ID and i will display the CPU-ID to the user as a Software Serial Key and it will request for a confirmation key to login to the software. The user has to mail me that CPU-ID (Serial Key) so that i have to generate a confirmation key and send it back to the user to login.

I am using Linux and C

Here is the code i have used to get my CPU-ID

Sample CPU-ID Looks like this : 0103-06A9-0123-0100-8974-4587

I will be thankful if anyone help me to generate a simple encrypted serial number and to generated a confirmation key. Thank you.

Note : If the key is displayed in readable format then it will be better.. i.e, without special characters...

char CPU[30]; //24 Hex digits, PROCESS_SERIAL_NUM
int varEAX, varEBX, varECX, varEDX;
char str[9];
__asm__ __volatile__ ("cpuid"   : "=a" (varEAX), "=b" (varEBX), "=c" (varECX), "=d" (varEDX) : "a" (1));
sprintf(str, "%08X", varEAX); //i.e. XXXX-XXXX-xxxx-xxxx-xxxx-xxxx
sprintf(CPU, "%C%C%C%C-%C%C%C%C", str[0], str[1], str[2], str[3], str[4], str[5], str[6], str[7]);
__asm__ __volatile__ ("cpuid"   : "=a" (varEAX), "=b" (varEBX), "=c" (varECX), "=d" (varEDX) : "a" (3));
sprintf(str, "%08X", varEDX); //i.e. xxxx-xxxx-XXXX-XXXX-xxxx-xxxx
sprintf(CPU, "%s-%C%C%C%C-%C%C%C%C", CPU, str[0], str[1], str[2], str[3], str[4], str[5], str[6], str[7]);
sprintf(str, "%08X", varECX); //i.e. xxxx-xxxx-xxxx-xxxx-XXXX-XXXX
sprintf(CPU, "%s-%C%C%C%C-%C%C%C%C", CPU, str[0], str[1], str[2], str[3], str[4], str[5], str[6], str[7]);

printf("%s\n", CPU); //compare with: lshw | grep serial:
user3661448
  • 45
  • 1
  • 9
  • My Cpu serial number is `serial: To Be Filled By O.E.M.` how are you planning on dealing with that? – Rolf of Saxony Dec 06 '15 at 15:22
  • You are right Rolf, CPU-ID will be a unique id filled by the Manufacturer. Now we need an algorithm to generate a Confirmation Key which is co-related with that particular CPU-ID. – user3661448 Dec 06 '15 at 18:22
  • My point was, that my PC doesn't appear to have a cpu-id but the disks have serial numbers and there is a NIC address but that is changeable. – Rolf of Saxony Dec 07 '15 at 10:49

0 Answers0