Results 1 to 8 of 8
Thread: Two licensing algorithms
-
12-05-2014, 02:49 AM #1Junior Guru Wannabe
- Join Date
- May 2014
- Posts
- 31
Two licensing algorithms
For some reasons I don't want to use SPBAS or PHPLicengine or ionCube licensing. Instead I want to create my own licensing. I evaluated these two solutions and Kayako and noticed SPBAS does serialize+base64_encode an array containing license data and concatenate it with "spbas" separator and with a md5 hash of that array with a secret key to make sure that array is not tampered. But PHPLicengine and Kayako use a complicate math formula to encode/decode the data with a key without any need to particular extensions like openssl or mcrypt.
Which way do you recommend me to go? the way SPBAS uses or PHPLicengine and Kayako use?
-
12-05-2014, 05:44 AM #2Web Hosting Guru
- Join Date
- May 2011
- Location
- Columbus, Ohio
- Posts
- 270
Assuming you are distributing the code to be licensed as .php files only, then go with simplest method. No need to make things complicated that can easily be changed via the PHP scripts anyhow.
As a hint, using a program like SourceCop does next to nothing in protecting your code.This signature intentionally left blank.
-
12-05-2014, 07:54 AM #3Junior Guru Wannabe
- Join Date
- May 2014
- Posts
- 31
I didn't uderstand what you are saying. Anybody else please?
-
12-05-2014, 08:32 AM #4Web Hosting Guru
- Join Date
- May 2011
- Location
- Columbus, Ohio
- Posts
- 270
If you are going to distribute the code you want licensed as just plain .php files, and not complied with something like ionCube or NuCoder, then I would recommend going the basic route of just returning a serialized array. Complicating it with math formulas and/or encoding it so that it not easily "readable" just adds about 60 more seconds of work for someone wanting to strip out the licensing of the code.
I mentioned SourceCop, as I have seen people use that where they think it will hide the source code. Then they do fancy calculating with data that they think no one will know how it is done (example deciding a fancy license response). Easily defeated (and puts more load on server than need be)This signature intentionally left blank.
-
12-05-2014, 08:41 AM #5Junior Guru Wannabe
- Join Date
- May 2014
- Posts
- 31
Of course I will do obfuscate the source with ionCube. I meant about locking on domain/ip which method I described from PHPLicengine and SPBAS is better? The source will be ionCubed anyway.
-
12-07-2014, 02:03 AM #6Junior Guru Wannabe
- Join Date
- May 2014
- Posts
- 31
An answer?
-
12-07-2014, 06:25 AM #7Web Hosting Guru
- Join Date
- May 2011
- Location
- Columbus, Ohio
- Posts
- 270
Well since you will be semi protecting the code, then no need to do too much of anything fancy. Something like this would work:
PHP Code:function dataEncodeIsh( $data ) {
$data = str_split( strrev( trim( base64_encode( serialize( $data ) ), '=' ) ) );
$intDataLen = count( $data );
$intRandChar = mt_rand( 55, 116 );
if ( $intRandChar < 65) { $intRandChar -= 7; }
elseif ( $intRandChar > 90) { $intRandChar += 6; }
$strReturn = str_repeat( chr( $intRandChar ), $intDataLen + 1 ) ;
for ( $c = $intDataLen; $c > 0; $c-- ) {
$intPos = ord( $strReturn{ $c } ) % $c;
$strReturn{ $c-1 } = $data[$intPos];
unset($data[$intPos]);
$data = array_values($data);
}
return $strReturn;
}
function dataDecodeIsh( $strData ) {
$intDataLen = strlen($strData);
$strReturn = $strData{0};
for ( $c = 2; $c < $intDataLen; $c++ ) {
$intPos = ord( $strData{ $c } ) % $c;
$strReturn = substr($strReturn,0,$intPos) . $strData{$c-1} . substr($strReturn,$intPos);
}
$data = unserialize( base64_decode( strrev( $strReturn ) ) );
return $data;
}
Last edited by TwineDev; 12-07-2014 at 06:33 AM.
This signature intentionally left blank.
-
06-15-2015, 09:56 AM #8Junior Guru Wannabe
- Join Date
- May 2014
- Posts
- 31
Hi TwineDev,
Sorry to not thank you before, I was offline for a few months and I saw your answer just now!
Thank you for the help. Anyway, I decided to go with ionCube licensing and for an online ionCube license handler, I posted this http://www.webhostingtalk.com/showthread.php?t=1489609
Thanks again for the useful code.
Similar Threads
-
load balancing algorithms
By josephgarbett in forum Dedicated ServerReplies: 3Last Post: 01-24-2012, 11:23 AM -
Best For Licensing
By shahaz in forum Web HostingReplies: 4Last Post: 10-11-2011, 07:20 AM -
Algorithms in Search Engines Usage
By boonchuan in forum Hosting Security and TechnologyReplies: 0Last Post: 07-04-2004, 03:53 AM -
Licensing
By The Laughing Cow in forum Programming DiscussionReplies: 10Last Post: 01-17-2003, 05:29 AM