Re: Code Encryption .. How to ??
by sauoq (Abbot) on Sep 16, 2005 at 22:37 UTC
|
How can i encrypt my code ??
Well, you don't want to just encrypt your code. You want to be able to run encrypted code. Right?
Short answer: you can't.
Long answer: you can, but it will be able to be circumvented and it will introduce inefficiencies, and you should probably question why you really want to do this anyway.
If you insist on trying, however, searching on Google for terms like "encrypt", "obfuscate", and "perl source" should get you started. I think there are a few source filters available on CPAN that will help.
-sauoq
"My two cents aren't worth a dime.";
| [reply] |
Re: Code Encryption .. How to ??
by CountZero (Bishop) on Sep 17, 2005 at 08:30 UTC
|
The question to ask is why do you want to encrypt your code?- It contains sensitive information (passwords and such). Answer: encrypting your code is the wrong way to do this. What is encrypted will have to be decrypted to run it, so the program itself will contain the information to do it and anyone with a little brains and time will be able to do it also and your passwords and other sensitive information will be out in the open before you know it.
- I want to protect my code from being used and stolen by someone else. Answer: even compiled code gets stolen and used. Ever heard of "software piracy"?
- My software contains such valuable/new/unique/genial ideas, I don't want anyone to know how I solved this problem. Answer: Someone said once : "If you want to hide your code, you probably don't want them to find out how crappy it is. But seriously: if you have found an new and easy way to factor large
prime numbers, get yourself a patent.
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] |
|
if you have found an new and easy way to factor large prime numbers, get yourself a patent.
I can factor large prime numbers in my head in constant time. Large composite numbers, on the other hand, are more difficult.
| [reply] |
|
| [reply] |
Re: Code Encryption .. How to ??
by diotalevi (Canon) on Sep 16, 2005 at 22:32 UTC
|
use File::Slurp 'write_file';
BEGIN {
write_file( "$0.gpg", q[ YOUR ENCRYPTED SOURCE HERE ] );
eval `gpg --symmetric --decrypt $0.gpg `;
}
| [reply] [d/l] |
Re: Code Encryption .. How to ??
by eyepopslikeamosquito (Archbishop) on Sep 17, 2005 at 02:37 UTC
|
| [reply] |
Re: Code Encryption .. How to ??
by BerntB (Deacon) on Sep 17, 2005 at 02:50 UTC
|
Check the Perl faq, part 3. There is question about how to compile programs
I recently looked at this myself, since I'm writing a hobby program implementing copyrighted information that I can't release.
The publisher gave the ok for public release to hobby programs in easily decompiled Java bytecode, so I am not too worried. (I could make it a web-only program.)
If you are more paranoid, check writing a C module.
| [reply] |
Re: Code Encryption .. How to ??
by nothingmuch (Priest) on Sep 17, 2005 at 23:23 UTC
|
For the god-only-knows-how-many-th-time, if the code can be run it can be decrypted. If you've encrypted the code, you can't run it without shipping the key with it. If the key is shipped, it's just the same as shipping decrypted source. The best effort you can make is to make the script really hard to read.
Perlmonks friars and upwards - please stop front paging these nodes - they have no signal, just noise.
| [reply] |
Re: Code Encryption .. How to ??
by mattr (Curate) on Sep 18, 2005 at 15:24 UTC
|
If you give people the code to execute it can be read. It is most easily read when you deliver source code as in Perl, however it is also most powerful then. My advice is to stop thinking about encryption. It is a never-ending vicious circle that just makes it more annoying for your customers.
If you don't care about the code being readable at execute time, but just want to lock it until then, well then you can use one of the various encryption modules on CPAN and force your customer to unlock it. But then it runs and can be read obviously.
The other possibility of course is for you not to deliver the code in the first place. Run a web service on your own server for those methods. | [reply] |
Re: Code Encryption .. How to ??
by Anonymous Monk on Sep 19, 2005 at 08:44 UTC
|
You can use 'perl2exe' http://www.indigostar.com/perl2exe.htm. You can test it's free-dowload version and then purchase it if you like it. | [reply] |