Encode and decode script?

Is it possible to encode a php script that can't be decoded or at least the most secure way?

preguntado el 24 de agosto de 12 a las 00:08

Why would you encode a script so it can't be decoded? Are you comparing hashes of scripts? I can't imagine any other reasonable use. -

2 Respuestas

Yes, but the PHP script will not be able to encode and decode itself. You would need to write another program to do it on behalf of the PHP script. However, you can obfuscate the text using the combination of base64_decode y eval. This allows you to insert code so that someone cannot do a simple Ctrl+F search for a function that may be foreign. For example this is "Hello World":

eval(base64_decode("ZWNobyAiSGVsbG8gV29ybGQiOw=="));

This applies to the content of the PHP code, not the file.

Respondido 24 ago 12, 00:08

You mean that you want to distribute your code, but not let anyone else read / decompile it.

Zend write PHP, so the best place would be to consider using their encoder for this purpose: http://www.zend.com/en/products/guard/ You can also add licencing to the distribution.

There are others out there that obfuscate code - but obfuscation doesn't stop people copying it and, in many cases, won't stop someone from editing it if they really want to.

Respondido 24 ago 12, 02:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.