views:

74

answers:

2

I once stumbled upon an online PHP source code "obfuscator" that scrambled the code using a combination of str_rot13 and uuencode. The obfuscated source was a string being executed through eval().

I don't remember the site's name – is there a way to make code unreadable using abovementioned functions?

EDIT: I think the obfuscator also made use of some base64 encoding but I'm not sure.

+4  A: 

http://stackoverflow.com/tags/php/info

Q. Can I protect my PHP code from theft? If so, how?
A. There is no effective technical solution to protect, encode or encrypt PHP source code. There are many products that offer some levels of protection, but all can be broken with time and effort. Your best option is not a technical solution, but a legal solution in the form of a license agreement.

Wrikken
My aim is to stop some people wanting to see the actual code by just "scaring" them off – they won't notoriously try to hack the code. No need for a license agreement in my case.
Daniel
+1  A: 

There are some PHP obfuscators, freeware (like Code Eclipse) and commercial ones (like the ionCube PHP Encoder).

But even if you distribute "binary" code that will run on a Zend PHP only (like with Zend Guard), it can always be reverse-engineered. You can only scale the amount of work it takes to recover source from your code, but you can never make it completely disappear.

Think about why you want to hide your code. Does it look ugly? Use a formatter and refactoring, little work with fast results. Has it obvious bugs? Fix them, it's less work too. You don't want others to learn your "trade secrets" how you did certain things? Then choose another language, and that should be a compiled one. And even then...

In general, every code can be reverse-engineered or decompiled sooner or later.

foo