RPN algorithm for registration code implementation?

You must understand the Game Editor concepts, before post here.

RPN algorithm for registration code implementation?

Postby BeyondtheTech » Fri Jun 10, 2005 2:37 pm

I have actually devised my own registration code system in my upcoming release, Bubble Buster Advanced, however it would have been much easier if an RPN algorithm can be implemented to come up with a registration code, since it's pretty universal now (PocketGear, Handango, and many other sites have it built-in to their own website such that no author intervention is required, other than providing the RPN string).

Here's a full description of the algorithm, C source code, and examples found here:
http://www.mythological.com/regcode/

Reiterated by Handango:
http://www.handango.com/DeveloperInform ... GISTRATION

You can test out any algorithms here:
http://www.handango.com/RegCode.jsp

You can use this program with StyleTap (Palm Emulator for Pocket PC):
http://akeysoft.com/product_details.asp ... 0RPN%20Reg


Can this be implemented in Game Editor?

Code: Select all
example1:
   C/DUI = "Will P"
   RPN string = "i 0 == 111 * key + c 2 * +"
   result: "01151"
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score

Postby makslane » Mon Jun 13, 2005 11:39 pm

While not in Game Editor, you can, with few modifications, put the RPN code in the Global Code.

You must remove the #include lines, modify the main function to be your entry point function and put the code for strtok function (may be this: http://babbage.cs.qc.edu/courses/cs381.2/strtok.c.html) and other missing functions.

I think will work.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby BeyondtheTech » Tue Jun 14, 2005 1:54 am

Sorry, makslane, my experience in C is still in its infant stages... can anyone else put this together without pulling their hair out?
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score

Postby makslane » Tue Jun 14, 2005 4:26 am

Ok!

Download a sample at http://game-editor.com/examples/rpn_unlockkey.zip

Use the GetUnlockKey function to get the unlock key from a RPN algorithm and a reg code.

For example:
RPN Algorithm: key c +
Reg Code: 4A:6F:65:1E

char *keyString = GetUnlockKey("key c +", "4A:6F:65:1E");

If there is some error, the keyString will be empty.
In abose sample, keyString will be "00286"


For more information about the RPN algorithm in Global Code visit:
http://www.mythological.com/regcode/

See the copyright info into code.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby BeyondtheTech » Tue Jun 14, 2005 6:30 am

WOW, Makslane... you have just automated the registration process at Handango and PocketGear!! Thank you so much!!

The code was initially created for Palm users, so they were the ones who came up with that obnoxious RegCode hexadecimal string separated by colons and ended with a hex checksum. Handango and PocketGear no longer use that, so I took what common sense I had and hacked the code as necessary:

Increased the stack max size to 100 from 30, to accomodate longer names
#define STACK_MAX_SIZE 100


Increased the PUN string to 100 characters (never should get that long, but there's no limit on Handango on PocketGear, so 100 should be fair):
static char PUN[100];


And just pulled the Registration name (first-100 characters):
char *GetUnlockKey(char *rpn, char *reg_code)
{
char i;
static char keyString[6];

rpn_error[0] = 0;

strcpy(RPNString, rpn);
strncpy(PUN, reg_code,100); This line modified.

/* Parse input and compute Unlock key */

ParseRPNString();
// ComputePUNFromRegCode(RegCode); This line removed/remarked out.
unlockKey = ComputeUnlockKey(PUN/*, stackOperators*/);

/* Return Results */
FormatKey(unlockKey, keyString);

if(rpn_error[0]) return "";

return keyString;
}


Now, all one has to do is:
Code: Select all
actualcode = strcpy(text, GetUnlockKey("i 0 == 111 * key + c 2 * +","Will P");
if (actualcode == codeenteredbyuser) registered=1;


AWESOME!
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score

Postby makslane » Tue Jun 14, 2005 12:20 pm

One change:
if (strcmp(actualcode, codeenteredbyuser) == 0) registered=1;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby BeyondtheTech » Tue Jun 14, 2005 12:47 pm

Hehe... oops - i was mixing English with C. Thanks again, Makslane... Works like a charm!
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest