Jump to content

[SOLVED] Serial Number like registration?


NerdConcepts

Recommended Posts

Everyone knows how computer software uses serial numbers. I'm wanting to do something like this. I have addons for the site system thing I have been working on. And when someone purchases an addon I want them to be able to go into the configuration and input a serial number, it will then check that serial number and if it is valid it will go ahead and activate the addon. I know how to everything except how to script a generator and a checker for the serial numbers...not sure where to start.

Link to comment
Share on other sites

You could use multiple hash functions and use some operations between the two. This would keep them from being able to generate their own with a known hash function. You can do anything you want with a serial number. You accept a string as the username or something that the serial will be generated from and just perform a bunch of mutations on it (that can't be reversed.) You use that function when you give someone the serial, and the same one to check if it is the correct serial.

Link to comment
Share on other sites

I know how to create a mHASH but no idea how to reverse it. Here is something quick I wrote to do a test.

 

<?php
$input = "mod_wholesale";
$coder1 = "coder1";
$coder2 = "coder2";
$hash = mhash(MHASH_MD5, $input, $coder1);
$hash = mhash(MHASH_MD5, $input, $coder2);
echo bin2hex($hash) . '<br />';
?> 

 

I keep looking for something telling me how to reverse it, but I cannot find anything.

 

*EDIT*

output from that is : 8c8a8ffce13430a4182660b38f889bc1

not sure if that matters

Link to comment
Share on other sites

The point of a hash is that you can't reverse it. Instead of reversing it, just check against the string you used to create it. For example, you give the user "user1" a serial by the funcion hash("user1"). When the user tries to use that serial, you check the given serial against hash("user1"). No reversing needed.

Link to comment
Share on other sites

Well what I was going to do was make something like a "real serial number" system. Where each of the serial numbers were different. And when you put in the serial number into the software to activate the addon it would check the serial number and make sure it was a valid serial number. That is why I didn't really get why to user a Hash sense it's not a different "number" each time it's generated.

 

edit: nm, I got it. I use the Core systems serial number (which I make up pretty much) and use that to generate a hash and then check it with the software when someone tries to activate an addon. Thanks a bunch

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.