NerdConcepts Posted September 5, 2007 Share Posted September 5, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/ Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/#findComment-342327 Share on other sites More sharing options...
NerdConcepts Posted September 5, 2007 Author Share Posted September 5, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/#findComment-342336 Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 Why would you need to reverse it? Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/#findComment-342343 Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/#findComment-342355 Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 Exactly lol Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/#findComment-342358 Share on other sites More sharing options...
NerdConcepts Posted September 5, 2007 Author Share Posted September 5, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/68103-solved-serial-number-like-registration/#findComment-342436 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.