1

我想以简单的方式保护 PHP 源代码。

这是一个例子。

 $a = "\x46\122" . chr(578813952>>23) . "" . chr(0105) . "\x2d"; 
 $b = "\x73" . chr(847249408>>23) . "" . chr(0162) . "\x69" . chr(0141) . "" . chr(905969664>>23) . ""; 
 $c = "" . chr(0x53) . "" . chr(0105) . "\x52\x56" . chr(0105) . "\x52" . chr(796917760>>23) . "\x4e" . chr(545259520>>23) . "\x4d" . chr(0x45) . "";

这是。

$a="FREE-";
$b="serial";
$c="SERVER_NAME";

请帮我转换这种类型的字符串??

有 3 种类型的加密。

类型[1]:"\x46\122"
类型[2]:chr(0105)
类型[3]:chr(578813952>>23)

请帮我创建一个转换函数...从 PHP 字符串。

谢谢你 !

------------------------我更新问题--------------------

好的...我应该改变问题..

我想创建一个函数。

功能1。

$a = "FREE-";
echo function1($a);

---> 输出

"\x46\122" . chr(578813952>>23) . "" . chr(0105) . "\x2d";

在这个函数中,函数随机使用了 3 种逻辑。这是 3 种类型。

Type[1] : "\x46\122"
Type[2] : chr(0105)
Type[3] : chr(578813952>>23)

你可以帮帮我吗 ....

4

3 回答 3

30

坦率地说,这是一种“保护”代码的愚蠢方式。希望您意识到,一旦将代码交付给客户,他们可以简单地撤消所有这些并自己提取值?

使用法律手段保护代码。“这是我的代码,你不能分享它。如果你这样做,我会得到 50 kazillion 美元和你最漂亮的女儿的Droit de Seigneur,或者如果他们都丑陋,则额外获得 200 kazillion 代替”。

一个铁定的许可协议将比任何你想应用的谷物盒解码器环湿面巾纸方法提供更好的保护。

于 2011-05-12T20:02:54.093 回答
9

For further suggestions why this is a waste of your time:

Asked at 8:36, decoded at 8:44. Eight minutes of protection: https://stackoverflow.com/questions/5456462/what-does-this-php-code-do

Asked at 11:01, decoded at 11:17, and very-well analyzed at 11:47. Hacked, what does this piece of code do?

In the first case, I'm willing to bet the majority of the fastest poster's time was spent writing. So feel confident that however you try to obfuscate your code, it'll take only three or four minutes to undo whatever it is you've done.

How much time are you willing to put into obfuscating your code when it'll take someone only a few minutes to undo what you've done? Could that time have been better spent writing awesome features that your customers would love?

于 2011-05-13T01:44:03.367 回答
3

ord会给你一个字符的 ASCII 值,使用它我们可以生成你想要的 3 个东西。

类型 1:dechex用于将 int 转换为 hex。

$chr = 's';
$hex = dechex(ord($chr)); // 73

类型 2:decoct用于转换为八进制。

$chr = 'E';
$oct = decoct(ord($chr)); // 105

类型 3:使用<<(左移)运算符。

$chr = 'e';
$bin = ord($chr)<<23; // 847249408
于 2011-05-12T20:34:17.797 回答