Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Obfuscate my perl code

by Fastolfe (Vicar)
on Oct 27, 2000 at 18:23 UTC ( [id://38817]=note: print w/replies, xml ) Need Help??


in reply to Obfuscate my perl code

I don't know of any scripts to do this automatically, because it's generally considered pretty silly. Your code is copyrighted by yourself (unless you did it for them, in which case they own it and the copyright, obfuscation or no), and so long as you set down the terms of the license to your customer (being careful not to infringe upon any licenses for code you've included in your application, such as GNU or the Artistic license), they are bound to do with your software what you let them do. If they do not, sue them and revoke their license.

If you're still bent on trying to obfuscate the code for whatever reason, you'll just have to go about it by hand.. Change all of your variable names to, like, $a1, $a2, $a3, etc., remove white space and indentation, and perhaps encrypt static strings (via a simple XOR algorithm) so that it's difficult to read.

Finally, if you want to get real nasty about it, encode your script (via XOR or RSA if you feel it's necessary), put it in an __END__ block, and read/decode/eval on the fly.

Before you go through all of that work, though, ask yourself why you need this obfuscated. Perl code must be distributed in source form. It's not possible to keep people from figuring out how you do it. In the US at least, copyright and contract law (license) should offer you enough protection so that you don't have to worry about silliness like this.

Replies are listed 'Best First'.
RE: Re: Obfuscate my perl code
by mdillon (Priest) on Oct 27, 2000 at 20:06 UTC
    you keep saying that any work done for a third party on a hired basis devolves the copyright to the third party. this is not the case under current U.S. law as i understand it.

    for a work to be a "work for hire", it needs either to be created by an employee in the course of execution of his official capacity, or by an independent contractor.

    in the case of an independent contractor, written agreement is still necessary for the transfer of copyright to take place. such work does not automatically become the property of the client.

      It depends upon the nature of the work involved. If he's hired as a programmer for a company, 99% of the time, this involves him turning over any license/title/copyright to the company he's working for. If this is a customer wanting to license something he's written/writing/will write, by all means keep the copyright and just license out the work.

      Most people, however, working with a 'programmer' title for a company, have no claim over the work they're producing. It belongs to the company.

      And again, this is all subject to the terms of the contract and whether or not he's working for an employer, or providing a solution to a customer, etc.

RE: Re: Obfuscate my perl code
by elwarren (Priest) on Oct 27, 2000 at 20:10 UTC
    What do you mean do it by hand? He's got perl :-) It shouldn't be too challenging to put together some perl that will go through and replace $counter with $a1 and then track the relationships. So when you want to send out your code you just run it through your translator.
Better variable names than that...
by blogan (Monk) on Oct 28, 2000 at 02:40 UTC
    If you want to obfuscate, have variables that consist of 1's and l's (that's a digit and a lowercase letter). Same for function's.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found