Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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.

Replies are listed 'Best First'.
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!


      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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://529004]
[1nickt]: ... the end of the afternoon. marto How are you, snowed in? Mum and Dad expecting snow today in Surrey. (Have 5" on the ground here in NJ. And my son's high school in SOCal closed until after Xmas due to fires.)
[Corion]: 1nickt: In a sense the meta-bullshit might even be beneficial to you as you get to hear the cow-orkers talk (or not talk) about the issues you perceive. I think Agile is mostly about the meta ;)
[Corion]: 1nickt: On Sunday maybe 10cm of snow fell, and the airport closed, and the trains stopped running etc :) It always comes as a surprise that snow falls here during the winter...
[marto]: 1nickt, no snow, just some ice on the roads and the usual idiocy associated with humans and driving in less than ideal conditions
[1nickt]: Corion I am trying to keep an open mind :-) Or at least, go with the flow. marto yes I saw som photos of lorries overturned on country roads, and wondered why they would have been driving fast enough to have that happen!

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-12-11 11:52 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (289 votes). Check out past polls.