|
-
June 13th, 2005, 09:08 AM
#1
Registration Keycode Generation References?
Hello,
I've searched the net and several forums for a while, and I have not been able to find any references on algorithms to generate product "registration keycodes". There is an example in this site on how to make a dialog to enter a registration code, but it does not do anything about the code itself.
I'm helping my family with a software they want to distribute, and we want to have product codes on it for a little piracy protection (I know they are not foolproof at all, but at least is a little speedbump). Because we expect many people to use the program who know each other, we need to create a few thousand unique codes, which are random enough that people will not simply "add 1" and it will work (a centralized database in each location helps us to make sure two people don't use the same code - we are willing to take the risk of people copying the code in multiple locations), and have an algorithms that will identify them. We want to hand out programs with a keycode, rather than creating one depending on the registration name.
If anyone here knows of a good algorithm already, or can point me to a good book/website reference, please let me know.
Thank you!
Alvar
-
June 13th, 2005, 12:06 PM
#2
Re: Registration Keycode Generation References?
It's not really a problem to provide uncrackable serial numbers. It's a problem to demand the uniqueness of them so that on different computers you'll get different but stable values and that program itself can be modified to not check the number.
You can use asymmetrical encryption. The idea is that your client sends you summary of registration information (with your programm-provided unique information identifying computer), and you encrypt it with encyphering key know only to your key-generator. The resulted information you send back as registration key. Copies of your programm hold (public) deciphering key, decypher that key and compare that information with original provided by user. If this scheme is implemented properly, it's impossible to write keygen. But without the great effort in protecting programm's code itself and correctness of that "unique" information (apparently if you can "blind" the programm and provide the same information to be packed as identification of the computer, you can reuse the same key), it's very simple to crack such protection, though it wouldn't be as elegant as keygen...
"Programs must be written for people to read, and only incidentally for machines to execute."
-
June 21st, 2005, 03:28 AM
#3
Re: Registration Keycode Generation References?
Hi !
U are not the only person to search 4 serial registration algorithm !
i did find 1 source code though its called "Active Lock" but its written in vb 6.0 and thats a problem now cause im using c# ! Anyway im a c++ programmer as well which is a huge advantage !I did various reasearch and found myself going though reverse engineering asm code and c++ code what do u know i went mad trying to understand asm dam !anyway took about a 1/2 year but then......
I created my own CSharp version of a registartion serial code algorithm
for .net it works maybe not hack proof as u already know nothing is full proof!
if you want the registration.dll + keygen e-mail me i will be happy to give u a copy of my work !
for now the serial input format looks like this it only consists of numbers like this
serial --> 12345-12345-12345-12345
username --> Trance Junkie
------------------------------------------------------------------
g i am setting at the office and i will try to give the source off the top of my head DONT USE THIS CODE ITS ONLY A DEMO !!%^$@$%
written in c#
string CalculateSerial(string username)
{
// Set up fake registers
long eax = 0XFFFF ;
long esi = 0XB1EF ;
long ebp = 0XFC14 ;
long m = 0XFFFF ;
long n = 0XB1EF ;
long s = 0XFC14 ;
long serial 0xFFFFFF;
//
// Now go wild with some math.
// Get the username string length
int Usrnamelength = username.getstrlen();
// now computate the serial number.
eax + esi += n ;
s += eax >> 0XFC14 ;
ebp = s + eax - Usrnamelength + 5 ;
n+= 0xAF11 ;
serial = eax + s + n ;
return (serial);
}
Well u get the picture !
[email protected]
Last edited by Reactance; June 21st, 2005 at 03:52 AM.
-
June 24th, 2005, 11:32 PM
#4
Re: Registration Keycode Generation References?
I have a little code that may help. It's in C#:
--------------------------------------------------------
using System;
using System.Collections;
namespace MyArray
{
class Program
{
const int keysToGenerate = 50; // You can change this to the numer of keys you need to generate
const int keyLength = 25; // 25 hexidecimal numbers gives you a large pool of keys to play with
// arbitrary company information - change or eliminate as needed
// if you eliminate, most of the code below may also be eliminated
const string CompanyID = "A";
const string ProductID = "A2";
const string CountryID = "C";
/// <summary>
/// Entry point to application
/// </summary>
/// <param name="args">Command line arguments</param>
/// <remarks>This routine generates hexidecimal registration keys</remarks>
static void Main(string[] args)
{
ProductKeys ProductKey = new ProductKeys();
Random r = new Random(); // Used to create unique keys
string s = ""; // Stores a 25-character hex value representation
int IdPointer = 0;
/* The complete product identifier
* Note that this coulde be placed anywhere, in any order, or not at all
* in the ProductKey */
string ProductCode = CompanyID + ProductID + CountryID;
for (long k = 0; k < keysToGenerate; k++)
{
s = r.Next(16).ToString("X"); // Generate an initial code character
/* Generate a random location within the string to place ProductCode
* This number, in this case, is based on the ProductKey 0-based index
* I.e., if IdPointer = 4, then the string begins at s[4] */
IdPointer = r.Next(2, 16); // Max value is F to fit in the one-character space provided
/* Second character indicates ProductCode location
* This could be placed at any known location in the string
* We place it here for code clarity */
s += IdPointer.ToString("X");
// append additional characters
while (s.Length < IdPointer)
{
s += r.Next(16).ToString("X");
}
s += ProductCode; // Insert the product identifier
// complete the string
while (s.Length < keyLength)
{
s += r.Next(16).ToString("X");
}
// Check if it's already in the list, if not add it
if (!ProductKey.Contains(s))
{
ProductKey.Add(s);
}
s = ""; // clear the temp field
}
// Sort the list, not needed but easier for viewing
ProductKey.Sort();
// Store the list in a table
ProductKey.SaveToCorporateTable();
#if DEBUG
System.Console.ReadLine();
#endif
}
private class ProductKeys : ArrayList
{
public bool SaveToCorporateTable()
{
// Place streaming or ADO code here
return true;
}
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|