Click here to Skip to main content
15,884,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir, I want to Generate a Registration Key on the Basis ofProcessor ID.
I require code to generate any string corresponding to Processor ID:BFEBFBFF0001067A
Posted

I'm not entirely sure what you want to do, but I would think you could just calculate a hash of your processor id string, like so:
C#
SHA512 sha = new SHA512Managed();
byte[] hash = sha.ComputeHash(Encoding.UTF8.GetBytes(myProcessorIdAsString));
StringBuilder sb = new StringBuilder(128);
foreach (byte b in hash)
    sb.Append(b.ToString("X2"));
string meKey = sb.ToString();
 
Share this answer
 
v2
Comments
LebneizTech 17-Aug-11 7:25am    
Thanks,
As I want to create a Registration Key(like:57057056807005675680583479268168406684684 or any other Format) to verify the Authentication, corresponding to ProcessorID(BFEBFBFF0001067A)

As You have provide the Code : How I use the line(SHA512 sha = new SHA512Managed();),means what is the Refrence for it.
Simon Bang Terkildsen 17-Aug-11 7:30am    
SHA512Managed
it's located in the System.Security.Cryptography namespace.
LebneizTech 17-Aug-11 7:53am    
Thank you,
It is working,I can use it.But it is too long.Can you suggest string like : BFEBFBFF0001067A => 57057056807005675680583479268168406684684
Simon Bang Terkildsen 17-Aug-11 8:07am    
you can use SHA256 a = new SHA256Managed(); it'll produce a sring of half the size (64 characters)
or MD5 md5 = MD5.Create(); which will produce a 32 character long string
LebneizTech 17-Aug-11 8:24am    
Thank you, Working Fine.
Can you help further to generate a KEY independant to PC,so that I can Authenticate through Internet YEARLY to a Client(means a key for a CLIENT yearly).
Tying an application to a processor is a bad idea. If someone paid for your software, they should be able to install it on any machine they own. What you should do is implement an online registration verification system. This allows you to a) track who's using your software, and b) allow the user to have N number of installs.
 
Share this answer
 
Comments
LebneizTech 17-Aug-11 7:20am    
How can I Implement it.Means what is code for it ?
Simon Bang Terkildsen 17-Aug-11 7:37am    
That really depends on your target audience. If your target audience is the privat citizen then you're correct, but if it's a business entity then internet access might not be present.
I don't like the idea of restricting, something you've paid for, to a single computer either though.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900