http://qs321.pair.com?node_id=529004


in reply to Hiding source code (in a country with no laws)

I'd create a key (like an md-5 hash) based on the current local time.
In the app, id set the date on what the md5 hash is based, and keep the software check the current date against the date set in the application (if altered, the md5 key has to change as well), and keep it working for as long as your contract is. eg, set a timeout date (second md5 hash).
This way, you can force your customer to renew it's license, and then you have to set two new dates in the application and create a new license file with the md5 keys in it.
But just like with any key, software etc. it's far from perfect.

#pseudo: my $sDate="01-01-2005"; my $eDate="01-01-2006"; checkKey( $sDate, $eDate ); # obfuscate this sub. sub checkKey() { my ($sDate,$eDate) = @_; require Digest::MD5 qw(md5_hex); # md5 keys of your license file: my $k1 = "deda6aea2f525d96806cb8fa18998d94"; my $k2 = "00026573e6a61456bb57336800bf663e"; my $k3 = "9533f158f330713d6e7e2cbdeaf245ea"; if( md5_hex($sDate) eq $k1 && md5_hex($eDate) eq $k2 && md5_hex($sDate . $eDate) eq $k3 && $eDate < $currentdate ) { return 1; #allowed to run } else { return 0; #renew your license! } }
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.