Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Hiding source code (in a country with no laws)

by jbrugger (Parson)
on Feb 09, 2006 at 05:56 UTC ( #529004=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Hiding source code (in a country with no laws)
Download Code
Re^2: Hiding source code (in a country with no laws)
by samtregar (Abbot) on Feb 09, 2006 at 18:07 UTC
    That may be the dumbest copy-protection scheme I've ever seen! What's to stop the client from editing just one line of your routine to read:

    return 1; #renew your license - NOT!

    Or better yet, just edit out the call to the subroutine in the first place!

    -sam

      Perhaps you did not uderstand me.
      It's just dummy code that gives an idea of what you could do, returning either 1 or 0 is just a boolean expression or calling it as a sub is just to help me explain what i ment to do, this is not a final solution, just an idea on how you could do something like this. How you implement it in your code is up to the programmer.

      The thing i ment to do, is showing a way to use dates to see if you've got a valid license, not the implementation itself.

      Anyway, using a license code is not an ideal idea anyway (as i said before), it allways can be hacked out. The OP however did ask not to be 100% safe on hidding source, just make it more difficult.

      The idea of calling for certin functions to your own server is a bad idea as well, it's not failsafe. It however gives fresh ideas to the OP so he can think of a proper solution to his problem.

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://529004]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2014-10-21 18:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls